Vagrant Interview Questions And Answers 2018

Vagrant Interview Questions And Answers 2018. Here Coding compiler sharing a list of 30 Vagrant interview questions for Devops. These Vagrant questions will help you to crack your next Vagrant Devops job interview.

Vagrant Interview Questions

  1. What is Vagrant?
  2. Vagrant is written in which language?
  3. What is a BOX in Vagrant?
  4. What is Provider in Vagrant?
  5. What is Provisioner in Vagrant?
  6. What are the subcommands associated with Box command?
  7. Explain Box Add Command in Vagrant?
  8. What is Box List command in Vagrant?
  9. What is Box Outdated command in Vagrant?
  10. What is Box Prune command in Vagrant?

Vagrant Interview Questions And Answers

1) What is Vagrant?

A) Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker, VMware, and AWS.

2) Vagrant is written in which language?

A) Vagrant is written in Ruby language.

3) What is a BOX in Vagrant?

A) A box is a packaged Vagrant environment, typically a virtual machine.

4) What is Provider in Vagrant?

A) A provider is the location in which the virtual environment runs. It can be local (the default is to use VirtualBox), remote, or even a special case like a Docker container.

5) What is Provisioner in Vagrant?

A) A provisioner is a tool to set up the virtual environment, and can be as simple as a shell script, but alternatively a more advanced tool like Chef, Puppet, or Ansible can be used.

6) What are the subcommands associated with Box command?

A) Box command used to manage (add, remove, etc.) boxes.

Command: vagrant box

The main functionality of this command is exposed via even more subcommands:

  • add
  • list
  • outdated
  • prune
  • remove
  • repackage
  • update

7) Explain Box Add Command in Vagrant?

A) Command: vagrant box add ADDRESS

This adds a box with the given address to Vagrant.

8) What is Box List command in Vagrant?

A) Command: vagrant box list

This command lists all the boxes that are installed into Vagrant.

9) What is Box Outdated command in Vagrant?

A) Command: vagrant box outdated

This command tells you whether or not the box you are using in your current Vagrant environment is outdated.

10) What is Box Prune command in Vagrant?

A) Command: vagrant box prune

This command removes old versions of installed boxes. If the box is currently in use vagrant will ask for confirmation.

Vagrant DevOps Interview Questions

11) What is Box Remove command in Vagrant?

A) Command: vagrant box remove NAME

This command removes a box from Vagrant that matches the given name.

12) What is Box Repackage command in Vagrant?

A) Command: vagrant box repackage NAME PROVIDER VERSION

This command repackages the given box and puts it in the current directory so you can redistribute it. The name, provider, and version of the box can be retrieved using vagrant box list.

13) What is Box Update command in Vagrant?

A) Command: vagrant box update

This command updates the box for the current Vagrant environment if there are updates available.

14) What is Connect command in Vagrant?

A) Command: vagrant connect NAME

The connect command complements the share command by enabling access to shared environments.

15) Destroy command in Vagrant

A) Command: vagrant destroy [name|id]

16) Global Status command in Vagrant

A) Command: vagrant global-status

17) What is Vagrant Share?

A) Vagrant Share allows you to share your Vagrant environment with anyone in the world, enabling collaboration directly in your Vagrant environment in almost any network environment with just a single command: vagrant share.
This command will tell you the state of all active Vagrant environments on the system for the currently logged in user.
This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process.

18) What is Vagrantfile?

A) The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines.

19) What is Provisioning in Vagrant?

A) Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process.

20) What are Synced Folders in Vagrant?

A) Synced folders enable Vagrant to sync a folder on the host machine to the guest machine, allowing you to continue working on your project’s files on your host machine, but use the resources in the guest machine to compile or run your project.

Vagrant Tool Interview Questions And Answers

21) What is Multi-Machine environment in Vagrant?

A) Vagrant is able to define and control multiple guest machines per Vagrantfile. This is known as a “multi-machine” environment.

These machines are generally able to work together or are somehow associated with each other. Here are some use-cases people are using multi-machine environments for today:

Accurately modeling a multi-server production topology, such as separating a web and database server.
Modeling a distributed system and how they interact with each other.
Testing an interface, such as an API to a service component.
Disaster-case testing: machines dying, network partitions, slow networks, inconsistent world views, etc.

22) How do you define multiple machines in Vagrant?

A) Multiple machines are defined within the same project Vagrantfile using the config.vm.define method call.

23) What are Providers in Vagrant?

A) While Vagrant ships out of the box with support for VirtualBox, Hyper-V, and Docker, Vagrant has the ability to manage other types of machines as well. This is done by using other providers with Vagrant.

24) What are Plugins in Vagrant and how they assist?

A) Vagrant comes with many great features out of the box to get your environments up and running. Sometimes, however, you want to change the way Vagrant does something or add additional functionality to Vagrant. This can be done via Vagrant plugins.

25) What is Vagrant Push?

A) Vagrant is capable of deploying or “pushing” application code in the same directory as your Vagrantfile to a remote such as an FTP server.

Pushes are defined in an application’s Vagrantfile and are invoked using the vagrant push subcommand.

26) What is vagrant in DevOps?
A) DevOps is a lot more than configuration management.  Vagrant is another tool to help your organization transition to a DevOps culture. Vagrant also helps improve your entire workflow of using Puppet, improving development and process for both developers and operations.
27) What is a vagrant image?
A) The Vagrantfile has some information that will be merged into your Vagrantfile that is created when you run vagrant init boxname in a folder. The box-disk.vmdk is the virtual hard disk drive. The box.ovf defines the virtual hardware for thebox.
28) What is vagrant Linux?
A) Vagrant manages virtual machines hosted in Oracle VirtualBox, a full x86 virtualizer that is also open source (GPLv2). A virtual machine is a software implementation of a computer, running a complete operating system stack on a virtualizer. It is a full implementation of a computer with a virtual disk, memory and CPU.
29) What is vagrant virtualbox?
A) Vagrant comes with support out of the box for VirtualBox, a free, cross-platform consumer virtualization product. VirtualBox can be installed by downloading a package or installer for your operating system and using standard procedures to install that package.
30) What is Ansible and vagrant?
A) Vagrant is a tool to manage virtual machine environments, and allows you to configure and use reproducible work environments on top of various virtualization and cloud platforms. It also has integration with Ansible as a provisioner for these virtual machines, and the two tools work together well.

OTHER INTERVIEW QUESTIONS

  1. 60 Java Multiple Choice Questions
  2. 40 Core Java MCQ Questions
  3. Anaplan Interview Questions And Answers
  4. Tableau Multiple Choice Questions
  5. Python Coding Interview Questions
  6. CSS3 Interview Questions
  7. Linux Administrator Interview Questions
  8. SQL Interview Questions
  9. Hibernate Interview Questions
  10. Kubernetes Interview Questions
  11. Kibana Interview Questions
  12. Nagios Interview Questions
  13. Jenkins Interview Questions
  14. Chef Interview Questions
  15. Puppet Interview Questions
  16. RPA Interview Questions And Answers
  17. Android Interview Questions
  18. Mulesoft Interview Questions
  19. JSON Interview Questions
  20. PeopleSoft HRMS Interview Questions
  21. PeopleSoft Functional Interview Questions
  22. PeopleTools Interview Questions
  23. Peoplesoft Technical Interview Questions
  24. 199 Peoplesoft Interview Questions
  25. 200 Blue Prism Interview Questions
  26. Visualforce Interview Questions
  27. Salesforce Interview Questions
  28. 300 SSIS Interview Questions
  29. PHP Interview Questions And Answers
  30. Alteryx Interview Questions
  31. AWS Cloud Support Interview Questions
  32. Google Kubernetes Engine Interview Questions
  33. AWS Devops Interview Questions

Core Java Multiple Choice Questions With Answers 2018

Core Java Multiple Choice Questions With Answers 2018. Here Coding compiler sharing a list of 40 Java Objective Questions and Answers for freshers and experienced Java developers. We hope that these Java MCQ Questions will help you to crack your next Java interview. All the best for your future and happy Java learning.

Core Java Multiple Choice Questions

1) A process that involves recognizing and focusing on the important characteristics of a situation or object is known as:

(a) Encapsulation (b) Polymorphism
(c) Abstraction (d) Inheritance
(e) Object persistence.

A) c

2) Which statement is true regarding an object?

(a) An object is what classes instantiated are from
(b) An object is an instance of a class
(c) An object is a variable
(d) An object is a reference to an attribute
(e) An object is not an instance of a class.

A) b

3) In object-oriented programming, composition relates to

(a) The use of consistent coding conventions
(b) The organization of components interacting to achieve a coherent, common behavior
(c) The use of inheritance to achieve polymorphic behavior
(d) The organization of components interacting not to achieve a coherent common behavior
(e) The use of data hiding to achieve polymorphic behavior.

A) b

4) In object-oriented programming, new classes can be defined by extending existing classes. This is an example of:

(a) Encapsulation (b) Interface
(c) Composition (d) Inheritance (e) Aggregation.

A) d

5) Which of the following does not belong: If a class inherits from some other class, it should

(a) Make use of the parent class’s capabilities
(b) Over-ride or add the minimum to accomplish the derived class’ purpose
(c) Over-ride all the methods of its parent class
(d) Make sure the result “IS-A-KIND-OF” its base class
(e) Make sure the result “contains” its base class.

A) c

6) Object-oriented inheritance models the

(a) “is a kind of” relationship
(b) “has a” relationship
(c) “want to be” relationship
(d) inheritance does not describe any kind of relationship between classes
(e) “contains” of relationship.

A) a

7) The wrapping up of data and functions into a single unit is called

(a) Encapsulation (b) Abstraction
(c) Data Hiding (d) Polymorphism (e) Message passing.

A) a

8) Polymorphism

(a) Is not supported by Java
(b) Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class-specific ways
(c) Simplifies code maintenance
(d) Not simplifies code maintenance
(e) Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class-specific ways and simplifies code maintenance.

A) e

9) In object-oriented programming, new classes can be defined by extending existing classes. This is an example of:

(a) Encapsulation (b) Interface (c) Composition
(d) Inheritance (e) Aggregation.

A) d

10) Given a class named student, which of the following is a valid constructor declaration for the class?

(a) Student (student s) { } (b) Student student ( ) { }
(c) Private final student ( ) { } (d) Void student ( ) { }
(e) Static void student(){ }.

A) a

Core Java Multiple Choice Questions With Answers

11) What is garbage collection in the context of Java?

(a) The operating system periodically deletes all of the java files available on the system.
(b) Any package imported in a program and not used is automatically deleted.
(c) When all references to an object are gone, the memory used by the object is automatically reclaimed.
(d) The JVM checks the output of any Java program and deletes anything that doesn’t make sense.
(e) When all references to an object are gone the memory used by the object is not reclaimed.

A) c

12) The concept of multiple inheritances is implemented in Java by

I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces.
III. Implementing two or more interfaces.

(a) Only (II) (b) (I) and (II) (c) (II) and (III)
(d) Only (I) (e) Only (III).

A) c

13) In Java, declaring a class abstract is useful

(a) To prevent developers from further extending the class
(b) When it doesn’t make sense to have objects of that class
(c) When default implementations of some methods are not desirable
(d) To force developers to extend the class not to use its capabilities
(e) When it makes sense to have objects of that class.

A) b

14) What is the error in the following class definitions?

Abstract class xy
{
abstract sum (int x, int y) { }
}

(a) Class header is not defined properly.
(b) Constructor is not defined.
(c) Method is not defined properly
(d) Method is defined properly
(e) No error.

A) c

15) Which of these field declarations are legal within the body of an interface?

(a) Private final static int answer = 42 (b) public static int answer=42
(c) final static answer =42 (d) int answer
(e) No error.

A) b

16) A package is a collection of

(a) Classes (b) Interfaces (c) Editing tools
(d) Classes and interfaces (e) Editing tools and interfaces.

A) d

17) A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?

(a) Declare the method with the keyword public
(b) Declare the method with the keyword private
(c) Declare the method with the keyword protected
(d) Do not declare the method with any accessibility modifiers
(e) Declare the method with the keyword public and private.

A) d

18) Basic Java language functions are stored in which of the following java package?

(a) java.lang (b) java.io (c) java.net (d) java.util (e) java.awt

A) a

19) Which of the following is a member of the java.lang package?

(a) List (b) Queue (c) Math (d) Stack (e) Process.

A) b

20) Which of the following has a method names flush( )?

(a) Input stream (b) Output Stream
(c) Reader stream (d) Input reader stream
(e) Input output stream.

A) b

Core Java Multiple Choice Questions And Answers

Core Java Multiple Choice Questions # 21) What is the fundamental unit of information of writer streams?

(a) Characters (b) Bytes
(c) Files (d) Records (e) Information.

A) a

Core Java Multiple Choice Questions # 22) File class is included in which package?

(a) java.io package (b) java.lang package
(c) java.awt package (d) java.net.package
(e) java.util.package.

A) a

Core Java Multiple Choice Questions # 23) Given the code

String s1 = ” yes” ;
String s2 = ” yes ” ;
String s3 = new String ( s1);

Which of the following would equate to true?

(a) s1 == s2 (b) s1 = s2 (c) s3 == s1 (d) s3=s1 (e) s1!=s2.

A) a

Core Java Multiple Choice Questions # 24) URL stands for

(a) Universal reader locator (b) Universal reform loader
(c) Uniform resource loader (d) Uniform resource locator
(e) Uniform reader locator.

A) d

Core Java Multiple Choice Questions # 25) What is the sequence of major events in the life of an applet?

(a) init, start, stop, destroy (b) start, init , stop , destroy
(c) init, start , destroy, stop (d) init, start, destroy
(e) destroy, start, init, stop.

A) a

Core Java Multiple Choice Questions # 26) Which of the following is true in regard to applet execution?

(a) Applets loaded from the same computer where they are executing have the same restrictions as applets loaded from the network.
(b) Applets loaded and executing locally have none of the restrictions faced by applets that get loaded from the network.
(c) Applets loaded and executing locally have some restrictions faced by applets that get loaded from the network.
(d) Applets cant react to user input and change dynamically
(e) Applets can be run independently.

A) b

Core Java Multiple Choice Questions # 27) What is the return type of the method getID() defined in AWTEvent class

(a) Int (b) long (c) Object (d) Component (e) float.

A) a

Core Java Multiple Choice Questions # 28) Which of the following events will cause a thread to die?

(a) The method sleep( ) is called
(b) The method wait( ) is called
(c) Execution of the start( ) method ends
(d) Execution of the run( ) method ends
(e) Execution of the run() method is called.

A) d

Core Java Multiple Choice Questions # 29) What will be the result of the expression 13 & 25?

(a) 38 (b) 25 (c) 9 (d) 12 (e) 21.

A) c

Core Java Multiple Choice Questions # 30) Which of the following statements are true regarding the finalize( ) method?

(a) The finalize ( ) method must be declared with protected accessibility
(b) The compiler will fail to compile the code that explicitly tries to call the finalize( ) method
(c) The body of the finalize ( ) method can only access other objects that are eligible for garbage collection
(d) The finalize ( ) method can be overloaded
(e) The finalize() method cant be overloaded.

A) d

Core Java Objective Questions And Answers

Core Java Multiple Choice Questions # 31) Which one of these is a valid method declaration?

(a)
void method1
(b)
void method2()
(c)
void method3(void)
(d)
method4()
(e)
methods(void).

A) b

Core Java Multiple Choice Questions # 32) Given a class named Book, which one of these is a valid constructor declaration for the class?

(a)
Book(Book b) { }
(b)
Book Book() { }
(c)
private final Book() { }
(d)
void Book() { }
(e)
abstract Book() { }.

A) a

Core Java Multiple Choice Questions # 33) What will be the result of attempting to compile the following program?

public class MyClass {
long var;
public void MyClass(long param) { var = param; } //(1)
public static void main(String[] args) {
MyClass a,b;
a = new MyClass(); //(2)
b = new MyClass(5); //(3)
}
}

(a)
A compilation ERROR will occur at (1), since constructors cannot specify a return value
(b)
A compilation error will occur at (2), since the class does not have a default constructor
(c)
A compilation error will occur at (3), since the class does not have a constructor which takes one argument of type int
(d)
The program will compile correctly
(e)
The program will compile and execute correctly.

A) c

Core Java Multiple Choice Questions # 34) Given the following class, which of these is valid way of referring to the class from outside of the package net.basemaster?

package net.basemaster;
public class Base {
// . . .
}
Select the correct answer.

(a)
By simply referring to the class as Base
(b)
By simply referring to the class as basemaster.Base
(c)
By simply referring to the class as net.basemaster.Base
(d)
By simply referring to the class as net.Base
(e)
By importing with net.* and referring to the class as basemaster.Base.

A) c

Core Java Multiple Choice Questions # 35) Which one of the following class definitions is a valid definition of a class that cannot be instantiated?

(a)
class Ghost
{
abstract void haunt();
}

(b)
abstract class Ghost
{
void haunt();
}

(c)
abstract class Ghost
{
void haunt() { };
}

(d)
abstract Ghost
{
abstract void haunt();
}

(e)
static class Ghost
{
abstract haunt();
}

A) c

Core Java MCQ Questions With Answers

36) Which one of the following class definitions is a valid definition of a class that cannot be extended?

(a)
class Link { }
(b)
abstract class Link { }
(c)
native class Link { }
(d)
static class Link { }
(e)
final class Link { }.

A) e

37) Given the following definition of a class, which fields are accessible from outside the package com.corporation.project?

package com.corporation.project;
public class MyClass
{
int i;
public int j;
protected int k;
private int l;
}
Select the correct answer.

(a)
Field i is accessible in all classes in other packages
(b)
Field j is accessible in all classes in other packages
(c)
Field k is accessible in all classes in other packages
(d)
Field l is accessible in all classes in other packages
(e)
Field l is accessible in subclasses only in other packages.

A) b

38) How restrictive is the default accessibility compared to public, protected, and private accessibility?

(a)
Less restrictive than public
(b)
More restrictive than public, but less restrictive than protected
(c)
More restrictive than protected, but less restrictive than private
(d)
More restrictive than private
(e)
Less restrictive than protected from within a package, and more restrictive than protected from outside a package.

A) c

39) Which statement is true about accessibility of members?

(a)
Private members are always accessible from within the same package
(b)
Private members can only be accessed by code from within the class of the member
(c)
A member with default accessibility can be accessed by any subclass of the class in which it is defined
(d)
Private members cannot be accessed at all
(e)
Package/default accessibility for a member can be declared using the keyword default.

A) b

40) Which of the following is true about the use of modifiers?

(a)
If no accessibility modifier (public, protected, and private) is specified for a member declaration, the member is only accessible for classes in the package of its class and subclasses of its class anywhere
(b)
You cannot specify accessibility of local variables. They are only accessible within the block in which they are declared
(c)
Subclasses of a class must reside in the same package as the class they extend
(d)
Local variables can be declared static
(e)
None of the above.

A) b

Related Java Interview Questions

  1. 60 Java Multiple Choice Questions
  2. Aricent Java Interview Questions
  3. Accenture Java Interview Questions
  4. Advanced Java Interview Questions For 5 8 10 Years Experienced
  5. Core Java Interview Questions For Experienced

OTHER INTERVIEW QUESTIONS

  1. Anaplan Interview Questions And Answers
  2. Tableau Multiple Choice Questions
  3. Python Coding Interview Questions
  4. CSS3 Interview Questions
  5. Linux Administrator Interview Questions
  6. SQL Interview Questions
  7. Hibernate Interview Questions
  8. Kubernetes Interview Questions
  9. Kibana Interview Questions
  10. Nagios Interview Questions
  11. Jenkins Interview Questions
  12. Chef Interview Questions
  13. Puppet Interview Questions
  14. RPA Interview Questions And Answers
  15. Android Interview Questions
  16. Mulesoft Interview Questions
  17. JSON Interview Questions
  18. PeopleSoft HRMS Interview Questions
  19. PeopleSoft Functional Interview Questions
  20. PeopleTools Interview Questions
  21. Peoplesoft Technical Interview Questions
  22. 199 Peoplesoft Interview Questions
  23. 200 Blue Prism Interview Questions
  24. Visualforce Interview Questions
  25. Salesforce Interview Questions
  26. 300 SSIS Interview Questions
  27. PHP Interview Questions And Answers
  28. Alteryx Interview Questions
  29. AWS Cloud Support Interview Questions
  30. Google Kubernetes Engine Interview Questions
  31. AWS Devops Interview Questions

Anaplan Interview Questions And Answers 2018

Anaplan Interview Questions And Answers 2018. Here Coding compiler sharing a very useful list of 25 Anaplan questions. These real-time Anaplan interview questions will help you to crack your next Anaplan job interview. All the best for your future and happy Anaplan learning.

Anaplan Interview Questions

  1. What is Anaplan?
  2. What are your key responsibilities in your current job as an Anaplan consultant?
  3. What are the features of Anaplan?
  4. What are the Modeling features of Anaplan?
  5. How Anaplan handles User Access Control?
  6. What is COLLABORATIVE WORKFLOW in Anaplan?
  7. Explain HISTORY AND REVISION CONTROL in Anaplan?
  8. What is CENTRAL DATA REPOSITORY in Anaplan?
  9. What is DATA SYNCHRONICITY in Anaplan?
  10. Explain INTUITIVE MODELING INTERFACE in Anaplan?
  11. Is Anaplan accessible from Mobile?
  12. What is the use of DASHBOARDS AND REPORTS in Anaplan?
  13. Explain AVAILABILITY AND RELIABILITY in Anaplan?
  14. Explain APPLICATION SECURITY in Anaplan?
  15. What are the modules supported by Anaplan?

Anaplan Interview Questions And Answers

1) What are your key responsibilities in your current job as an Anaplan consultant?

A) It depends on the job roles and differs company to company, but generally, Anaplan consultants involved in identifying business requirements, requirements management, functional design, prototyping, process design (including scenario design, flow mapping), testing, training, defining support procedures and supporting implementations.

2) What is Anaplan?

A) Anaplan is a cloud-based planning and performance management platform with documented use cases in finance, sales, supply chain, marketing, IT and HR.

3) What are the features of Anaplan?

A) Anaplan Platform features:

CLOUD-BASED: Anaplan was built from day one as a cloud platform—combining cutting-edge security, in-memory data management, and massive scalability.

REAL-TIME, SCALABLE MODELING AND CALCULATION ENGINE: RealTimeModeling – By tracking dependencies at the level of the line item, our Hyperblock™ technology enables updates or changes to models of any size, from one to one trillion cells, in real time.

IN-MEMORY PROCESSING: Anaplan’s in-memory engine enables detailed planning models that utilizes all your data down to the transactional level (Product SKU, Stores, Employees, etc.) for better business decisions.

APP HUB: To get you started quickly, a growing collection of apps for common use cases are available in the Anaplan App Hub. Use them as is, modify them to suit your special needs, or start from scratch and create your own.

DATA INTEGRATION: Anaplan offers an API, import/export capabilities, and pre-built connectors for common platforms like Anaplan HyperConnect, Informatica, Dell Boomi, Mulesoft, and SnapLogic.

MULTI-DIMENSIONAL PLANNING: Build models to any level of granularity with any number of dimensions—layer in time (daily/weekly/monthly), hierarchies, relationships, and more.

VERSATILITY: Versatility is the ability to model a vast array of processes within your business. The 150+ apps in our App Hub can be applied to vastly different sets of processes, including sales performance optimization, financial budgeting and forecasting, and call center operations. All created by users with clicks, not code.

4) What are the Modeling features of Anaplan?

A) Modeling features of Anaplan:

MASTER REPOSITORY OF BUSINESS RULES (LIVING BLUEPRINT): Using our Living Blueprint technology, all your complex business rules (in natural syntax) are stored and managed in one easy-to-understand worksheet.

MODEL VERSIONS: Anaplan enables users to create new model versions on-the-fly. Quickly replicate models, load with data, and easily track actuals in the same model as plans.

BREAKBACK: With breakback, users can set a target for a formula, and the variables that make up that formula are changed according to the rules specified.

DYNAMIC SCENARIO BUILDING: Anaplan delivers strategic advantage with fast, easy creation of dynamic scenarios with time, version, and list dimensions.

5) How Anaplan handles User Access Control?

A) Anaplan enables flexible role-based security levels for user types. Audit trail, model restore, and selective user access make it possible for analysts to safely and simultaneously collaborate on common models.

Anaplan Interview Questions # 6) What is COLLABORATIVE WORKFLOW in Anaplan?

A) Monitor status and approvals with a collaborative workflow that streamlines top-down target allocation and consolidation of roll-ups from the field. A robust audit trail ensures that changes are easy to track.

Anaplan Interview Questions # 7) Explain HISTORY AND REVISION CONTROL in Anaplan?

A) Anaplan robust audit trail ensures that changes are easy to track and revert. See a history of users and changes and roll back to earlier versions.

Anaplan Interview Questions # 8) What is CENTRAL DATA REPOSITORY in Anaplan?

A) Anaplan delivers a central repository to reconcile various sources of data for clean, reliable hierarchy. Additionally, master data (products, employees, cost centers, etc.) is accessible to analysts around the enterprise.

Anaplan Interview Questions # 9) What is DATA SYNCHRONICITY in Anaplan?

A) Anaplan dynamically synchronizes data across connected plans—automatically aggregating and identifying discrepancies for real-time consistency.

Anaplan Interview Questions # 10) Explain INTUITIVE MODELING INTERFACE in Anaplan?

A) Business users can use familiar business syntax, drag-and-drop hierarchies, and built-in logic for time, versions, and scenarios. With Anaplan, there are no technical barriers between you and business insights. No reliance on IT for business rules adjustments, model creation, or changes. No more scripting or broken cell references.

Anaplan Analyst Interview Questions

Anaplan Interview Questions # 11) Is Anaplan accessible from Mobile?

A) Yes, Anaplan is accessible from any mobile device via a browser so you never have to be disconnected from your data.

Anaplan Interview Questions # 12) What is the use of DASHBOARDS AND REPORTS in Anaplan?

A) Anaplan has a variety of publishing features, including dashboards, charts, PDF generation, and a tightly integrated Excel® plug-in. Share insights with the field, enable management to do their own scenario analysis, and create stunning executive packs.

Anaplan Interview Questions # 13) Explain AVAILABILITY AND RELIABILITY in Anaplan?

A) Anaplan invested heavily to provide the highest levels of availability, reliability, and security. Redundant data centers and rigorous processes for back-up, failover, and disaster recovery comply with or exceed all major industry standards. Anaplan delivers constant uptime so that your business-critical data and plans are safe and accessible at all times.

Anaplan Interview Questions # 14) Explain APPLICATION SECURITY in Anaplan?

A) In addition to secure data centers, Anaplan provides complete application-layer security, including data encryption on-the-wire, secure authentication protocols, and robust access control and authorization for managing user rights. We also use leading security firms to conduct regular penetration testing.

15) What are the modules supported by Anaplan?

A) Anaplan supports following modules:

  • Finance
  • Sales
  • Supply chain
  • Workforce
  • Marketing
  • IT

Anaplan Interview Questions # 16) What are the features available in Finance module in Anaplan?

A) By connecting financial and operational planning, you can drive valuable business performance more effectively. With Anaplan’s cloud-based platform, corporate objectives align with operating plans that can be adjusted in response to market events—empowering finance to help the business make better decisions by anticipating the future.

  • Strategic Planning – Optimizing business models, product lines, and operational capabilities with ease and confidence.
  • Budgeting and forecasting – Increase speed and agility by automating the manual process and adopting best practices.
  • Operational planning – Take cross-functional decisions to unprecedented levels of operational planning in one platform.
  • Financial consolidation and corporate reporting – Experience a faster, more efficient period-end close and report with confidence—without compromising compliance.

Anaplan Interview Questions # 17) What are the features available in Sales module in Anaplan?

A) With Anaplan Sales module, deliver on-time sales plans while increasing compensation, quota, and forecast accuracy.

  • Sales Capacity
  • Account Segmentation and Scoring
  • Territory Planning
  • Quota Planning
  • Deal Desk
  • Sales Forecasting
  • Incentive Compensation

18) What are the features available in Anaplan for Supply chain?

A) Anaplan enables users to connect global supply chain network for maximum visibility, efficiency, and collaboration.

Product portfolio management
Demand planning
Supply planning
Sales and operations planning
Strategic policy management

19) What are the features available in Anaplan for workforce?

A) Align people plans to operational goals to support business results with the help of Anaplan for workforce.

  • Workforce
  • Headcount and Cost Planning
  • Workforce Capacity Planning
  • Succession Planning
  • Compensation and Equity Planning
  • Workforce Optimization, including Call Center
  • Onboarding Planning

20) What are the features available in Anaplan for Marketing?

A) ANAPLAN FOR Marketing helps in increase the efficiency and effectiveness of your marketing plan, performance, and spend.

  • Account Segmentation and Scoring
  • Marketing Resource Management
  • Marketing Performance Management
  • Trade Promotion Planning
  • Market Share and Growth Forecasting

Anaplan Interview Questions # 21) What are the features available in Anaplan for IT?

A) ANAPLAN FOR IT drive agile IT planning and project execution across your business.

  • Agile Implementation
  • ABC Shared Services Allocations
  • Agile Planning
  • Project Plan Capacity Analysis
  • Business Case Management
  • Project Planning
  • IT Financial Management and Cost Transparency
  • Business Management Scorecard
  • Facilities Management

Anaplan Interview Questions # 22) Do you know any Anaplan Customers?

A) Yes I know, many major companies using Anaplan, few of them are

VMWare
Tableau
Intel
HP
BOX
Motorola
Tata Steel

Anaplan Interview Questions # 23) What are Anaplan Apps?

A) Anaplan is the only technology in the world that enables business users to easily build sophisticated planning apps with zero coding.

Anaplan enables users to turn the complexity of business operations into powerful, easy-to-use applications for forecasting, planning, modeling, and performance management.

Anaplan Interview Questions # 24) What is Anaplan App Hub?

A) The Anaplan App Hub enables customers and partners to build, share, and deploy cutting-edge apps. The Anaplan community brings together experts from a wide range of business domains, industries, and organizations. You can quickly discover the applications you need, deploy them in one click, and customize them to solve your company’s complex challenges. You can also easily build your own applications on the platform and share them with others.

Anaplan Interview Questions # 25) What are the advantages of Anaplan?

A) The flexibility and scalability of the Anaplan platform means it can serve as a basis for financial, commercial as well as operational planning models. Furthermore, these models can easily be linked and work in seamless integration with one another.

Models can either be built from scratch, or extended and customized based on pre-delivered models – with models existing for topics such as

  • Traditional P&L,
  • Balance Sheet & Cash Flow planning,
  • Financial Consolidation,
  • Premium Modeling and Claims Analysis for insurance,
  • Sales Forecasting, Territory Planning,
  • Quota Management,
  • Pricing & Commission Calculation and many others.

These selection of models is constantly being extended. An Anaplan ‘model/app store’ will further accelerate availability. Source: Anaplan Website

OTHER INTERVIEW QUESTIONS

  1. Java Multiple Choice Questions
  2. Python Coding Interview Questions
  3. CSS3 Interview Questions
  4. Linux Administrator Interview Questions
  5. SQL Interview Questions
  6. Hibernate Interview Questions
  7. Kubernetes Interview Questions
  8. Kibana Interview Questions
  9. Nagios Interview Questions
  10. Jenkins Interview Questions
  11. Chef Interview Questions
  12. Puppet Interview Questions
  13. RPA Interview Questions And Answers
  14. Android Interview Questions
  15. Mulesoft Interview Questions
  16. JSON Interview Questions
  17. PeopleSoft HRMS Interview Questions
  18. PeopleSoft Functional Interview Questions
  19. PeopleTools Interview Questions
  20. Peoplesoft Technical Interview Questions
  21. 199 Peoplesoft Interview Questions
  22. 200 Blue Prism Interview Questions
  23. Visualforce Interview Questions
  24. Salesforce Interview Questions
  25. 300 SSIS Interview Questions
  26. PHP Interview Questions And Answers
  27. Alteryx Interview Questions
  28. AWS Cloud Support Interview Questions
  29. Google Kubernetes Engine Interview Questions
  30. AWS Devops Interview Questions

60 Java Multiple Choice Questions And Answers 2018

Java Multiple Choice Questions And Answers 2018. Here Coding compiler sharing a list of 60 core java and advanced java multiple choice questions and answers for freshers and experienced. These java multiple choice interview questions asked in various java interview exams. We hope that this list of java mcq questions will help you to crack your next java mcq online test. All the best for your future and happy java learning.

 Java Multiple Choice Questions

1) The default value of a static integer variable of a class in Java is,

(a) 0 (b) 1 (c) Garbage value (d) Null (e) -1.

A) a

2) What will be printed as the output of the following program?

public class testincr
{
public static void main(String args[])
{
int i = 0;
i = i++ + i;
System.out.println(“I = ” +i);
}
}

(a) I = 0 (b) I = 1 (c) I = 2 (d) I = 3 (e) Compile-time Error.

A) b

3) Multiple inheritance means,

(a) one class inheriting from more super classes
(b) more classes inheriting from one super class
(c) more classes inheriting from more super classes
(d) None of the above
(e) (a) and (b) above.

A) a

4) Which statement is not true in java language?

(a) A public member of a class can be accessed in all the packages.
(b) A private member of a class cannot be accessed by the methods of the same class.
(c) A private member of a class cannot be accessed from its derived class.
(d) A protected member of a class can be accessed from its derived class.
(e) None of the above.

A) b

5) To prevent any method from overriding, we declare the method as,

(a) static (b) const (c) final (d) abstract (e) none of the above.

A) c

6) Which one of the following is not true?

(a) A class containing abstract methods is called an abstract class.
(b) Abstract methods should be implemented in the derived class.
(c) An abstract class cannot have non-abstract methods.
(d) A class must be qualified as ‘abstract’ class, if it contains one abstract method.
(e) None of the above.

A) c

7) The fields in an interface are implicitly specified as,

(a) static only (b) protected (c) private
(d) both static and final (e) none of the above.

d

8) What is the output of the following program:

public class testmeth
{
static int i = 1;
public static void main(String args[])
{
System.out.println(i+” , “);
m(i);
System.out.println(i);
}
public void m(int i)
{
i += 2;
}
}

(a) 1 , 3 (b) 3 , 1 (c) 1 , 1 (d) 1 , 0 (e) none of the above.

A) c

9) Which of the following is not true?

(a) An interface can extend another interface.
(b) A class which is implementing an interface must implement all the methods of the interface.
(c) An interface can implement another interface.
(d) An interface is a solution for multiple inheritance in java.
(e) None of the above.

A) c

10) Which of the following is true?

(a) A finally block is executed before the catch block but after the try block.
(b) A finally block is executed, only after the catch block is executed.
(c) A finally block is executed whether an exception is thrown or not.
(d) A finally block is executed, only if an exception occurs.
(e) None of the above.

A) c

Java Multiple Choice Questions And Answers

11) Among these expressions, which is(are) of type String?

(a) “0” (b) “ab” + “cd”
(c) ‘0’
(d) Both (A) and (B) above (e) (A), (B) and (C) above.

A) d

12) Consider the following code fragment
Rectangle r1 = new Rectangle();
r1.setColor(Color.blue);
Rectangle r2 = r1;
r2.setColor(Color.red);

After the above piece of code is executed, what are the colors of r1 and
r2 (in this order)?

(a) Color.blue
Color.red
(b) Color.blue
Color.blue
(c) Color.red
Color.red
(d) Color.red
Color.blue
(e) None of the above.

A) c

13) What is the type and value of the following expression? (Notice the integer division)
-4 + 1/2 + 2*-3 + 5.0

(a) int -5 (b) double -4.5
(c) int -4
(d) double -5.0 (e) None of the above.

A) d

14) What is printed by the following statement?
System.out.print(“Hello,\nworld!”);

(a) Hello, \nworld! (b) Hello, world!
(c)
(d) “Hello, \nworld!” (e) None of the above.

A) c

15) Consider the two methods (within the same class)
public static int foo(int a, String s)
{
s = “Yellow”;
a=a+2;
return a;
}
public static void bar()
{
int a=3;
String s = “Blue”;
a = foo(a,s);
System.out.println(“a=”+a+” s=”+s);
}
public static void main(String args[])
{
bar();
}

What is printed on execution of these methods?

(a) a = 3 s = Blue (b) a = 5 s = Yellow (c) a = 3 s = Yellow
(d) a = 5 s = Blue (e) none of the above.

A) d

16) Which of the following variable declaration would NOT compile in a java program?

(a) int var; (b) int VAR; (c) int var1; (d) int var_1; (e) int 1_var;.

A) e

17) Consider the following class definition:

public class MyClass
{
private int value;
public void setValue(int i){ / code / }
// Other methods…
}

The method setValue assigns the value of i to the instance field value. What could you write for the implementation of setValue?

(a) value = i; (b) this.value = i; (c) value == i;
(d) Both (A) and (B) and above (e) (A), (B) and (C) above.

A) d

18) Which of the following is TRUE?

(a) In java, an instance field declared public generates a compilation error.
(b) int is the name of a class available in the package java.lang
(c) Instance variable names may only contain letters and digits.
(d) A class has always a constructor (possibly automatically supplied by the java compiler).
(e) The more comments in a program, the faster the program runs.

A) d

19) A constructor

(a) Must have the same name as the class it is declared within.
(b) Is used to create objects.
(c) May be declared private
(d) Both (A) and (B) above
(e) (a), (b) and (c) above.

A) e

20) Consider,

public class MyClass
{
public MyClass(){/code/}
// more code…
}

To instantiate MyClass, you would write?

(a) MyClass mc = new MyClass();
(b) MyClass mc = MyClass();
(c) MyClass mc = MyClass;
(d) MyClass mc = new MyClass;
(e) The constructor of MyClass should be defined as, public void MyClass(){/code/}.

A) a

Java Programming Multiple Choice Questions

Java Multiple Choice Questions 21) What is byte code in the context of Java?

(a) The type of code generated by a Java compiler.
(b) The type of code generated by a Java Virtual Machine.
(c) It is another name for a Java source file.
(d) It is the code written within the instance methods of a class.
(e) It is another name for comments written within a program.

A) a

Java Multiple Choice Questions 22) What is garbage collection in the context of Java?

(a) The operating system periodically deletes all the java files available on the system.
(b) Any package imported in a program and not used is automatically deleted.
(c) When all references to an object are gone, the memory used by the object is automatically reclaimed.
(d) The JVM checks the output of any Java program and deletes anything that doesn’t make sense.
(e) Janitors working for Sun Micro Systems are required to throw away any Microsoft documentation found in the employees’ offices.

A) c

Java Multiple Choice Questions 23) You read the following statement in a Java program that compiles and executes.
submarine.dive(depth);

What can you say for sure?

(a) depth must be an int
(b) dive must be a method.
(c) dive must be the name of an instance field.
(d) submarine must be the name of a class
(e) submarine must be a method.

A) b

Java Multiple Choice Questions 24) The java run time system automatically calls this method while garbage collection.

(a) finalizer() (b) finalize() (c) finally()
(d) finalized() (e) none of the above.

A) b

Java Multiple Choice Questions 25) The correct order of the declarations in a Java program is,

(a) Package declaration, import statement, class declaration
(b) Import statement, package declaration, class declaration
(c) Import statement, class declaration, package declaration
(d) Class declaration, import statement, package declaration
(e) Class declaration, package declaration, import statement.

A) a

Java Multiple Choice Questions 26) An overloaded method consists of,

(a) The same method name with different types of parameters
(b) The same method name with different number of parameters
(c) The same method name and same number and type of parameters with different return type
(d) Both (a) and (b) above
(e) (a), (b) and (c) above.

A) d

Java Multiple Choice Questions 27) A protected member can be accessed in,

(a) a subclass of the same package (b) a non-subclass of the same package
(c) a non-subclass of different package (d) a subclass of different package
(e) the same class.

Which is the false option?

A) c

Java Multiple Choice Questions 28) What is the output of the following code:

class eq
{
public static void main(String args[])
{
String s1 = “Hello”;
String s2 = new String(s1);
System.out.println(s1==s2);
}
}

(a) true (b) false (c) 0 (d) 1 (e) Hello.

A) b

Java Multiple Choice Questions 29) All exception types are subclasses of the built-in class

(a) Exception (b) RuntimeException (c) Error
(d) Throwable (e) None of the above.

A) d

Java Multiple Choice Questions 30) When an overridden method is called from within a subclass, it will always refer to the version of that method defined by the

(a) Super class
(b) Subclass
(c) Compiler will choose randomly
(d) Interpreter will choose randomly
(e) None of the abvove.

A) b

Java Multiple Choice Questions With Answers

Java Multiple Choice Questions 31) Mark the incorrect statement from the following:

(a) Java is a fully object oriented language with strong support for proper software engineering techniques
(b) In java it is not easy to write C-like so called procedural programs
(c) In java language objects have to be manipulated
(d) In java language error processing is built into the language
(e) Java is not a language for internet programming.

A) d

Java Multiple Choice Questions 32) In java, objects are passed as

(a) Copy of that object (b) Method called call by value
(c) Memory address (d) Constructor
(e) Default constructor.

A) c

Java Multiple Choice Questions 33) Which of the following is not a component of Java Integrated Development Environment (IDE)?

(a) Net Beans (b) Borland’s Jbuilder
(c) Symantec’s Visual Café (d) Microsoft Visual Fox Pro
(e) Microsoft Visual J++.

A) c

Java Multiple Choice Questions 34) Identify, from among the following, the incorrect variable name(s).

(a) _theButton (b) $reallyBigNumber
(c) 2ndName (d) CurrentWeatherStateofplanet
(e) my2ndFont.

A) c

Java Multiple Choice Questions 35) Use the following declaration and initialization to evaluate the Java expressions

int a = 2, b = 3, c = 4, d = 5;
float k = 4.3f;

System.out.println( – -b * a + c *d – -);

(a) 21 (b) 24 (c) 28 (d) 26 (e) 22.

A) b

Java Multiple Choice Questions 36) Use the following declaration and initialization to evaluate the Java expressions

int a = 2, b = 3, c = 4, d = 5;
float k = 4.3f;

System.out.println(a++);

(a) 3 (b) 2 (c) 4 (d) 10 (e) Synatax error.

A) b

Java Multiple Choice Questions 37) Use the following declaration and initialization to evaluate the Java expressions

int a = 2, b = 3, c = 4, d = 5;
float k = 4.3f;

System.out.println (-2U * ( g – k ) +c);

(a) 6 (b) 3 (c) 2 (d) 1 (e) Syntax error.

A) e

Java Multiple Choice Questions 38) Use the following declaration and initialization to evaluate the Java expressions

int a = 2, b = 3, c = 4, d = 5;
float k = 4.3f;

System.out.println (c=c++);

(a) 2 (b) 4 (c) 5 (d) 8 (e) Syntax error.

A) b

Java Multiple Choice Questions 39) Consider the following Java program :

class IfStatement{
public static void main(String args[])
{
int a=2, b=3;
if (a==3)
if (b==3)
System.out.println(“===============”);
else
System.out.println(“#################”);
System.out.println(“&&&&&&&&&&&”);
}
}

Which of the following will the output be?

(a) ===============
(b) #################
&&&&&&&&&
(c) &&&&&&&&&&&
(d) ===============
#################
&&&&&&&&&&
(e) ################.

A) c

Java Multiple Choice Questions 40) An applet cannot be viewed using

(a) Netscape navigator
(b) Microsoft Internet Explorer
(c) Sun’ Hot Java Browser
(d) Applet viewer tool which comes, with the Java Development Kit.
(e) Jbuilder.

A) d

Use the following Java program for answering question 11 and 12
class test{
void meth(int i, int j)
{
i *= 2;
i /= 2;
}
}

class argumentPassing
{
public static void main(String args[])
{
test ob = new test();
int a = 15, b = 20;

System.out.println(“a and b before call :”+ a +” ” + b);
ob.meth(a,b);
System.out.println(“a and b after call : “+ a + ” ” +b);
}

Core Java Multiple Choice Questions With Answers

41) What would the output be of the above Program – III before and after it is called?

(a) and b before call : 15 20 a and b after call : 30 10
(b) a and b before call : 5 2 a and b after call : 15 20
(c) a and b before call : 15 20 a and b after call : 15 20
(d) a and b before call : 30 10 a and b after call : 15 20
(e) a and b before call : 15 20 a and b after call :

A) c

42) What would the argument passing method be which is used by the above Program – III?

(a) Call by value (b) Call by reference
(c) Call by java.lang class (d) Call by byte code
(e) Call by compiler.

A) a

43) Consider the following program:

class prob1{
int puzzel(int n){

int result;

if (n==1)
return 1;
result = puzzel(n-1) * n;
return result;
}
}

class prob2{

public static void main(String args[])

{

prob1 f = new prob1();

System.out.println(” puzzel of 6 is = ” + f.puzzel(6));

}
}

Which of the following will be the output of the above program?

(a) 6 (b) 120 (c) 30 (d) 720 (e) 12.

A) d

44) The blank space in the following sentence has to be correctly filled :

Members of a class specified as ……………….. are accessible only to methods of that class.

(a) Protected (b) Final (c) Public (d) Private (e) Static.

A) d

45) Java compiler javac translates Java source code into ………………………

(a) Assembler language (b) Byte code
(c) Bit code (d) Machine code
(e) Platform dependent code.

A) b

46) ……………….. are used to document a program and improve its readability.

(a) System cells (b) Keywords (c) Comments (d) Control structures (e) Blocks.

A) c

47) In Java, a character constant’s value is its integer value in the ………………………character set.

(a) EBCDIC (b) Unicode (c) ASCII (d) Binary (e) BCD.

A) b

48) In Java, a try block should immediately be followed by one or more ……………….. blocks.

(a) Throw (b) Run (c) Exit (d) Catch (e) Error.

A) d

49) An abstract data type typically comprises a …………… and a set of ……………… respectively.

(a) Data representation, classes (b) Database, operations
(c) Data representation, objects (d) Control structure, operations
(e) Data representation, operations.

A) e

50) In object-oriented programming, the process by which one object acquires the properties of another object is called

(a) Encapsulation (b) Polymorphism (c) Overloading
(d) Inheritance (e) Overriding.

A) d

Advanced Java Multiple Choice Questions Ans Answers

51) Re-implementing an inherited method in a sub class to perform a different task from the parent class is called

(a) Binding (b) Transferring (c) Hiding (d) Coupling (e) extending.

A) e

52) In a class definition, the special method provided to be called to create an instance of that class is known as a/an

(a) Interpreter (b) Destructor (c) Constructor (d) Object (e) Compiler.

A) c

53) Consider the following statements about Java packages:

I. Packages don’t provide a mechanism to partition all class names into more manageable chunks.
II. Packages provide a visibility control mechanism.
III. One of the important properties of a package is that all classes defined inside a package is accessible by code outside that package.
IV. The .class files for classes declared to be part of a package can be stored in multiple directories.

Which of them is correct?
(a) Only (I) above (b) Only (II) above
(c) Only (III) above (d) Only (IV) above
(e) All (I), (II), (III) and (IV) above are wrong.

A) b

54) Consider the following statements:

I. A class can be declared as both abstract and final.
II. A class declared as final can be extended by defining a sub-class.
III. Resolving calls to methods dynamically at run-time is called late binding.
IV. The class Object defined by Java need not be a super class of all other classes.

Identify the correct statement from the following:

(a) Both (I) and (II) above (b) Both (III) and (IV) above
(c) Both (I) and (III) above (d) Both (II) and (IV) above
(e) Only (III) above.

A) e

55) Identify, from among the following, the incorrect descriptions related to Java :

(a) Java Virtual Machine translates byte code into its own system’s machine language and runs the resulting machine code
(b) The arithmetic operations *, /, %, + and – have the same level of precedence
(c) Comments do not cause any action to be performed during the program execution
(d) All variables must be given a type when they are declared
(e) Java variable names are case-sensitive.

A) b

56) Consider the following statement(s) about Java:

I. All white-space characters (blanks) are ignored by the compiler.
II. Java keywords can be used as variable names.
III. An identifier does not begin with a digit and does not contain any spaces.
IV. The execution of Java applications begins at method main.

Which of them is correct?

(a) Both (I) and (III) above (b) Both (II) and (IV) above
(c) Both (I) and (II) above (d) (III) and (IV) above
(e) All (I), (II), (III) and (IV) above.

A) d

57) Consider the following data types in Java :

I. Int II. Boolean III. Double IV. String V. Array.

Which of them are simple data types?

(a) Both (I) and (II) above (b) (I), (II), (III) and (IV) above
(c) (I), (II) and (III) above (d) (II) and (III) above
(e) All (I), (II), (III), (IV) and (V) above.

A) c

58) For what values respectively of the variables gender and age would the Java expression gender == 1 && age >= 65 become true?

(a) gender = 1, age = 60 (b) gender = 1, age = 50
(c) gender = 1, age = 65 (d) gender = 0, age = 70
(e) gender = 0, age = 55.

A) c

59) Consider the following Java program :

public class Compute {

public static void main (string args [ ])
{
int result, x ;
x = 1 ;
result = 0;
while (x < = 10) {
if (x%2 == 0) result + = x ;
+ + x ;
}
System.out.println(result) ;
}
}

Which of the following will be the output of the above program?

(a) 55 (b) 30 (c) 25 (d) 35 (e) 45.

A) b

60) Which of the following statements about Java Threads is correct?

(a) Java threads don’t allow parts of a program to be executed in parallel
(b) Java is a single-threaded language
(c) Java’s garbage collector runs as a high priority thread
(d) Ready, running and sleeping are three states that a thread can be in during its life cycle
(e) Every java application is not multithreaded.

A) d

Related Java Interview Questions

  1. Aricent Java Interview Questions
  2. Accenture Java Interview Questions
  3. Advanced Java Interview Questions For 5 8 10 Years Experienced
  4. Core Java Interview Questions For Experienced

OTHER INTERVIEW QUESTIONS

  1. Tableau Multiple Choice Questions
  2. Python Coding Interview Questions
  3. CSS3 Interview Questions
  4. Linux Administrator Interview Questions
  5. SQL Interview Questions
  6. Hibernate Interview Questions
  7. Kubernetes Interview Questions
  8. Kibana Interview Questions
  9. Nagios Interview Questions
  10. Jenkins Interview Questions
  11. Chef Interview Questions
  12. Puppet Interview Questions
  13. RPA Interview Questions And Answers
  14. Android Interview Questions
  15. Mulesoft Interview Questions
  16. JSON Interview Questions
  17. PeopleSoft HRMS Interview Questions
  18. PeopleSoft Functional Interview Questions
  19. PeopleTools Interview Questions
  20. Peoplesoft Technical Interview Questions
  21. 199 Peoplesoft Interview Questions
  22. 200 Blue Prism Interview Questions
  23. Visualforce Interview Questions
  24. Salesforce Interview Questions
  25. 300 SSIS Interview Questions
  26. PHP Interview Questions And Answers
  27. Alteryx Interview Questions
  28. AWS Cloud Support Interview Questions
  29. Google Kubernetes Engine Interview Questions
  30. AWS Devops Interview Questions

Tableau Multiple Choice Questions And Answers

Tableau Multiple Choice Questions And Answers For Experienced 2018. Here Coding compiler sharing a list of 34 Tableau MCQ Certification Questions that asked in Tableau certification exam. These questions also help you to crack your next Tableau job interview. All the best for your future and happy Tableau learning.

Tableau Multiple Choice Questions And Answers

1. A Reference Band cannot be based on two fixed points.
a) False
b) True

Answer Explanation: a

2. A Reference Distribution plot cannot be along a continuous axis.
a) True
b) False

Answer Explanation: b
A Reference Distribution plot can be along a continuous axis.

3. Which of the following is not a Trend Line model
a) Linear Trend Line
b) Exponential Trend Line
c) Binomial Trend Line
d) Logarithmic Trend Line

Answer Explanation: c
Binomial Trend Line is not a Trend Line model.

4. The image below uses which map visualization?
a) Filled maps
b) Layered maps
c) WMS server maps
d) Symbol maps

Answer Explanation: c

5. Is it possible to deploy a URL action on a dashboard object to open a Web Page within a dashboard rather than opening the system’s web browser?
a) True, with the use of Tableau Server
b) True, with the use of a Web Page object
c) False, not possible
d) True, requires a plug-in

Answer Explanation: b
True, with the use of a Web Page object it is possible to deploy a URL action on a dashboard object to open a web page within a dashboard rather than opening the system’s web browser.

6. The Highlighting action can be disabled for the entire workbook.
a) True
b) False

Answer Explanation: a
From the toolbar the Highlighting action can be disabled for the entire workbook.

7. A sheet cannot be used within a story directly. Either sheets should be used within a dashboard, or a dashboard should be used within a story.
a) True
b) False

Answer Explanation: b
A sheet can be used within a story directly.

8. How do you identify a continuous field in Tableau?
a) It is identified by a blue pill in the visualization.
b) It is identified by a green pill in a visualization.
c) It is preceded by a # symbol in the data window.
d) When added to the visualization, it produces distinct values.

Answer Explanation: b
It is identified by a green pill in a visualization

9. Is it possible to use measures in the same view multiple times (e.g. SUM of the measure and AVG of the measure)?
a) No
b) Yes

Answer Explanation: b
Yes, measures can be used multiple times in the same view.

10. Sets can be created on Measures.
a) False
b) True

Answer Explanation: a
Sets can be created on dimensions.

Tableau Multiple Choice Interview Questions And Answer

11. For creating variable size bins we use _____________.
a) Sets
b) Groups
c) Calculated fields
d) Table Calculations

Answer Explanation: c
For creating variable size bins we use Calculated Fields.

12. A good reason to use a bullet graph.
a) Analyzing the trend for a time period
b) Comparing the actual against the target sales
c) Adding data to bins and calculating count measure
d) Displaying the sales growth for a particular year

Answer Explanation: b

13. The line shown in the image below is a Reference Line. True or False?
a) true
b) false

Answer Explanation: b
The line shown in the image is a Trend Line.

14. Disaggregation returns all records in the underlying data source.
a) True
b) False

Answer Explanation: a
Disaggregation returns all records in the underlying data sources.

15. By definition, Tableau displays measures over time as a ____________.
a) Bar
b) Line
c) Histogram
d) Scatter Plots

Answer Explanation: b
By definition, Tableau displays measures over time as a Lines.

16. The icon associated with the field that has been grouped is a ______________.
a) Paper Clip
b) Set
c) Hash
d) Equal To

Answer Explanation: a
The icon associated with the field that has been grouped is a paper clip.

17. In the West region, which state’s sales fall within the Reference Band starting from average sales of that region till median of sales? (Perform the below questions in Tableau 9.0 and connect to the Saved Sample – Superstore dataset)
a) California
b) Colorado
c) Montana
d) New Mexico

Answer Explanation: b

18. Create a simple bar chart with Region and Total Expenses from the Sample- Superstore dataset and Sample -Coffee Chain dataset, respectively. (Establish the link on State). Identify the budgeted profit for the region having the 2nd highest total expenditure. (Connect to the Sample- Coffee Chain access file using the CoffeeChain Query table)
a) 84850
b) 87680
c) 80231
d) 84823

Answer Explanation: b

19. In 2012, what is the percent contribution of sales for Decaf in the East market? (Perform all the questions in Tableau 9.0 and connect to the Saved Sample-Superstore dataset)
a) 48.942%
b) 54.765%
c) 51.231%
d) 55.875%

Answer Explanation: a
48.942% is the percent contribution of sales of Decaf in 2012 in the East market.

20. In 2013, what is the percentage of total profit for Caffe Mocha falling under Major Market (Market Size)?(Perform all the questions in Tableau 9.0 and connect to the Saved Sample-Superstore dataset)
a) 60%
b) 45%
c) 58%
d) 55%

Answer Explanation: d
In 2013, the percentage of total profit for Caffe Mocha falling under Major Market is 55%.

Tableau Certification Questions And Answers

21. Create a heat map for Product Type, State, and Profit. Which state in the East market has the lowest profit for Espresso?(Use the Sample- Coffee Chain dataset for the following questions)
a) Florida
b) Connecticut
c) New York
d) New Hampshire

Answer Explanation: d
New Hampshire has the lowest profit for Espresso, in the East market.

22. In 2012, what is the difference in budget profit, in Q3 from the previous quarter for major market (Market Size)? (Use the Sample- Coffee Chain dataset for the following questions)
a) 630
b) -287
c) 667
d) 654

Answer Explanation: a

23. In which month did the running sales cross $30,000 for Decaf in Colorado and Florida? (Use the Sample- Coffee Chain dataset for the following questions)
a) November 2013
b) September 2013
c) May 2013
d) December 2013

Answer Explanation: c

24. Create a bar chart with Product Type, Product, and Profit. Identify which of the following products fall below the overall 99.9% Confidence Interval Distribution (Table across)? (Use the Sample- Coffee Chain dataset for the following questions)
a) Decaf Espresso
b) Green Tea
c) Caffe Latte
d) Regular Espresso

Answer Explanation: b

25. Using quartiles, identify which of the following Espresso product has the highest distribution of sales? (Use the Sample- Coffee Chain dataset for the following questions)
a) Decaf Espresso
b) Caffe Mocha
c) Caffe Latte
d) Regular Espresso

Answer Explanation: d
Regular Espresso has the highest distribution of sales in Espresso product.

26. In 2013, identify the state with the highest profit in the West market? (Use the Sample- Coffee Chain dataset for the following questions)
a) Utah
b) Nevada
c) California
d) Washington

Answer Explanation: c

27. Create a scatter plot with State, Sales, and Profit. Identify the Trend Line with ‘R-Squared’ value between 0.7 to 0.8? (Use the Sample- Coffee Chain dataset for the following questions)
a) Linear Trend Line
b) Logarithmic Trend Line
c) Exponential Trend Line
d) Polynomial Trend Line with Degree 2

Answer Explanation: d
The Trend Line with ‘R-Squared’ value between 0.7 to 0.8 is a Polynomial Trend Line with Degree 2.

28. Identify the total expenses to sales ratio of the state with the lowest profit. (Use the Sample- Coffee Chain dataset for the following questions)
a) 47.31%
b) 45.58%
c) 41.98%
d) 40.78%

Answer Explanation: b

29. Create a Combined Field with Product and State. Identify the highest selling product and its state. (Use the Sample- Coffee Chain dataset for the following questions)
a) Colombian, California
b) Colombian, Texa
c) Lemon, Neva
d) Darjeeling, Iowa

Answer Explanation: a

30. What is the contribution of tea to the overall Profit in 2012? (Use the Sample- Coffee Chain dataset for the following questions)
a) 24.323%
b) 22.664%
c) 20.416%
d) 21.765%

Answer Explanation: c

Tableau Multiple Choice Questions For Experienced

31. What is the average profit ratio for all the products starting with C? (Use the Sample- Coffee Chain dataset for the following questions)
a) 30%
b) 25%
c) 33%
d) 20%

Answer Explanation: c

32. What is the distinct count of area codes for the state with the lowest budget margin in small markets? (Use the Sample- Coffee Chain dataset for the following questions)
a) 3
b) 1
c) 2
d) 6

Answer Explanation: b

33. Which product type does not have any of its product within the Top 5 Products by sales? (Use the Sample- Coffee Chain dataset for the following questions)
a) Tea
b) Espresso
c) Coffee
d) Herbal Tea

Answer Explanation: a

34. In the Central region, the Top 5 Products by sales contributed _____ % of the total expenditure. (Use the Sample- Coffee Chain dataset for the following questions)
a) 48.54%
b) 51.66%
c) 69.21%
d) 54.02%

Answer Explanation: d
In the Central region, the Top 5 Products by sales contributed 54.02 % of the total expenditure.

OTHER INTERVIEW QUESTIONS

  1. Python Coding Interview Questions
  2. CSS3 Interview Questions
  3. Linux Administrator Interview Questions
  4. SQL Interview Questions
  5. Hibernate Interview Questions
  6. Kubernetes Interview Questions
  7. Kibana Interview Questions
  8. Nagios Interview Questions
  9. Jenkins Interview Questions
  10. Chef Interview Questions
  11. Puppet Interview Questions
  12. RPA Interview Questions And Answers
  13. Android Interview Questions
  14. Mulesoft Interview Questions
  15. JSON Interview Questions
  16. PeopleSoft HRMS Interview Questions
  17. PeopleSoft Functional Interview Questions
  18. PeopleTools Interview Questions
  19. Peoplesoft Technical Interview Questions
  20. 199 Peoplesoft Interview Questions
  21. 200 Blue Prism Interview Questions
  22. Visualforce Interview Questions
  23. Salesforce Interview Questions
  24. 300 SSIS Interview Questions
  25. PHP Interview Questions And Answers
  26. Alteryx Interview Questions
  27. AWS Cloud Support Interview Questions
  28. Google Kubernetes Engine Interview Questions
  29. AWS Devops Interview Questions
  30. Apigee Interview Questions

Python Coding Interview Questions And Answers

Python Coding Interview Questions And Answers 2018. Here Coding compiler sharing a list of 35 Python interview questions for experienced. These Python questions are prepared by the expert Python developers. This list of interview questions on Python will help you to crack your next Python job interview. All the best for your future and happy python learning.

Python Coding Interview Questions

  1. How do you debug a Python program?
  2. What is <Yield> Keyword in Python?
  3. How to convert a list into a string?
  4. How to convert a list into a tuple?
  5. How to convert a list into a set?
  6. How to count the occurrences of a particular element in the list?
  7. What is NumPy array?
  8. How can you create Empty NumPy Array In Python?
  9. What is a negative index in Python?
  10. How do you Concatenate Strings in Python?

Python Coding Interview Questions And Answers

Python Interview Questions # 1) How do you debug a Python program?

Answer) By using this command we can debug a python program

$ python -m pdb python-script.py

Python Interview Questions # 2) What is <Yield> Keyword in Python?

A) The <yield> keyword in Python can turn any function into a generator. Yields work like a standard return keyword.
But it’ll always return a generator object. Also, a function can have multiple calls to the <yield> keyword.

Example:

def testgen(index):
weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’]
yield weekdays[index]
yield weekdays[index+1]

day = testgen(0)
print next(day), next(day)

Output: sun mon

Python Interview Questions # 3) How to convert a list into a string?

A) When we want to convert a list into a string, we can use the <”.join()> method which joins all the elements into one and returns as a string.

Example:

weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’]
listAsString = ‘ ‘.join(weekdays)
print(listAsString)

Python Interview Questions # 4) How to convert a list into a tuple?

A) By using Python <tuple()> function we can convert a list into a tuple. But we can’t change the list after turning it into tuple, because it becomers immutable.

Example:

weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’]
listAsTuple = tuple(weekdays)
print(listAsTuple)

output: (‘sun’, ‘mon’, ‘tue’, ‘wed’, ‘thu’, ‘fri’, ‘sat’)

Python Interview Questions # 5) How to convert a list into a set?

A) User can convert list into set by using <set()> function.

Example:

weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sat’,’sun’,’tue’]
listAsSet = set(weekdays)
print(listAsSet)

output: set([‘wed’, ‘sun’, ‘thu’, ‘tue’, ‘mon’, ‘fri’, ‘sat’])

Python Interview Questions # 6) How to count the occurrences of a perticular element in the list?

A) In Python list, we can count the occurences of a individual element by using a <count()> function.

Example # 1:

weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sun’,’mon’,’mon’]
print(weekdays.count(‘mon’))

Output: 3

Example # 2:

weekdays = [‘sun’,’mon’,’tue’,’wed’,’thu’,’fri’,’sun’,’mon’,’mon’]
print([[x,weekdays.count(x)] for x in set(weekdays)])

output: [[‘wed’, 1], [‘sun’, 2], [‘thu’, 1], [‘tue’, 1], [‘mon’, 3], [‘fri’, 1]]

Python Interview Questions # 7) What is NumPy array?

A) NumPy arrays are more flexible then lists in Python. By using NumPy arrays reading and writing items is faster and more efficient.

Python Interview Questions # 8) How can you create Empty NumPy Array In Python?

A) We can create Empty NumPy Array in two ways in Python,

1) import numpy
numpy.array([])

2) numpy.empty(shape=(0,0))

Python Interview Questions # 9) What is a negative index in Python?

A) Python has a special feature like a negative index in Arrays and Lists. Positive index reads the elements from the starting of an array or list but in the negative index, Python reads elements from the end of an array or list.

Python Interview Questions # 10) What is the output of the below code?

>> import array
>>> a = [1, 2, 3]
>>> print a[-3]
>>> print a[-2]
>>> print a[-1]

A) The output is: 3, 2, 1

Advanced Python Coding Interview Questions

Python Coding Interview Questions # 11) What is the output of the below program?

>>>names = [‘Chris’, ‘Jack’, ‘John’, ‘Daman’]
>>>print(names[-1][-1])

A) The output is: n

Python Coding Interview Questions # 12) What is Enumerate() Function in Python?

A) The Python enumerate() function adds a counter to an iterable object. enumerate() function can accept sequential indexes starting from zero.

Python Enumerate Example:

subjects = (‘Python’, ‘Interview’, ‘Questions’)

for i, subject in enumerate(subjects):
print(i, subject)

Output:

0 Python
1 Interview
2 Questions

Python Coding Interview Questions # 13) What is data type SET in Python and how to work with it?

A) The Python data type “set” is a kind of collection. It has been part of Python since version 2.4. A set contains an unordered collection of unique and immutable objects.

# *** Create a set with strings and perform search in set

objects = {“python”, “coding”, “tips”, “for”, “beginners”}

# Print set.
print(objects)
print(len(objects))

# Use of “in” keyword.
if “tips” in objects:
print(“These are the best Python coding tips.”)

# Use of “not in” keyword.
if “Java tips” not in objects:
print(“These are the best Python coding tips not Java tips.”)

# ** Output

{‘python’, ‘coding’, ‘tips’, ‘for’, ‘beginners’}
5
These are the best Python coding tips.
These are the best Python coding tips not Java tips.

# *** Lets initialize an empty set
items = set()

# Add three strings.
items.add(“Python”)
items.add(“coding”)
items.add(“tips”)

print(items)

# ** Output

{‘Python’, ‘coding’, ‘tips’}

Python Coding Interview Questions # 14) How do you Concatenate Strings in Python?

A) We can use ‘+’ to concatenate strings.

Python Concatenating Example:

# See how to use ‘+’ to concatenate strings.

>>> print(‘Python’ + ‘ Interview’ + ‘ Questions’)

# Output:

Python Interview Questions

Python Coding Interview Questions # 15) How to generate random numbers in Python?

A) We can generate random numbers using different functions in Python. They are:

#1. random() – This command returns a floating point number, between 0 and 1.

#2. uniform(X, Y) – It returns a floating point number between the values given as X and Y.

#3. randint(X, Y) – This command returns a random integer between the values given as X and Y.

Python Coding Interview Questions # 16) How to print sum of the numbers starting from 1 to 100?

A) We can print sum of the numbers starting from 1 to 100 using this code:

print sum(range(1,101))

# In Python the range function does not include the end given. Here it will exclude 101.
# Sum funtion print sum of the elements of range funtion, i.e 1 to 100.

Python Coding Interview Questions # 17) How do you set a global variable inside a function?

A) Yes, we can use a global variable in other functions by declaring it as global in each function that assigns to it:

globvar = 0
def set_globvar_to_one():
global globvar # Needed to modify global copy of globvar
globvar = 1
def print_globvar():
print globvar # No need for global declaration to read value of globvar
set_globvar_to_one()
print_globvar() # Prints 1

Python Coding Interview Questions # 18) What is the output of the program?

names1 = [‘Amir’, ‘Bear’, ‘Charlton’, ‘Daman’]
names2 = names1
names3 = names1[:]

names2[0] = ‘Alice’
names3[1] = ‘Bob’

sum = 0
for ls in (names1, names2, names3):
if ls[0] == ‘Alice’:
sum += 1
if ls[1] == ‘Bob’:
sum += 10

print sum

A) 12

Python Coding Interview Questions # 19) What is the output, Suppose list1 is [1, 3, 2], What is list1 * 2 ?

A) [1, 3, 2, 1, 3, 2]

Python Coding Interview Questions # 20) What is the output when we execute list(“hello”)?

A) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]

Python Coding Interview Questions And Answers For Experienced

21) Can you write a program to find the average of numbers in a list in Python?

A) Python Program to Calculate Average of Numbers:

n=int(input(“Enter the number of elements to be inserted: “))
a=[]
for i in range(0,n):
elem=int(input(“Enter element: “))
a.append(elem)
avg=sum(a)/n
print(“Average of elements in the list”,round(avg,2))

Output:

Enter the number of elements to be inserted: 3
Enter element: 23
Enter element: 45
Enter element: 56
Average of elements in the list 41.33

22) Write a program to reverse a number in Python?

A) Python Program to Reverse a Number:

n=int(input(“Enter number: “))
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
print(“Reverse of the number:”,rev)

Output:

Enter number: 143
Reverse of the number: 341

23) Write a program to find sum of the digits of a number in Python?

A) Python Program to Find Sum of the Digits of a Number

n=int(input(“Enter a number:”))
tot=0
while(n>0):
dig=n%10
tot=tot+dig
n=n//10
print(“The total sum of digits is:”,tot)

Output:

Enter a number:1928
The total sum of digits is: 20

24) Write a Python Program to Check if a Number is a Palindrome or not?

A) Python Program to Check if a Number is a Palindrome or Not:

n=int(input(“Enter number:”))
temp=n
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
if(temp==rev):
print(“The number is a palindrome!”)
else:
print(“The number isn’t a palindrome!”)

Output:

Enter number:151
The number is a palindrome!

25) Write a Python Program to Count the Number of Digits in a Number?

A) Python Program to Count the Number of Digits in a Number:

n=int(input(“Enter number:”))
count=0
while(n>0):
count=count+1
n=n//10
print(“The number of digits in the number are:”,count)

Output:

Enter number:14325
The number of digits in the number are: 5

26) Write a Python Program to Print Table of a Given Number?

A) Python Program to Print Table of a Given Number:

n=int(input(“Enter the number to print the tables for:”))
for i in range(1,11):
print(n,”x”,i,”=”,n*i)

Output:

Enter the number to print the tables for:7
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70

27) Write a Python Program to Check if a Number is a Prime Number?

A) Python Program to Check if a Number is a Prime Number:

a=int(input(“Enter number: “))
k=0
for i in range(2,a//2+1):
if(a%i==0):
k=k+1
if(k<=0):
print(“Number is prime”)
else:
print(“Number isn’t prime”)

Output:

Enter number: 7
Number is prime

28) Write a Python Program to Check if a Number is an Armstrong Number?

A) Python Program to Check if a Number is an Armstrong Number:

n=int(input(“Enter any number: “))
a=list(map(int,str(n)))
b=list(map(lambda x:x**3,a))
if(sum(b)==n):
print(“The number is an armstrong number. “)
else:
print(“The number isn’t an arsmtrong number. “)

Output:

Enter any number: 371
The number is an armstrong number.

29) Write a Python Program to Check if a Number is a Perfect Number?

A) Python Program to Check if a Number is a Perfect Number:

n = int(input(“Enter any number: “))
sum1 = 0
for i in range(1, n):
if(n % i == 0):
sum1 = sum1 + i
if (sum1 == n):
print(“The number is a Perfect number!”)
else:
print(“The number is not a Perfect number!”)

Output:

Enter any number: 6
The number is a Perfect number!

Python Developer Interview Questions And Answers

30) Write a Python Program to Check if a Number is a Strong Number?

A) Python Program to Check if a Number is a Strong Number:

sum1=0
num=int(input(“Enter a number:”))
temp=num
while(num):
i=1
f=1
r=num%10
while(i<=r):
f=f*i
i=i+1
sum1=sum1+f
num=num//10
if(sum1==temp):
print(“The number is a strong number”)
else:
print(“The number is not a strong number”)

Output:

Enter a number:145
The number is a strong number.

31) Write a Python Program to Find the Second Largest Number in a List?

A) Python Program to Find the Second Largest Number in a List:

a=[]
n=int(input(“Enter number of elements:”))
for i in range(1,n+1):
b=int(input(“Enter element:”))
a.append(b)
a.sort()
print(“Second largest element is:”,a[n-2])

Output:

Enter number of elements:4
Enter element:23
Enter element:56
Enter element:39
Enter element:11
Second largest element is: 39

32) Write a Python Program to Swap the First and Last Value of a List?

A) Python Program to Swap the First and Last Value of a List:

a=[]
n= int(input(“Enter the number of elements in list:”))
for x in range(0,n):
element=int(input(“Enter element” + str(x+1) + “:”))
a.append(element)
temp=a[0]
a[0]=a[n-1]
a[n-1]=temp
print(“New list is:”)
print(a)

Output:

Enter the number of elements in list:4
Enter element1:23
Enter element2:45
Enter element3:67
Enter element4:89
New list is:
[89, 45, 67, 23]

33) Write a Python Program to Check if a String is a Palindrome or Not?

A) Python Program to Check if a String is a Palindrome or Not:

string=raw_input(“Enter string:”)
if(string==string[::-1]):
print(“The string is a palindrome”)
else:
print(“The string isn’t a palindrome”)

Output:

Enter string:malayalam
The string is a palindrome

34) Write a Python Program to Count the Number of Vowels in a String?

A) Python Program to Count the Number of Vowels in a String:

string=raw_input(“Enter string:”)
vowels=0
for i in string:
if(i==’a’ or i==’e’ or i==’i’ or i==’o’ or i==’u’ or i==’A’ or i==’E’ or i==’I’ or i==’O’ or i==’U’):
vowels=vowels+1
print(“Number of vowels are:”)
print(vowels)

Output:

Enter string:Hello world
Number of vowels are:
3

35) Write a Python Program to Check Common Letters in Two Input Strings?

A) Python Program to Check Common Letters in Two Input Strings:

s1=raw_input(“Enter first string:”)
s2=raw_input(“Enter second string:”)
a=list(set(s1)&set(s2))
print(“The common letters are:”)
for i in a:
print(i)

Output:

Enter first string:Hello
Enter second string:How are you
The common letters are:
H
e
o

Related Python Tutorials

Other Interview quesTIONS

  1. CSS3 Interview Questions
  2. Linux Administrator Interview Questions
  3. SQL Interview Questions
  4. Hibernate Interview Questions
  5. Kubernetes Interview Questions
  6. Kibana Interview Questions
  7. Nagios Interview Questions
  8. Jenkins Interview Questions
  9. Chef Interview Questions
  10. Puppet Interview Questions
  11. RPA Interview Questions And Answers
  12. Android Interview Questions
  13. Mulesoft Interview Questions
  14. JSON Interview Questions
  15. PeopleSoft HRMS Interview Questions
  16. PeopleSoft Functional Interview Questions
  17. PeopleTools Interview Questions
  18. Peoplesoft Technical Interview Questions
  19. 199 Peoplesoft Interview Questions
  20. 200 Blue Prism Interview Questions
  21. Visualforce Interview Questions
  22. Salesforce Interview Questions
  23. 300 SSIS Interview Questions
  24. PHP Interview Questions And Answers
  25. Alteryx Interview Questions
  26. AWS Cloud Support Interview Questions
  27. Google Kubernetes Engine Interview Questions
  28. AWS Devops Interview Questions
  29. Apigee Interview Questions
  30. Actimize Interview Questions

CSS3 Interview Questions And Answers For Experienced

CSS3 Interview Questions And Answers For Experienced. Here Coding compiler sharing a very good list of 75 CSS3 interview questions asked in various UI development interviews by MNC companies. We are sure that these CSS interview questions will help you to crack your next CSS job interview. All the best for your future and happy CSS learning.

CSS3 Interview Questions

  1. What is the difference between CSS2 and CSS3?
  2. What are the new features of CSS3?
  3. What are the CSS3 modules?
  4. What are CSS3 media queries?
  5. What are CSS3 media types?
  6. What are CSS3 Selectors?
  7. How can you create Rounded corners in CSS3?
  8. What are the associated border-radius properties?
  9. How can you create a CSS3 property for each corner?
  10. Is it possible to create border as an Image in CSS3?

CSS3 Interview Questions And Answers

Let’s start learning about various CSS3 interview questions and answers for experienced.

Difference Between CSS2 and CSS3

  •  Modules
  •  Media Queries
  •  Namespaces
  •  Selectors
  •  Color

1) CSS3 Modules

1) The main difference between CSS2 and CSS3 is that CSS3 divided into two different sections Called Modules.
2) In CSS2 everything is submitted as a single document with all the Cascading Style Sheets information within it.
3) These Modules are much easier for different browsers to accept various aspects of CSS3 and implement.
4) There is a wider range of browser support for CSS3 Modules over CSS and CSS2.

CSS3 Modules List

  • Selectors
  • Box Model
  • Backgrounds
  • Image Values and Replaced Content
  • Text Effects
  • 2D Transformations
  • 3D Transformations
  • Animations
  • Multiple Column Layout
  • User Interface

2) CSS3 Media Queries

1) In CSS2, we have Media Types, users can define different style rules for different media types like computer screens, printers, and handled devices.

2) But in CSS3, instead of using Media Types, extended the CSS2 Media Types idea with Media Queries.

3) Unlike looking for a type of device in CSS2 media type, CSS3 Media Queries look at the capability of the device.

4) CSS3 media queries look for width and height of the viewport, width, and height of the device, orientation, and resolution of the screen.

CSS3 Media Types

all – Used for all media type devices
print – Used for printers
screen – Used for computer screens, tablets, smart-phones etc.
speech – Used for screenreaders that “reads” the page out loud

CSS3 Media Query Example

If the viewport is minimum 480 pixels or widee then the body backgroud color will be changed to blue.

@media screen and (min-width: 480px) {
body {
background-color: blue;
}
}

3) CSS3 Namespaces

This CSS Namespaces module defines syntax for using namespaces in CSS. It defines the @namespace rule for declaring a default namespace and for binding namespaces to namespace prefixes.

@namespace “http://www.w3.org/1999/xhtml”;
@namespace svg “http://www.w3.org/2000/svg”;

The first rule declares a default namespace http://www.w3.org/1999/xhtml to be applied to names that have no explicit namespace component.

The second rule declares a namespace prefix svg that is used to apply the namespace http://www.w3.org/2000/svg where the svg namespace prefix is used.

4) CSS3 Selectors

In CSS3, there are few new Selectors and pseudo-elements are introduced, let’s discuss them.

1) attribute beginning matches exactly

element[foo^=”bar”]

The element has an attribute called foo that begins with “bar” e.g.

2) attribute ending matches exactly

element[foo$=”bar”]

The element has an attribute called foo that ends with “bar” e.g.

3) attribute contains the match

element[foo*=”bar”]

The element has an attribute called foo that contains the string “bar” e.g.

CSS3 new pseudo-classes:

:root

The root element of the document. In HTML this is always

:nth-child(n)

use this to match exact child elements or use variables to get alternating matches

:nth-last-child(n)

match exact child elements counting up from the last one

:nth-of-type(n)

match sibling elements with the same name before it in the document tree

:nth-last-of-type(n)

match sibling elements with the same name counting up from the bottom

:last-childmatch

the last child element of the parent

:first-of-typematch

the first sibling element of that type

:last-of-typematch

the last sibling element of that type

:only-childmatch

the element that is the only child of its parent

:only-of-typematch

the element that is the only one of its type

:emptymatch

the element that has no children (including text nodes)

:targetmatch

an element that is the target of the referring URI

:enabledmatch

the element when it’s enabled

:disabledmatch

the element when it’s disabled

:checkedmatch

the element when it’s checked (radio button or checkbox)

:not(s)

match when the element does not match the simple selectors

New CSS3 Style Properties

Many graphics related properties are introduced in CSS3.

1) Border-radius or box-shadow, flexbox or even CSS Grid are newer styles introduced in CSS3.

2) In CSS3 the box model not changed but using new style properties users can change background, border and styles of a box.

3) In CSS3 using properties like background-image, background-position, and background-repeat styles users can specify multiple background images to be placed on top of one another.

4) CSS3 background-clip property defines how the background image should be clipped.

5) CSS3 background-origin property determines whether the background should be placed in the padding box, the border box, or the content box.

6) CSS3 background-size property allows you to indicate the size of the background image. This property allows users to stretch smaller images to fit the page.

7) CSS borders can be the styles of solid, double, dashed, and image. In addition to existing boarder properties CSS3 brings in the ability to create rounded corners.

8) There are some new border-radius properties are introduced in CSS3.

9) border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-top-left-radiusThese properties allow you to create rounded corners on your borders.

10) border-image-source – Specifies the image source file to be used instead of border styles already defined.

11) border-image-slice – Represents the inward offsets from the border image edges

12) border-image-width – Defines the value of the width for your border image

13) border-image-outset – Specifies the amount that the border image area extends beyond the border box

14) border-image-stretch – Defines how the sides and middle parts of the border image should be tiled or scaled

15) border-image – The shorthand property for all the border image properties

16) column-width – Defines the width of your columns should be.

17) column-count – Defines the number of columns on the page.

18) columnsShorthand property where you can define either the width or number.

19) column-gap Defines the width of the gaps between the columns.

20) column-rule-color Defines the color of the rule.

21) column-rule-style Defines the style of the rule (solid, dotted, double, etc.)

22) column-rule-width Defines the width of the rule

23) column-rule A shorthand property defining all three column rule properties at once.

24) CSS Template layout module and CSS3 Grid positioning module- creating grids with CSS

25) CSS3 Text module – outline text and even create drop-shadows with CSS

26) CSS3 Color module – with opacity

27) Changes to the box model – including a marquee property that acts like the IE tag

28) CSS3 User Interface module – giving you new cursors, responses to actions, required fields, and even resizing elements

29) CSS3 Ruby module – provides support for languages that use textual ruby to annotate documents

30) CSS3 Paged Media module – for even more support for paged media (paper, transparencies, etc)

31) Generated content – running headers and footers, footnotes, and other content that is generated programmatically, especially for paged media

32) CSS3 Speech module – changes to aural CSS

33) CSS3 supports additional color properties like RGBA colors, HSL colors, HSLA colors, Opacity.

CSS3 Interview Questions And Answers For Experienced

1) How can you create Rounded corners in CSS3?

A) By using CSS3 border-radius property, we can create rounded corners to body or text.

Sample CSS3 Code to create Rounded corners:

Boarder-Radius Syntax:

#roundcorners {
border-radius: 60px/15px;
background: #FF0001;
padding: 10px;
width: 200px;
height: 150px;
}

2) What are the associated border-radius properties?

A) There are four border-radius properties are there, they are:

  • border-radius Use this element for setting four boarder radius property
  • border-top-left-radius Use this element for setting the boarder of top left corner
  • border-top-right-radius Use this element for setting the boarder of top right corner
  • border-bottom-right-radius Use this element for setting the boarder of bottom right corner
  • border-bottom-left-radius Use this element for setting the boarder of bottom left corner

3) How can you create CSS3 property for each corner?

A) We can create property for each corner by defining style for each corner, see below example:

<style>
#roundcorners1 {
border-radius: 15px 50px 30px 5px;
background: #a44170;
padding: 20px;
width: 100px;
height: 100px;
}
#roundcorners2 {
border-radius: 15px 50px 30px;
background: #a44170;
padding: 20px;
width: 100px;
height: 100px;
}
#roundcorners3 {
border-radius: 15px 50px;
background: #a44170;
padding: 20px;
width: 100px;
height: 100px;
}
</style>

4) Is it possible to create border as a Image in CSS3?

A) Yes it is possible, by using CSS3 border image property we can use image as a border.

5) What are the associate boarder image properties in CSS3?

A) There are four major boarder image properties are there, they are:

  • border-image-source Used to set the image path
  • border-image-slice Used to slice the boarder image
  • border-image-width Used to set the boarder image width
  • border-image-repeat Used to set the boarder image as rounded, repeated and stretched

6) Can you write CSS3 code for creating boarder image?

A) Here is the CSS3 code for creting boarder as image:

#borderimg {
border: 10px solid transparent;
padding: 15px;
border-image-source: url(/css/images/border-bg.png);
border-image-repeat: round;
border-image-slice: 30;
border-image-width: 10px;
}

7) What is Multi Background property in CSS3?

A) Multi background property is used to add one or more images to the background in CSS3.

8) What are the most commonly used Multi Backgroud properties in CSS3?

A) There are four most commonly used multi background properties, they are:

  • background-clip Used to declare the painting area of the background
  • background-image Used to specify the background image
  • background-origin Used to specify position of the background images
  • background-size Used to specify size of the background images

9) Can you write CSS3 code for creating Multi Background Images?

A) Here is the CSS3 code for creating multi background images.

<style>
#multibackgroundimg {
background-image: url(/css/images/logo1.png), url(/css/images/border1.png);
background-position: left top, left top;
background-repeat: no-repeat, repeat;
padding: 75px;
}
</style>

10) What are the new color properties introduced in CSS3?

A) In CSS3, there are few Color properties are introduced they are:

  • RGBA colors
  • HSL colors
  • HSLA colors
  • Opacity

Advanced CSS3 Interview Questions And Answers

11) What RGBA stands for in CSS3?

A) RGBA stands for Red Green Blue Alpha.

12) What HSL stands for in CSS3?

A) HSL stands for hue, saturation, lightness.

13) What HSLA stands for in CSS3?

A) HSLA stands for hue, saturation, lightness and alpha.

14) What is gradient in CSS3?

A) Gradients displays the combination of two or more colors in one grid.

15) What are the types of Gradients in CSS3?

A) In CSS3 there are mainly two types of gradients are there, they are:

Linear Gradients(down/up/left/right/diagonally)

Radial Gradients

16) How can you add gradients to your project?

A) All gradients are read from a gradients.json file which is available in this project’s repo. Simply add your gradient details to it and submit a pull request.
http://uigradients.com/#

17) How can you create shadow effets in CSS3?

A) We can create shadow effects for text using text-shadow and for boxes using box-shadow properties.

18) Can you write CSS3 code to create shadow effect?

A) Here is the sample code for shadow effects:

Text shadow for text element:

H1 {
text-shadow: 2px 2px;
}

Box shadow for box element:

<style>
div {
width: 300px;
height: 100px;
padding: 15px;
background-color: red;
box-shadow: 10px 10px;
}
</style>

19) What are the newly introduced Text related features in CSS3?

A) There are mainly three Text related features are introduced, they are:

text-overflow
text-emphasis
text-align-last
word-wrap
word-break

20) What is text-overflow property used in CSS3?

A) The text-overflow property determines how overflowed content that is not displayed is signaled to users.

Example 1:

p.text1 {
white-space: nowrap;
width: 400px;
border: 2px solid #000000;
overflow: hidden;
text-overflow: clip; //It wont show overflow text.
}

Example 2:

p.text2 {
white-space: nowrap;
width: 300px;
border: 2px solid #000000;
overflow: hidden;
text-overflow: ellipsis; //It indicates overflow text with dots …
}

Real-Time CSS3 Interview Questions And Answers

21) What is word-break property used in CSS3?

A) In CSS3 word-break is used to break the line.

Example 1:

<style>
p.text1 {
width: 150px;
border: 2px solid #000000;
word-break: keep-all; //It breaks the word with hyphens at line break
}

Example 2:

p.text2 {
width: 150px;
border: 2px solid #000000;
word-break: break-all; // It breaks the work without hyphens in line break
}
</style>

22) What is CSS3 word-wrap property?

A) In CSS3 word-wrap is used to break the line and wrap onto next line.

23) What are the different web fonts formats in CSS3?

A) Web fonts allows users to use the fonts in CSS3, which are not installed on local system.

There are five types of web fonts formats are there, they are:

1) TTF – TrueType Fonts
2) OTF – OpenType Fonts
3) WOFF – The Web Open Font Format
4) SVG Fonts
5) EOT – Embedded OpenType Fonts

24) What are 2D transforms in CSS3?

A) In CSS3, by using 2D transforms we can re-change the element structure as translate, rotate, scale, and skew.

25) What are the common values used in 2D Transforms?

A) Here are the some commonly used values in 2D Transforms,

matrix(n,n,n,n,n,n) – Used to defines matrix transforms with six values
translate(x,y)- Used to transforms the element along with x-axis and y-axis
translateX(n) – Used to transforms the element along with x-axis
translateY(n) – Used to transforms the element along with y-axis
scale(x,y) – Used to change the width and height of element
scaleX(n) – Used to change the width of element
scaleY(n) – Used to change the height of element
rotate(angle) – Used to rotate the element based on an angle
skewX(angle) – Used to defines skew transforms along with x axis
skewY(angle) – Used to defines skew transforms along with y axis

26) What are 3D transforms in CSS3?

A) By using 3D transforms, we can move element to x-axis, y-axis and z-axis.

27) What are the common values used in 3D Transforms?

A) Here are the some commonly used values in 3D Transforms,

matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n) – Used to transforms the element by using 16 values of matrix
translate3d(x,y,z) – Used to transforms the element by using x-axis,y-axis and z-axis
translateX(x) – Used to transforms the element by using x-axis
translateY(y) – Used to transforms the element by using y-axis
translateZ(z) – Used to transforms the element by using y-axis
scaleX(x) – Used to scale transforms the element by using x-axis
scaleY(y) – Used to scale transforms the element by using y-axis
scaleY(y) – Used to transforms the element by using z-axis
rotateX(angle) – Used to rotate transforms the element by using x-axis
rotateY(angle) – Used to rotate transforms the element by using y-axis
rotateZ(angle) – Used to rotate transforms the element by using z-axis

28) What are the CSS3 Animations?

A) In CSS3 Animation is process of making shape changes and creating motions with elements.
@keyframes – Keyframes will control the intermediate animation steps in CSS3.

29) How can you create Multi Columns in CSS3?

A) In CSS3, Multi Columns feature allows users to create, text as news paper structure in multi columns.

30) What are the values associated with multi columns?

A) Here is the list of most commonly used multi column values, they are:

column-count – Used to count the number of columns that element should be divided
column-fill – Used to decide, how to fill the columns
column-gap – Used to decide the gap between the columns
column-rule – Used to specifies the number of rules
rule-color – Used to specifies the column rule color
rule-style – Used to specifies the style rule for column
rule-width – Used to specifies the width
column-span – Used to specifies the span between columns

CSS3 Technical Interview Questions And Answers

31) Can you write CSS3 code to arrange text in multi columns?

A) Here is the code for arranging text in multi columns,

<style>
.multi {
/* Column count property */
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;

/* Column gap property */
-webkit-column-gap: 40px;
-moz-column-gap: 40px;
column-gap: 40px;

/* Column style property */
-webkit-column-rule-style: solid;
-moz-column-rule-style: solid;
column-rule-style: solid;
}
</style>

32) What is CSS3 Outline offset?

A) CSS3 outline, draws a line around the element at outside of boarder.

Sample Code for creating Outline:

<style>
div {
margin: 20px;
padding: 10px;
width: 300px;
height: 100px;
border: 5px solid pink;
outline: 5px solid green;
outline-offset: 15px;
}
</style>

33) What is Box sizing property?

A) Box sizing property is using to change the height and width of element.

Example Code for CSS3 Box sizing:

<style>
.div1 {
width: 300px;
height: 100px;
border: 1px solid blue;
box-sizing: border-box;
}
.div2 {
width: 300px;
height: 100px;
padding: 50px;
border: 1px solid red;
box-sizing: border-box;
}
</style>

34) What is CSS3 Responsive Web Design?

A) CSS3 Responsive web design provides an optimal experience for the user. Responsive design allows users easy reading and easy navigation with a minimum of resizing on different devices.
The best thing about web responsive design is, it will changes the height and width of the website automatically to fit the device screen (desktop, laptop, tablets and mobiles) to provide best user experience to the user.

35) What is CSS unicode-bidi Property?

A) The unicode-bidi property is used together with the direction property to set or return whether the text should be overridden to support multiple languages in the same document.

CSS unicode-bidi property example:

div {
direction: rtl;
unicode-bidi: bidi-override;
}

36) What is CSS transition-timing-function Property?

A) The transition-timing-function property specifies the speed curve of the transition effect. This property allows a transition effect to change speed over its duration.

Example:

div {
transition-timing-function: linear;
}

37) What is CSS text-indent Property?

A) The text-indent property specifies the indentation of the first line in a text-block.

Example:

p {
text-indent: 50px;
}

38) What is CSS transform-origin Property?

A) The transform-origin property allows you to change the position of transformed elements. 2D transformations can change the x- and y-axis of an element. 3D transformations can also change the z-axis of an element.

Example:

div {
transform: rotate(45deg);
transform-origin: 20% 40%;
}

39) What is CSS hanging-punctuation Property?

A) The hanging-punctuation property specifies whether a punctuation mark may be placed outside the line box at the start or at the end of a full line of text.

Example:

p {
hanging-punctuation: first;
}

40) What is CSS counter-increment Property?

A) The counter-increment property increases or decreases the value of one or more CSS counters. The counter-increment property is usually used together with the counter-reset property and the content property.

Example:

body {
/* Set “my-sec-counter” to 0 */
counter-reset: my-sec-counter;
}

h2:before {
/* Increment “my-sec-counter” by 1 */
counter-increment: my-sec-counter;
content: “Section ” counter(my-sec-counter) “. “;
}

CSS Interview Questions For Experienced

41) What is CSS background-attachment Property?

A) The background-attachment property sets whether a background image scrolls with the rest of the page, or is fixed.

Example:

body{
background-image: url(“img_tree.gif”);
background-repeat: no-repeat;
background-attachment: fixed;
}

42) What is CSS backface-visibility Property?

A) The backface-visibility property defines whether or not the back face of an element should be visible when facing the user. The back face of an element is a mirror image of the front face being displayed. This property is useful when an element is rotated.

Example:

#div1 {
backface-visibility: hidden;
}
#div2 {
backface-visibility: visible;
}

43) What are CSS functions?

A) CSS functions are used as a value for various CSS properties.

attr()
calc()
cubic-bezier()
hsl()
hsla()
linear-gradient()
radial-gradient()
repeating-linear-gradient()
repeating-radial-gradient()
rgb()
rgba()
var()

44) What is CSS attr() funtion?

A) The attr() function returns the value of an attribute of the selected elements.

Example: a:after {
content: ” (” attr(href) “)”;
}

45) What is CSS calc() function?

A) The calc() function performs a calculation to be used as the property value.

Example: #div1 {
position: absolute;
left: 50px;
width: calc(100% – 100px);
border: 1px solid black;
background-color: yellow;
padding: 5px;
text-align: center;
}

46) What is the cubic-bezier() function?

A) The cubic-bezier() function defines a Cubic Bezier curve.

Example:

div {
width: 100px;
height: 100px;
background: red;
transition: width 2s;
transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
}

47) What is the CSS3 hsl() function?

A) The hsl() function define colors using the Hue-saturation-lightness model (HSL). HSL stands for hue, saturation, and lightness – and represents a cylindrical-coordinate representation of colors.

Example:

#p1 {background-color:hsl(120,100%,50%);} /* green */
#p2 {background-color:hsl(120,100%,75%);} /* light green */
#p3 {background-color:hsl(120,100%,25%);} /* dark green */
#p4 {background-color:hsl(120,60%,70%);} /* pastel green */

48) What is CSS3 hsla() Function?

A) The hsla() function define colors using the Hue-saturation-lightness-alpha model (HSLA). HSLA color values are an extension of HSL color values with an alpha channel – which specifies the opacity of the color.

Example:

#p1 {background-color:hsla(120,100%,50%,0.3);} /* green */
#p2 {background-color:hsla(120,100%,75%,0.3);} /* light green */
#p3 {background-color:hsla(120,100%,25%,0.3);} /* dark green */
#p4 {background-color:hsla(120,60%,70%,0.3);} /* pastel green */

49) What is CSS linear-gradient() Function?

A) The linear-gradient() function sets a linear gradient as the background image. To create a linear gradient you must define at least two color stops.

Example:

#grad {
background: linear-gradient(red, yellow, blue);
}

50) What is CSS radial-gradient() Function?

A) The radial-gradient() function sets a radial gradient as the background image. A radial gradient is defined by its center. To create a radial gradient you must define at least two color stops.

Example:

#grad {
background: radial-gradient(red, green, blue);
}

References: Thoughtco | Tutorialspoint | W3Schools

OTHER INTERVIEW QUESTIONS

  1. Linux Administrator Interview Questions
  2. SQL Interview Questions
  3. Hibernate Interview Questions
  4. Kubernetes Interview Questions
  5. Kibana Interview Questions
  6. Nagios Interview Questions
  7. Jenkins Interview Questions
  8. Chef Interview Questions
  9. Puppet Interview Questions
  10. RPA Interview Questions And Answers
  11. Android Interview Questions
  12. Mulesoft Interview Questions
  13. JSON Interview Questions
  14. PeopleSoft HRMS Interview Questions
  15. PeopleSoft Functional Interview Questions
  16. PeopleTools Interview Questions
  17. Peoplesoft Technical Interview Questions
  18. 199 Peoplesoft Interview Questions
  19. 200 Blue Prism Interview Questions
  20. Visualforce Interview Questions
  21. Salesforce Interview Questions
  22. 300 SSIS Interview Questions
  23. PHP Interview Questions And Answers
  24. Alteryx Interview Questions
  25. AWS Cloud Support Interview Questions
  26. Google Kubernetes Engine Interview Questions
  27. AWS Devops Interview Questions
  28. Apigee Interview Questions
  29. Actimize Interview Questions
  30. DB2 Interview Questions

75 Linux Administrator Interview Questions And Answers

Linux Administrator Interview Questions And Answers For Experienced 2018. Here Coding compiler sharing a list of 75 Real-Time Linux Administration Interview Questions and answers for freshers and experienced.

These Linux questions were asked in various companies like IBM, TCS, Infosys, and Accenture for Linux administration interviews. Linux system admin interview questions prepared by industry experts, we hope that these Linux admin questions will help you to crack your next Linux administrator job interview. All the best for your future and happy Linux learning.

Linux Administrator Interview Questions

  1. Which files stores the user min UID, max UID, password expiration settings, password encryption method being used etc.,?
  2. How do you make a file copied to a new user account automatically upon user account creation?
  3. List the fields in /etc/passwd file.
  4. How to lock an user account?
  5. How to disable user login via terminals?
  6. Which commands are normally recommended to edit “/etc/passwd”, “/etc/shadow”, “/etc/group” and “/etc/gshadow” files?
  7. How do you make/grant complete access (rwx) on files created for a user and deny any level of access to others including group?
  8. How to check if an user account has been locked?
  9. How to find out the shadow password encryption method being used in Linux? How could this be changed (example : from md5 to sha512)?
  10. What are the possible causes when an user failed to login into a Linux system (physical/remote console); despite providing proper credentials?

Linux Administrator Interview Questions And Answers

Let’s start learning Linux Administration Interview Questions and Answers for experienced.

Linux User Management Interview Questions

1) Which files stores the user min UID, max UID, password expiration settings, password encryption method being used etc.,?

ANS : /etc/login.defs

2) How do you make a file copied to a new user account automatically upon user account creation?

ANS : Store the file in /etc/skel directory.

3) List the fields in /etc/passwd file.

ANS : UserName | Password | UserID | GroupID | Comments | HomeDir | LoginShell

<Couple of lines from /etc/passwd file are pasted below for reference>

redhat:x:500:500:Redhat User:/home/redhat:/bin/bash

mssm:x:501:501:another user:/home/mssm:/bin/bash

– “x” in the password column indicates that the encrypted password is stored in /etc/shadow file.

4) How to lock an user account?

ANS: This can be done by using either “usermod -L <UserName>” or “passwd -l <UserName>” commands.

Example:-

#usermod -L mango

Once an account gets locked, there would be an exclamation mark before the encrypted password files in “/etc/shadow” as shown below:

mango:!$1$O5zV5Rj/$XhuRe8Og.AiXMXDGSIsae/:16266:0:99999:7:::

To un-lock an account:-

#usermod -U mango

5) How to disable user login via terminals?

ANS: Add “/sbin/nologin” field instead of “/bin/bash” in “/etc/passwd” file.

Linux Administrator Interview Questions And Answers For Frehsers

6) Which commands are normally recommended to edit “/etc/passwd”, “/etc/shadow”, “/etc/group” and “/etc/gshadow” files?

ANS: vipw > edit the user password file (/etc/passwd)
vigr > edit the user group file(/etc/group)
vipw -s > to edit shadow password file (/etc/shadow)
vigr -s > to edit shadow group file (/etc/gshadow)

These commands would normally lock the file while editing to avoid corruption.

7) Whenever an user tries to login via terminal, system would throw up the error “The account is currently not available”, otherwise, via GUI when user enters password, it looks to be logging in, however, comes back to the login prompt. How could this issue be fixed?

ANS: This is because of the shell field set as “/sbin/nologin” in “/etc/passwd” file, so change this back to “/bin/bash” and user should be allowed to login.

If the shell field is set as “/bin/false” then whenever an user tries to login there would not be any error or messages, it just comes back to the login prompt and same happens in GUI mode.

(8) How do you make a new user to reset his password upon his first login?

{ The prompt should come up like below }

[redhat@localhost ~]$ su – mango
Password:
You are required to change your password immediately (root enforced)
Changing password for mango.
(current) UNIX password:

{ The prompt should come up like above }

ANS: Use ‘chage’ command and set the expiration date as given below

[root@localhost skel]# chage -d 0 mango

<< To view password aging details >>

[root@localhost skel]# chage -l mango
Last password change : password must be changed
Password expires : password must be changed
Password inactive : password must be changed
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

(9) Create users home directory in /home1 directory instead of default /home directory. This gets applicable to any new users who gets created i.e the home directory of that user should be /home1/<UserName>/

ANS: – Edit /etc/default/useradd

– Change the line : HOME=/home1

– Save the changes and exit. After this any new users home directory would be under /home1

– You could check the useradd defaults using the command :#useradd -D

OR

#cat /etc/default/useradd

After this you can add users with the command “useradd <UserName>”. This would create the users home directory with the name of the user under the specified HOME directory as defined in /etc/default/useradd.

EXAMPLE:- adding user with “-d”

[root@Redhat5Lvm ~]# useradd -d /root/doctor alldoctors
[root@Redhat5Lvm ~]# grep alldoctors /etc/passwd
alldoctors:x:912:913::/root/doctor:/bin/bash

[root@Redhat5Lvm ~]# ls -ali /root/doctor/
total 28
607780 drwx—— 3 alldoctors alldoctors 4096 Aug 3 00:31 .
543457 drwxr-x— 18 root root 4096 Aug 3 00:31 ..
608253 -rw-r–r– 1 alldoctors alldoctors 33 Aug 3 00:31 .bash_logout
608252 -rw-r–r– 1 alldoctors alldoctors 176 Aug 3 00:31 .bash_profile
608251 -rw-r–r– 1 alldoctors alldoctors 124 Aug 3 00:31 .bashrc
608248 drwxr-xr-x 4 alldoctors alldoctors 4096 Aug 3 00:31 .mozilla

(10) How do you make/grant complete access (rwx) on files created for a user and deny any level of access to others including group?

ANS : – Need to define the umask value for the required user.
– This can be done by editing .bash_profile file.

For example, if we need to define this for a user “mmurthy” then we need to edit this file “/home/mmurthy/.bash_profile” and define umask as given below (assuming that the default home directory location is not changed):

umask 0077

– Save and exit the file.
– Next time this user logs in, files/directories would get exclusive permissions only for this user as masked by umask parameter.
– For root user the umask is defined in “/etc/init.d/functions” file. Otherwise, in /etc/profile (login shell) or /etc/bashrc (non-login shell) file.

Linux System Admin Interview Questions And Answers

(11) How to check if an user account has been locked?

ANS:- Run the command “passwd -S <UserName>”, this would show if the password has been locked or not. Otherwise, grep for the username from /etc/shadow file and you could see “!” mark prefixed to the encrypted password field.

[root@server6 ~]# passwd -S smurthy
smurthy LK 1970-01-01 0 99999 7 -1 (Password locked.)

[root@server6 ~]# grep smurthy /etc/shadow
smurthy:!!$6$jZqvS4ju$k.o6o7OoL7EZ1Bn52uPKeI2gqA76A7qyTl2PM8192jF2mz4ssVTz/u8DfbY2zJ7xCjFymh5FuATWxW5RxFugM1:0:0:99999:7:::

If you notice a double exclamation mark here (“!!”) this indicates that the account got locked-up by running the command “passwd -l <UserName>” command (available only for root user). Otherwise, a single exclamation mark indicates that the account got locked with the command “usermod -L <UserName>”. Accounts locked with usermod command would record it in /var/log/secure file by default.

To “unlock” an user account, run this command “passwd -u <UserName”>. Otherwise, run “usermod -U <UserName” command twice to get rid off double exclamation marks in the encrypted password field.

Otherwise, “usermod -U <UserName” would unlock an account locked by the “usermod -L <UserName>” command.

EXAMPLE:-

[root@server6 ~]# grep smurthy /etc/shadow
smurthy:!!$6$jZqvS4ju$k.o6o7OoL7EZ1Bn52uPKeI2gqA76A7qyTl2PM8192jF2mz4ssVTz/u8DfbY2zJ7xCjFymh5FuATWxW5RxFugM1:0:0:99999:7:::

[root@server6 ~]# passwd -S smurthy
smurthy LK 1970-01-01 0 99999 7 -1 (Password locked.)

[root@server6 ~]# passwd -u smurthy
Unlocking password for user smurthy.
passwd: Success

[root@server6 ~]# grep smurthy /etc/shadow
smurthy:$6$jZqvS4ju$k.o6o7OoL7EZ1Bn52uPKeI2gqA76A7qyTl2PM8192jF2mz4ssVTz/u8DfbY2zJ7xCjFymh5FuATWxW5RxFugM1:0:0:99999:7:::

[root@server6 ~]# passwd -S smurthy
smurthy PS 1970-01-01 0 99999 7 -1 (Password set, SHA512 crypt.)

(12) How to find out the shadow password encryption method being used in Linux? How could this be changed (example : from md5 to sha512)?

ANS:- We can find out the password encryption method being used for shadow passwords as shown below:

– Check in /etc/login.defs

[root@server8 ~]# grep -i crypt /etc/login.defs
# Use SHA512 to encrypt password.
ENCRYPT_METHOD MD5
MD5_CRYPT_ENAB yes

OR

– Check using “authconfig” command:
[root@server8 ~]# authconfig –test|grep hashing
password hashing algorithm is md5

OR

– Check the password beginning character in the second field of /etc/shadow file:

If it begins with = $6 > indicates sha512
$5 > sha256
$1 > md5
Examples:

ty2:$6$EyoeIHFK$L2PAXcXRo.Q5Y7zUweYkste8PtiL/CqYJ9Z/ydBvRIOqvsegpVtOU1hDfkFdUpTcmjEou4kzL/Ej5MF2HdAB7.:16378:3:100:7::16489:
ty3:$5$Bsv43yG6$/Oa4fhlKF65XW8ROohKnJaSxVIIEhUKFUEdiIcOEfY4:16378:0:99999:7:::
ty5:$1$5J4jzULD$dKGfhSIzXp50Y4mwZxcqB/:16379:0:99999:7:::

To Change Password Encryption Method to sha512:

#authconfig –passalgo=sha512 –update {this would change the password encryption method to sha512}

Verify if it got changed successfully:

[root@server8 ~]# grep -i crypt /etc/login.defs
# Use SHA512 to encrypt password.
ENCRYPT_METHOD SHA512
MD5_CRYPT_ENAB no

[root@server8 ~]# authconfig –test|grep hashing

password hashing algorithm is sha512

(13) What are the possible causes when an user failed to login into a Linux system (physical/remote console); despite providing proper credentials?

ANS:- Here are the possible reasons why an user fails to login into console:

– Account Locked.

When user tries to login via GUI receive an error “authentication failure” after entering password and it goes back to the user list prompt.

In CLI mode, after entering user password, it would fail with an error “incorrect password”. However, if user tries “su” from root account, access would get granted.

– Account Expired.

When account expired, an error notifying about the same would be shown up.

– Shell Disabled

After entering password in GUI, system shows a progress, however, could come back the login prompt. When this user attempts login via CLI, would receive an error “This account is currently not available”. For example, do disable shell of an user “test” : #usermod -s /sbin/nologin test (this only locks only terminal login, however, GUI login would work)

– Only Non-root Users Failed To Login.

If all non-root users are unable to login via GUI/CLI, however, root could login then this could be because of the file “/etc/nologin” presence on the system.

– Only Non-root Users Failed To Login in CLI.

If all non-root users are unable to login via CLI, however, can login via GUI then it would be because of /tmp space limitations. Need to check if /tmp is configured and mounted separately and check free space under /tmp.

– User login failed from GUI or from text console, however, could do su.

If an user fails to login from GUI/Console, however, could login from other user accounts by running ‘su’ then it could be due to pam restrictions. One could use “pam_access” module to restrict login. Need to add :

account required pam _access.so

to files : /etc/pam.d/login & /etc/pam.d/gdm-*

After this add ” – : <UserName> : ALL ” to /etc/security/access.conf file. For example to limit user “test”, we could add below line to access.conf file;

– : test : ALL

{{ there would an error “permission denied” in GUI when user is restricted to login via pam}}

– Only root user login failed from console, however, works in GUI.

This could be because of no terminals available or defined in /etc/securetty file.

If an user failed to login remotely via ssh then the reasons could be different. Here are the reasons:

– User Restricted.

If “AllowUsers” parameter is configured in /etc/ssh/sshd_config then need to add required user to this list to get access.

– Max Logins Set.

If “maxlogins” parameter is set in /etc/security/limits.conf then user would be allowed up to the parameter set and further connections would be denied. There could be “maxsyslogins” configured as well to limit concurrent access to a system.

(14) How to manually add user without using “useradd/adduser” or “system-config-user” utilities?

ANS: Create required directory under /home (default home directory for all local users) and set permissions.

#mkdir /home/user1
#chmod 700 /home/user1

[root@host1 mail]# ls -ld /home/user1
drwx——. 4 user1 user1 4096 Jan 24 07:19 /home/user1

<> Now, edit /etc/passwd file to manually set required parameters for the new user “user1”:

#vipw (this command would block multiple edits of /etc/passwd file)

user1:x:2000:2000:local user:/home/user1:/bin/bash

[root@host1 ~]# grep user1 /etc/passwd

user1:x:2000:2000:local user:/home/user1:/bin/bash

<> Create required group by editing /etc/group file using command ‘vigr’:

#vigr
user1:x:2000:

<> Next step is to create the local profile files for the new user by copying from /etc/skel.

[root@host1 ~]# cp -arv /etc/skel/. /home/user1
`/etc/skel/./.bash_profile’ -> `/home/user1/./.bash_profile’
`/etc/skel/./.bash_logout’ -> `/home/user1/./.bash_logout’
`/etc/skel/./.mozilla’ -> `/home/user1/./.mozilla’
`/etc/skel/./.mozilla/extensions’ -> `/home/user1/./.mozilla/extensions’
`/etc/skel/./.mozilla/plugins’ -> `/home/user1/./.mozilla/plugins’
`/etc/skel/./.gnome2′ -> `/home/user1/./.gnome2′
`/etc/skel/./.bashrc’ -> `/home/user1/./.bashrc’

<> Change permissions of all the files under /home/user1 to be owned by new user:
#chown -R user1:user1 /home/user1

– Try logging in as new user and test.

For user mail requirement, need to create a proper file under /var/spool/mail (default mail box location) with username and permissions:

#cd /var/spool/mail
#touch user1
#chown user1:mail user1

#chmod 660 user1

Linux Administration Interview Questions And Answers

Here you will learn more about advanced Linux administration interview questions and answers to succeed in your next Linux interview.

Linux Shell Scripting Interview Questions And Answers

1) How to create simple shell scripts in Linux?

ANS: Make sure that the file begins with “#!/bin/bash” before any command lines. Make it executable : chmod +x <filename>. Executed by running “sh <filename.sh>” OR <./filename.sh>”.

2) Which command to be used to check the shell being used?

ANS: echo $SHELL
echo $0

Like-wise :

#echo $?
…..this shows the exit status of the most previous process command ran in shell.

#echo $$
….this shows current shell ID (when run inside a script this would print the PID assigned to the shell)

#echo $@ OR #echo $*

….this prints the arguments passed when called for execution.

#echo $#
…..this would show up total number of arguments passed.

#echo $!
…..this would report PID of previous background process.

To check these, run a small script as shown below :
#!/bin/bash
echo -e “Print Current shell ID (\$$): $$”
echo -e “Arguments passed (\$@): $@”
echo -e “No of arguments passed (\$#): $#”
echo -e “This also prints arguments passed (\$*): $*”
………..example:
[root@ansible-host tmp]# ./test.sh 1 2 3
Print Current shell ID ($$): 107199
Arguments passed ($@): 1 2 3
No of arguments passed ($#): 3
This also prints arguments passed ($*): 1 2 3

Linux Log File Interview Questions And Answers

1) Where are the log files stored usually in Linux?

ANS: under /var/log

2) How to check if the syslog service is running?

ANS: /etc/init.d/rsyslog status OR service rsyslog status, otherwise, using “systemctl status rsyslog.service (in RHEL7.x).

3) By default log files are set to get rotated on weekly basis, how to make this gets rotated on monthly basis?

ANS: Edit /etc/logrotate.conf and change below lines

# rotate log files monthly
monthly

Save changes and if you want to rotate the log files immediately then run the command:

#logrotate -f /etc/logrotate.conf

4) How do you check the boot messages (kernel ring buffer)?

ANS:- Using “dmesg” or #cat /var/log/dmesg

5) How to increase size of ‘kernel ring buffer’ file (dmesg)?

ANS:- By default the kernel ring buffer size is 512 bytes. So, to increase this space add “log_buf_len=4M” to the kernel stanza in grub.conf file.

Advanced Linux Administration Interview Questions And Answers

6) What does /var/log/wtmp and /var/log/btmp files indicates and what do they store?

ANS:- These files are used to store user login/logout details since from the date of creation.

The user login, logout, terminal type etc are stored in /var/log/wtmp and this is not a user-readable file, so “last” command reads data from this file (or the file designated by the -f flag).

All un-successful(bad) login attempts are recorded in /var/log/btmp which could be displayed using the command “lastb”. All these login/logout events would also get recorded in /var/log/secure file (this file usually stores all authentication/authorization events).

Like-wise, there is /var/log/lastlog which records most previous successful login event of users. In earlier RHEL versions (RHEL 5.x) there used to be a file /var/log/faillog to hold failed login events which had become obsolete since RHEL6.1 and is no longer available.

Linux Package Interview Questions | Linux YUM Interview Questions

1) What does ‘ivh’ represents in rpm -ivh <PackageName> command?

ANS: i – install
v – verbose mode
h – hash mode where it would print ## characters as the installation progresses

2) What is the difference between rpm -F <PackageName> and rpm -U <PackageName>?

ANS: rpm -F = Basically freshens a package which in turn upgrades an existing package, otherwise doesn’t install it if an earlier version not found.
rpm -U = Upgrades an existing package if exists otherwise install it.

3) How to find to which package the “ls” commands belongs to (to find out package responsible for this command)?

ANS : #rpm -qf /bin/ls {this would tell about the package to which this command (binary file) belongs to if installed by that package}

4) How to find out the configuration files installed by a package (take into consideration of the “coreutils” package)?

ANS : # rpm -qc coreutils

To list out only the document files installed by coreutils package:-
# rpm -qd coreutils

To list out all the files installed by this package:-
#rpm -ql coreutils
OR
#rpm -q – -filesbypkg coreutils

To list out dependencies :-
#rpm -qR coreutils

To list out packages which require this package:-
#rpm -q –whatrequires coreutils

To find out more information of this package:-
#rpm -qi coreutils

To find out any scripts executed by this package:-
#rpm -q –scripts coreutils

Similarly, to find details of package which is not yet installed:

List Files In Package:
#rpm -qpl <PathOfPackageNotYetInstalled>

{The list would show up files which would get added to system after installing package}

List Only Config Files:
#rpm -qpc <PathOfPackageNotYetInstalled>

List Only Document Files:
#rpm -qpd <PathOfPackageNotYetInstalled>

List Out Dependancies For This Package:
#rpm -qpR <PathOfPackageNotYetInstalled>

List Details For This Package:
#rpm -qpi <PathOfPackageNotYetInstalled>

5) How do you find out all the packages installed on a RHEL system(server)?

ANS : – /root/install.log > this would only lists packages installed during deployment of the system. Packages installed later would not be listed here.
– Otherwise, run the command #rpm -qa > this would query rpm database and prints out names respectively.

– In RHEL5.x we can check the file : /var/log/rpmpkgs to find out all packages on the system. However, this file is deprecated in RHEL6.

– Note: In Red Hat Enterprise Linux 6, the daily cron file to create /var/log/rpmpkgs is provided by the rpm-cron package, available in the optional repository, not the main ‘rpm’ package. So, if you do not install the package, /var/log/rpmpkgs is not available on Red Hat Enterprise Linux 6. (Ref – https://access.redhat.com/solutions/23743)

Senior Linux Administrator Interview Questions For Experienced

6) How to create a local yum repository which would make use of the mounted linux ISO image under /media ?

ANS : Create files ending with .repo extension under /etc/yum.repos.d directory with proper syntax:

[root@localhost yum.repos.d]# cat local.repo
[local]
name=RHEL6.5
baseurl=file:///media
enabled=1
gpgcheck=1
gpgkey=file:///media/RPM-GPG-KEY-redhat-release

7) Different ways that can be used to verify that a package got installed successfully via yum:

ANS : ==Method 1==

– Immediately after running yum command, check exit status, if it shows “0” (numeral) then command executed successfully.

[root@localhost yum.repos.d]# echo $?
0

==Method 2==
– Run rpm -qa and test.

[root@localhost yum.repos.d]# rpm -qa | grep certmonger
certmonger-0.61-3.el6.x86_64

==Method 3==
– Verify with rpm command:

[root@localhost yum.repos.d]# rpm -V certmonger

==Method 4==
– Check the yum log to see the successful log entry about the same package.

[root@localhost yum.repos.d]# grep certmonger /var/log/yum.log
Jul 15 10:33:22 Installed: certmonger-0.61-3.el6.x86_64

8)How to view the installed date of a package (consider the package sg3_utils)?

ANS:- Check in /var/log/yum.log file (provided the package is installed by yum):-

[root@server8 ~]# grep sg3_utils /var/log/yum.log
Oct 22 12:11:38 Installed: sg3_utils-1.28-4.el6.x86_64

OR

Use the command “rpm -q <PackageName> –last”

[root@server8 ~]# rpm -q sg3_utils –last
sg3_utils-1.28-4.el6.x86_64 Wed 22 Oct 2014 12:11:37 PM PDT

OR

Using the “rpm -qi <PackageName> | grep “Install Date” command

[root@server8 ~]# rpm -qi sg3_utils|grep “Install Date”
Install Date: Wed 22 Oct 2014 12:11:37 PM PDT Build Host: x86-004.build.bos.redhat.com

In RHEL 5.x, one could use /var/log/rpmpkgs file to check this. To get a list of all the packages installed date: #rpm -qa –last

9) If for some reasons, a binary file gets corrupted or missing from the system, then how could this be recovered with minimal downtime?

ANS:- In first attempt, one could try to copy the missing binary (executable) file from a similar working system using scp command.

In next attempt, if the above attempt not possible or doesn’t work then we could extract this file from respective package and move it to the system.

Consider the situation wherein the binary command file /sbin/ifconfig is missing or corrupted, hence, unable to run this command. So, we’d need to extract this from package and install it.

Steps
———-

– Identify which package this command belongs to.

– On a working system, run the command ‘rpm -qf /sbin/ifconfig’. This would tell which package has installed this executable file:

[root@rh413server sbin]# rpm -qf /sbin/ifconfig
net-tools-1.60-110.el6_2.x86_64

– Mount an iso which holds this package and then run “rpm2cpio” command with “cpio” to extract required file.

– Check if the required file is available in the package before extracting it.

[root@rh413server rpm]# rpm2cpio /media/Packages/net-tools-1.60-110.el6_2.x86_64.rpm |cpio –extract –list –verbose “*ifconfig”
-rwxr-xr-x 1 root root 69440 Apr 26 2012 ./sbin/ifconfig
1542 blocks

– Now, we know that this binary is available with this package, so we’d need to extract this file. Create a directory where to extract.

[root@rh413server package-restore-test]# rpm2cpio /media/Packages/net-tools-1.60-110.el6_2.x86_64.rpm |cpio –extract –make-directories –verbose “*ifconfig”
./sbin/ifconfig
1542 blocks

– The binary would be found under “sbin” directory within current directory.

[root@rh413server package-restore-test]# tree
.
└── sbin
└── ifconfig

1 directory, 1 file

– Later, move this binary file to /sbin folder and make sure proper permissions are set as required.

Linux File System | LVM Interview Questions And Answers

1) How to check what file systems are mounted and their read/write status?

ANS : #cat /etc/mtab
#cat /proc/mounts
#mount
#df -Th > this would not tell the read/write status

2) Where is grub.conf/grub.cfg file stored in RHEL systems?

ANS : In /boot/grub/ OR /etc/grub2 (in case of RHEL7.x) directory.

3) How do you remount a file system read only on the fly?

ANS : #mount -o remount,ro <Mountpoint>
– To make a file system gets mounted read only during boot ,need to edit fstab.

4) Command used to convert ext2 file system into ext3.

ANS : tune2fs -j <device or file system name>

5) How to run file system check on a logical volume in rescue mode?

ANS : – Boot into rescue mode (“linux rescue nomount”)
– Don’t mount any file systems, so “Skip” mounting.
– First make the logical volumes available by running these commands:
– lvm pvscan
– lvm vgscan
– lvm lvscan
– lvm lvchange -ay
– Next, run the file system check on the respective lvm.
– #e2fsck -fy /dev/vgname/lvname

6) How to reduce/extend a root lvm?

ANS : To Reduce – boot into rescue mode without mounting file system (linux rescue nomount).
– activate the lvms if required as explained in previous answer.
– run file system check on respective lvm.
– reduce file system : #resize2fs /dev/vg1/rootlv 5G
– Next, reduce the corresponding lvm : #lvreduce -L 5G /dev/vg1/rootlv (reducing the LV to 5GB)
– Run fsck again.
– Verify the lvm is reflecting the correct size.

To extend – no need to boot into rescue, this could be done online.
– unmount the respective file system first (this is not absolutely necessary, size can be extended online, but always recommended to unmount respective file system)
– Extend the lv : #lvextend -L +1G /dev/vg1/rootlv (extending the size to 1GB plus)
– Extend the file system : #resize2fs /dev/vg1/rootlv
– Run fsck if necessary.

7) How to verify if a filesystem state is marked as clean?

ANS : [root@redhat Desktop]# dumpe2fs -h /dev/sda1 |grep -i state
dumpe2fs 1.41.12 (17-May-2010)
Filesystem state: clean

OR

[root@server8 Desktop]# tune2fs -l /dev/sda1|grep -i state
Filesystem state: clean

8) How to find out backup superblocks for a logical volume?

ANS : [root@redhat Desktop]# dumpe2fs /dev/vg1/rootlv | grep -i “backup superblock”
dumpe2fs 1.41.12 (17-May-2010)
Backup superblock at 32768, Group descriptors at 32769-32769
Backup superblock at 98304, Group descriptors at 98305-98305
Backup superblock at 163840, Group descriptors at 163841-163841
Backup superblock at 229376, Group descriptors at 229377-229377
Backup superblock at 294912, Group descriptors at 294913-294913
Backup superblock at 819200, Group descriptors at 819201-819201
Backup superblock at 884736, Group descriptors at 884737-884737

OR
If the file system is un-mounted then could use mke2fs : #mke2fs -n /dev/vg1/rootlv | grep -i -A1 “superblock backup”

9) Find out list of actual devices associated with a logical volume using lvs command?

ANS : [root@redhat Desktop]# lvs -o +segtype,devices

LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert Type Devices
homelv vg1 -wi-ao—- 1000.00m linear /dev/sda2(0)
rootlv vg1 -wi-ao—- 5.49g linear /dev/sda2(1000)
swaplv vg1 -wi-ao—- 1000.00m linear /dev/sda2(2500)
tmplv vg1 -wi-ao—- 1000.00m linear /dev/sda2(4000)
usrlv vg1 -wi-ao—- 6.37g linear /dev/sda2(2750)
usrlv vg1 -wi-ao—- 6.37g linear /dev/sda2(4250)
varlv vg1 -wi-ao—- 2.93g linear /dev/sda2(250)
testlv vg2 -wi-ao—- 52.00m linear /dev/sdb(0)

OR

– Using vgdisplay : #vgdisplay -v <vgname> {this would list out all the details of the VG including corresponding lvs and pvs within the VG}

— Physical volumes —
PV Name /dev/sdb
PV UUID nFwUZd-F4Cm-tbeq-y75d-OUzX-S2ze-rEeR8x
PV Status allocatable
Total PE / Free PE 25 / 0

PV Name /dev/sdc
PV UUID KWfeHu-cP6u-Qpdz-XzDD-iomY-uSKd-2d6V6G
PV Status allocatable
Total PE / Free PE 25 / 24

OR

– Check the latest lvm archive under /etc/lvm/archive/<archivename>:
[root@redhat Desktop]# grep device /etc/lvm/archive/vg2_00003-697546303.vg
device = “/dev/sdb” # Hint only
device = “/dev/sdc” # Hint only

10) How to set “rw” permissions on file for a user and disable for other users except root user (exclusive permissions)?

ANS : Use “setfacl -m u:<UserName>:<PermissionBits> <File/FolderPath>

#setfacl -m u:redhat:rw /testfile {redhat is an user here}.

To read use “getfacl” command: #getfacl /testfile

Linux Troubleshooting Interview Questions And Answers

11) Different fields in /etc/fstab.

ANS : – DeviceName MountPoint FilesystemType MountOptions DumpFrequency FsckCheckOrder

12) How do you skip the initial fsck(file system check) on a file system while booting up?

ANS : – Edit /etc/fstab and make the last column of the respective file system as 0 (number). This would skip the file system check process.

13) How to list all the files with SUID (Set User ID) bit set under the top level root directory and ignore any errors/warnings in the process, and list the output in long list format?

ANS:- find / -type f -perm -4000 2>/dev/null | xargs ls -l

14) How to list all the files/folders with SUID/SGID/Sticky Bit (Set Group ID) bit set under the top level root directory and ignore any errors/warnings in the process, and list the output in long list format?

ANS:- find / -type f -perm /7000 2>/dev/null | xargs ls -l

15) How to force file system check to run after random/maximum mount counts?

ANS:- One option is to use “tune2fs” (in Ext file systems) command to set this. There are two options “Maximum mount count:” & “Mount count:” which could be used to control after how-many mounts the file system check should be run. By default the “Maximum mount count:” option would be set “-1” when file system gets created which mask this feature. So, to get a file system check (fsck) on system reboot/reset this has to be set and which in turn depends on “Mount count”. These mount counts would get incremented after each system reset/restart.

Default option:

[root@rh413server yum.repos.d]# tune2fs -l /dev/sda2 |grep -i “mount count”
Mount count: 9
Maximum mount count: -1

So, to force ‘fsck’ on count reach of 10, we can tune-up the file system as shown below:

[root@rh413server yum.repos.d]# tune2fs -c 10 /dev/sda2
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to 10
[root@rh413server yum.repos.d]# tune2fs -l /dev/sda2 |grep -i “mount count”
Mount count: 9
Maximum mount count: 10

Now, after the 10th mount of the file system, it would force a file system check and mount counter would be reset to 1.

Otherwise, there is another global option which could be used to make file system check after 180 days or after random number of mounts using “enable_periodic_fsck” in /etc/mk2fs.conf file as shown below:

[root@rh413server yum.repos.d]# grep -i enable_periodic_fsck /etc/mke2fs.conf
enable_periodic_fsck = 1

NOTE: To get this the e2fsprogs package should be at least “e2fsprogs-1.41.12-20.el6”. Hence, need to update older package. This has been added from RHEL 6.6 on-wards.

Ref: https://access.redhat.com/solutions/428583

16) How to search for all files with extension “*.log” in the current working directory and find out total disk space consumed and skip such files under any sub-directories?

ANS : – There are situations wherein an admin would required to find out total disk space consumed by those files such as “*.log” or “*.dat” etc., so one could use this command:

[root@ftp-server data]# find . -maxdepth 1 -name ‘*.log’ | xargs ls -l | awk ‘{ TOTAL += $5} END { print TOTAL }’
3045458

[root@ftp-server data]# find . -maxdepth 1 -name ‘*.log’ -type f -exec du -bc {} + | grep total | cut -f1
3045458

If there are smaller files then running the ‘find’ command or ‘du’ command would work, however, if there are bigger files then one may come across error “argument is too long”, so need to use “xargs” to parse output to avoid such errors. Ref : https://access.redhat.com/solutions/21118

$ find . -maxdepth 1 -name ‘*.dat’ | xargs ls -l | awk ‘{ TOTAL += $5} END { print TOTAL }’
20134408530

16) What are the differences between hard & soft links in Linux file system?

ANS : –
Hard Links Soft Links

Gets created using same I-node number with a different name.

Gets created using alias name referring the original file name, but uses different I-node.

Can only be created within same file system.

Can be created across file systems.

Remains even if original file is removed.

Dies after original file is removed, otherwise exists as a dead link.

Can’t be created for directories.

Can be used to create links to directories.

Linux Boot Kernel Interview Questions And Answers

1) I’ve installed the latest kernel on the system successfully, however, my server still boots from the old kernel. How do you make the system to boot from the newly installed kernel?

ANS : – Verify if the new kernel packages are installed successfully.
– Verify if the kernel stanza is added in grub.conf file.
– Make the new kernel as the default kernel to boot in grub.conf file. Either move the kernel stanza to be the first or change “default” entry according to the kernel stanza to boot.

2) There is an error during the boot stating “cannot resolve label for a file system” and system is dropping into single user mode. System would show up Ctrl+D error. How could this be fixed?

ANS : – Make a note of the file system for which the label failed to resolve.
– Boot into single user mode.
– remount root file system in rw mode = #mount -o remount,rw /
– use “blkid” or “e2label” or “findfs” or “lsblk -f” OR “check in /dev/disk/by-uuid/ or /dev/disk/by-label/” to find out the labels/UUIDs assigned to each mounted devices. If the label is not correct in fstab then edit it.
– Exit and reboot. this would fix the label error.

3) Which command is to be used to create GRUB password to avoid normal user in editing GRUB interface while booting?

ANS :- Using the command “grub-crypt” (in RHEL 6.x). This generates an encrypted password using “sha512” algorithm. You could also use “grub-md5-crypt” which generates “md5” encrypted password.

– paste the generated encrypted password into grub.conf file wherever needed as shown below (only a part of grub.conf file is pasted below):

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password –encrypted $1$EgrNz1$MbdclVToRCCsOF7OuBEgb/
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)

So, with the grub password added anyone who wants to pass arguments to kernel while booting has to enter the password by pressing “P” and then proceed. RHEL 5.x, uses “grub-md5-crypt” command by default to generate one and could use “password –md5 <password-hash>” format in grub.conf file.

4) How do you disable the “NetworkManager” service on runlevel 5?

ANS :- [root@redhat Desktop]# chkconfig –level 5 NetworkManager off

[root@redhat Desktop]# chkconfig –list NetworkManager
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:off 6:off

NOTE: In RHEL7.x, NetworkManager is the standard and default daemon for managing network.

5) Which is the parameter that you would add to grub.conf while configuring kdump?

ANS :- crashkernel=128M (for 128MB crash memory) {crashkernel=0M-2G:128M,2G-6G:256M,6G-8G:512M,8G-:768M}

Linux Technical Interview Questions And Answers For Experienced

6) How can I reboot quickly into another kernel (if available) by-passing BIOS process?

ANS :- This is possible provided kexec-tools package is installed. Say for example there are two kernel images installed:
(kernel-2.6.32-642.4.2.el6.x86_64 & kernel-2.6.32-642.el6.x86_64), and running kernel is “2.6.32-642.4.2.el6.x86_64″, and to boot quickly boot into older kernel by-passing BIOS process, need to run the below commands:

#kexec -l /boot/vmlinuz-2.6.32-642.el6.x86_64 –initrd=/boot/initramfs-2.6.32-642.el6.x86_64.img –command-line=”$(cat /proc/cmdline)”

So, what the above command does is:

> kexec -l /boot/vmlinuz-2.6.32-642.el6.x86_64 <<< this specifies the which kernel image to load

> –initrd=/boot/initramfs-2.6.32-642.el6.x86_64.img <<< which initird image to load

> –command-line=”$(cat /proc/cmdline)” <<<< shows command-line parameters

Once the above command is executed successfully, run the command “kexec -e” to reboot quickly into older kernel.

Linux System Hardware Interview Questions And Answers

1) Commands:

– To check memory availability #free -m Or #cat /proc/meminfo OR top or #vmstat
– To check CPU details #cat /proc/cpuinfo Or lscpu (RHEL6) or check in dmesg
– To check the loaded modules #lsmod
– To load a module #modprobe
– To check all (active/inactive) network interfaces #ifconfig -a Or ip a Or #cat /proc/net/dev
– To scan bus so that all newly added devices/luns would come up: #rescan-scsi-bus.sh or #echo “- – -” > /sys/class/scsi_host/host<ID>/scan {to get the rescan-scsi-bus.sh command, need to install sg3_utils package}
– To check most recent system reboot :#last reboot | head -1 {last command reads from /var/log/wtmp, lastb reads from /var/log/btmp}

[root@redhat Desktop]# last reboot|head -1
reboot system boot 2.6.32-431.el6.x Thu Jul 17 15:43 – 17:09 (01:25)

– To check the most recent system shutdown time :#last -x|grep shutdown|head -1

[root@redhat Desktop]# last -x | grep shutdown|head -1
shutdown system down 2.6.32-431.el6.x Thu Jul 17 15:43 – 15:43 (00:00)

– To check processor statistics : #mpstat or #iostat {these commands belongs to sysstat package}

2) Common Standard Ports Used :

ANS: =
= 21/20 ftp
= 22 ssh
= 23 telnet
= 25 smtp
= 53 DNS (tcp/udp)
= 68 DHCP
= 69 TFTP
= 80/443 http/https (tcp)
= 88/464 Kerberos (tcp/udp)
= 110 pop3
= 123 NTP(udp)
= 137 nmbd
= 138,139,445 smbd
= 143 IMAP
= 161 SNMP
= 389/636 LDAP/LDAPS (tcp)
= 514 (udp) syslogd
= 2049 NFS

3) How to find out the system hardware details such as “manufacture, product name” etc,.?

ANS: Using “dmidecode”

#dmidecode –type system |egrep -i “Manufacturer|Product Name|Serial Number|Family”
OR
#dmidecode –type system |grep “System Information” -A 8

– To find out BIOS details :
#dmidecode –type bios |grep “BIOS Information” -A 6

Please visit my recent blog post for more details and easier way to get the information:

View System Hardware Info

4) The option “Open in Terminal” is missing when user right clicks on terminal in GUI. How to fix this?

ANS : This is basically because of missing package “nautilus-open-terminal”. Once this is installed, the right click option would show up.

5) How to change the default display manager or desktop from Gnome Display Manager (gdm) to kde?

ANS: You would need to install the KDE related packages first. Run command “yum groupinstall “KDE Desktop” to get all the KDE related packages to be installed (provided yum is configured). Once this is done, create the file “/etc/sysconfig/desktop” and add the below lines:

DISPLAYMANAGER=”KDE”
DESKTOP=”KDE”

After this change, restart the X window session.

In RHEL 5.x, you could use “switchdesk” command to switch to different display managers. So, to switch to KDE, you could use the command “switchdesk kde”. This may prompt to install “KDE Software Development” group if not installed.

Advanced Linux Administration Interview Questions And Answers

6) How to run ‘free’ command to print output of 2 instances with 2 seconds interval and store that output in a file (skipping any errors/warnings), and run this in background?

ANS:

[root@localhost ~]# free -s 2 -c 2 1> /tmp/free.out 2> /dev/null &
[1] 4836
[root@localhost ~]# cat /tmp/free.out
total used free shared buffers cached
Mem: 461456 349112 112344 0 12768 47780
-/+ buffers/cache: 288564 172892
Swap: 2031608 26712 2004896

total used free shared buffers cached
Mem: 461456 349120 112336 0 12768 47780
-/+ buffers/cache: 288572 172884
Swap: 2031608 26712 2004896

[1]+ Done free -s 2 -c 2 > /tmp/free.out 2> /dev/null

7) How to find out when was the last time a service got restarted?

ANS:- One way is to check in respective configured logs, otherwise, we could find the process start time using “ps” command.

For example, if you wish to find out the restart occurrence of “sshd” then check in /var/log/secure, you would see something similar to below lines:

Jun 18 05:29:18 nagios sshd[5413]: Received signal 15; terminating.
Jun 18 05:29:18 nagios sshd[5612]: Server listening on 0.0.0.0 port 22.
Jun 18 05:29:18 nagios sshd[5612]: Server listening on :: port 22.

Using ps command:

[root@nagios Desktop]# ps -p $(ps -C sshd -o pid=) -o lstart
STARTED
Thu Jun 18 05:29:18 2015

OR

[root@nagios Desktop]# ps -p $(pgrep sshd) -o lstart
STARTED
Thu Jun 18 05:29:18 2015

Replace the service name with respective service you wish to check far. To find out the most recent ‘httpd’ service restart time :

[root@nagios Desktop]# ps -p $(ps -C httpd -o pid=|head -1) -o lstart
STARTED
Thu Jun 18 05:34:35 2015

Otherwise, check in httpd log files, you would similar lines like below:

[Thu Jun 18 05:34:35 2015] [notice] caught SIGTERM, shutting down
[Thu Jun 18 05:34:36 2015] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured — resuming normal operations

8) What is an elevator (disk elevator) or IO scheduler?

ANS:- It is an algorithm that is used by storage sub-system which takes care of how data gets re-arranged when called in for read/write and merges the requests in a way which would be efficient to the system.

To find out the elevator being used on a disk : # cat /sys/block/<DEVICE>/queue/scheduler

[root@ansible-host ~]# cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]

To change an elevator on the fly:

[root@ansible-host ~]# echo deadline > /sys/block/sda/queue/scheduler
[root@ansible-host ~]# cat /sys/block/sda/queue/scheduler
noop anticipatory [deadline] cfq

To make changes permanent, add the elevator parameter (elevator=deadline) to grub configuration file into default kernel line.

Different elevator methods being used:

–“– Noop –“—

As the name implies this does nothing of data re-order or queuing, it just manages data as First-In-First-Out basis and would ideal when there is a separate storage based controller which does better data re-ordering and understanding of disk layout so that the kernel workload would gets reduced. This would be an ideal option when SSD drives are used.

–“– Anticipatory –“–

In this disk elevator algorithm, each read/write requests would wait a short time before after a request to see if another read/write request for nearby sector is coming up. So, each such requests would have “antic_expire” parameter set measured in milliseconds. If so it will wait for another antic_expire for another. However, each requests whether read/write would also have “read/write expire” parameter set which would serve the requests after the timeout count goes 0 (zero). This is ideal in case of contiguous reads such as FTP servers but not good for database servers.

–“– Deadline –“–

Just like how anticipatory elevator works, the deadline also maintains read/write expiry time outs, however, doesn’t wait for a nearby request before moving requests into queue. Requests in queue would get served in batches based on FIFO. This best suited for servers which does heavy read/write operations such as database servers.

–“– CFQ (Completely Fair Queuing) –“–

This is designed for systems which does a lot of small disk read/writes and multiple processes would be generating disk IOs. This is default elevator being used in RHEL 6. This would normally be used in Desktop system or Usenet servers.

“deadline” is now the default IO scheduler in RHEL 7.x (except SATA drives) which was earlier “cfq” by default.

Linux Networking Interview Questions And Answers

1) How do you change the network speed of an interface to 100Mbps with auto-negotiation off and duplex in full mode(example for interface eth0)?

ANS : – #ethtool -s eth0 speed 100 autoneg off duplex full {changing the speed on the fly}
– To make this changes persistent need to add the below line to /etc/sysconfig/network-scripts/ifcfg-eth0 file:
ETHTOOL_OPTS=”speed 100 autoneg off duplex full”

2) Every time the system reboots the network interface doesn’t come up. However, if you restart network service or execute “ifup eth0” command which would bring up the network fine? How could this be fixed?

ANS : Make sure that “ONBOOT=Yes” is set in the respective configuration file (example in ifcfg-eth0 for eth0). In this case the “ONBOOT” parameter would be set to “NO”.

– If the above step doesn’t help then check /etc/sysconfig/network file and make sure “NETWORKING” is set to “Yes”. {These are the most likely reasons in this case}

3) How do you check the network routing table using commands?

ANS : – #route -n
OR
#netstat -nr

4) After changing the network card on a system the network interface name got changed from eth0 to eth1. This shows when you run the command “ifconfig -a”. Running “service network restart”, shows this error “Device eth0 doesn’t seem to be present”. But when you run the command “ifconfig -a” you would notice eth1 is listed there instead of eth0. So, running “ifup eth1” shows error as “configuration for eth1 not found”. How to make sure that the network interface becomes eth0 here and up along with the server?

ANS : – Make a note of the HW/MAC address of the second network interface here. {ifconfig eth1}
– Enter this MAC into the field “HWADDR” in ifcfg-eth0 file.
– Now, edit “/etc/udev/rules.d/70-persistent-net.rules file.
– You comment out the line of eth0 here and change the name of eth1 to eth0. Save and exit.
– Reboot the system. {this should fix the issue, tested on RHEL6.5 system}.

* This file has been deprecated in RHEL7.x [https://access.redhat.com/solutions/1554703]

—OR—

If the environment doesn’t permit of restart of the system then one could use “udevadm trigger” command to get the changes done without restart.

– First make sure the respective interface config file is present, if not then need to create one manually. In the question here, the interface name was changed from eth0 to eth1, hence, need to look out for ifcfg-eth0 interface file under “/etc/sysconfig/network-scripts” directory and change “HWADDR” and other fields as necessary (these options such as “Hwaddr”, “UUID” are not mandatory, if you wish then you could drop them or remove them if not required).

– Stop the network service. (#service network stop, assuming NetworkManager is not being used).

– Now, navigate to “/etc/udev/rules.d/” directory and edit “70-persistent-net.rules” file. Make sure the hardware address recorded here is correct and change the “NAME” attribute value to match your needs, save it and exit from vi mode.

– Trigger the udevadm to re-read network device rules.

#udevadm control –reload-rules
#udevadm trigger –verbose –subsystem-match=net

– Now, check out the currently available network interfaces (#ip addr show). This should show up modified one as “eth0” instead of “eth1”.

– Start the network service (#service network start).

– If for some reason the interface name don’t change, then unload network module and re-load it (this would drop off current connection, please be aware). If there is no direct access to systems then run a simple “at” command with required time stamp to load network modules, after which connections would work.

Linux Technical Interview Questions And Answers

5) How to fix/troubleshoot “no network” or “network down” or “unable to ping remote host” or “localhost doesn’t ping” problems?

ANS :- When network is down or unable to ping remote (another) host system, we’d need to start checking the following things sequentially:

<> Check if local network interface is working properly.

– Ping localhost to confirm that local network interface is up and required network modules are loaded. If unable to ping localhost check for following things:

<> Check if “lo” (loop-back) interface is up (ifconfig lo)

– You should see “UP LOOPBACK RUNNING” line in the output. If not then bring up the loopback interface : #ifup lo

<>Check if 127.0.0.1 address is mapped with localhost in /etc/hosts file. If there is no such entry then pinging 0 (numeral) would work, however, pining localhost would fail. So, add the entry as:

= 127.0.0.1 localhost

<> Check if at least one network interface is up on system.

#ifconfig eth0 (it could be any interface)

– This should show up a valid IP address and also would indicate if network is active (UP). If network is down then bring it up:

#ifup eth0

– If unable to get a valid IP address here, then need to check how is IP address being provisioned, it could be static or dynamic. If static then check in
/etc/sysconfig/network-scripts/ifcfg-eth0 (i’ve taken eth0 as an example here) and look for valid entries as shown below:

DEVICE=”eth0″
BOOTPROTO=”static”
HWADDR=”00:0C:29:98:64:4C”
ONBOOT=”yes”
TYPE=”Ethernet”
UUID=”99b3f47f-5a68-4ffd-992a-aaa24ad12139″
IPADDR=”192.168.1.211″
NETMASK=”255.255.255.0″

– Bring up the interface if it is down :#ifup eth0
– Still unable to bring up network interface then restart the network service :
#service network restart
OR
#service NetworkManager restart

– If it is dynamic mode of IP address then check if there is any problem on the DHCP server. Try to set a test (static) IP address and check if that works.

<> Next step is to ping the hostname to confirm that name resolution works good.

#ping `hostname` OR ping <IPAddressOfeth0>

– If the above ping fails then ping the ipaddress directly and test if that works then problem with name resolution (DNS), so it should be either addressed at DNS level or fixing /etc/hosts file.

<> Ping another host/node OR Gateway address.

– Now, ping another host/node on the same network group. If ping success then we’d say routing is working, otherwise, check if gateway is configured properly. Ping the gateway address and check.

– Unable to ping another remote host then problem could be at the router end or routing problem. So, run traceroute at this stage and check where network is dropping connections.

<> Unable to ping anything either localhost or remote host or loopback address.

– This could be a problem either with firewall (iptables rules are set), otherwise, with sysctl settings configured on the system. Check if
“net.ipv4.icmp_echo_ignore_all” has been set in /etc/sysctl.con file, if so, please un-set this.

– If firewall problem, then make sure “icmp” protocol and “lo” interface is allowed for communication.

= iptables -A INPUT -i lo -j ACCEPT {A – Append OR I -Insert}

iptables -A INPUT -p icmp -j ACCEPT

6) What are the alternative steps that could be used to test a remote server alive status when ping check fails (if blocked by iptables)?

ANS :

–> Ping failure doesn’t necessarily mean that remote host is down. In such cases it could be possible that ICMP replies would have been disabled (via sysctl) or blocked by firewall rules via iptables.

–> In this case, one could try to check if connectivity works via ssh. Try running ssh in verbose mode (ssh -v username@RemoteHostAddress). If this fails then this would indicate either ssh service is down or user-restricted or blocked by firewall on remote host.

–> At this stage we are still un-sure if remote host is up when both ping & SSH fails to get an acknowledgement. At this juncture, one may use an un-secure telnet (might require to install telnet package) to test if remote host is listening on a port. This would also not respond if port is blocked by firewall.

#telnet <RemoteHostIP> <PortNumber>

–> Next step when telnet also doesn’t show up successful connection is to use nmap (belongs to nmap package)command which would scan the remote host and provides details about host live status along with ports which are filter/un-filtered.

#nmap -sn <RemoteHostIP>

–> This command would performs only host discovery without port scanning. This would fetch quick discovery of hosts alive status. Use “nmap -sn <RemoteHostIP> -n” to ignore name resolution. If the nmap command returns “0 hosts up” or “Host seems to be down” then it would indicate a problem with remote system or network.

–> Optionally, there is “tcping” package available from EPEL which can be used to test remote host alive status using port ping.

#tcping <RemoteHostAddress> <PortNumber>

–> Also there is “netcat” utility (need to install this package) available which is another handy network tool which does a lot of functions including port scanning, so this could be used to test if a port on a remote host is allowed or blocked via firewall.

#nc -z <RemoteHostAddress> <PortNumber>

[root@server1 Desktop]# nc -z 192.168.1.100 22
Connection to 192.168.1.100 22 port [tcp/ssh] succeeded!

Linux Security Interview Questions And Answers

1) How do you backup and restore iptables (configurations)?

ANS : #iptables-save > /tmp/iptables.out
#iptables-restore < /tmp/iptables.out

2) What does the character “S” or “s” in the execute bit location of user permission indicates?

ANS : # “S” indicates that the SUID has been set, however, execute permission is not set. “s” indicates SUID has been set with execute permission.

3) How do you provide an user exclusive permissions to shutdown or reboot a system?

ANS : # Make the user sudo with appropriate permissions on the commands required.
– Edit the file /etc/sudoers using the command “visudo”.
– Add the below lines to /etc/sudoers file: (example to make user “raj” to execute shutdown/reboot commands)

{format
<username> <host>=<commands> }

raj ALL=/sbin/shutdown,/sbin/reboot,/sbin/poweroff

– The next user logins and executes the command “sudo /sbin/shutdown” the user would be prompted to enter password and upon successful authentication the command gets executed.

4) How to disable password-less login for root user in single user mode?

ANS:- Change the line that reads “SINGLE=/sbin/sushell” to “SINGLE=/sbin/sulogin” in “/etc/sysconfig/init” file.

This prompts for user (root) to enter a valid password to authenticate. However, if “init=/bin/sh” is passed as grub parameter then system would boot without prompting for password.

5) How to temporarily disable all user log-in except root user (either via SSH or terminal or in GUI)?

ANS:- This could be achieved by creating /etc/nologin file (as root user). If this file exists then any user who tries to log-in would gets rejected and only root user would be allowed (the root user may not be allowed to login via ssh if “PermitRootLogin” is set to “no” in /etc/ssh/sshd_config).

Linux Admin Interview Questions And Answers For Experienced

6) How to disable “Restart” & “Shut Down” buttons on the GUI Login screen?

ANS: In RHEL 6.x, you would need to use gconftool-2 or gconf-editor commands for this purpose.

Using gconftool-2 command:

To disable “Restart” & “Shut Down” buttons on the GUI log-in screen, run the below command as root user:

#gconftool-2 –direct –config-source xml:readwrite:/etc/gconf/gconf.xml.defaults –type bool –set /apps/gdm/simple-greeter/disable_restart_buttons true

These are defined as schemas in “/etc/gconf/schemas/gdm-simple-greeter.schemas” file.

Same way, if you wish to disable user list, run the below command as root user:

#gconftool-2 –direct –config-source xml:readwrite:/etc/gconf/gconf.xml.defautls –type bool –set /apps/gdm/simple-greeter/disable_user_list true

Using gconf-editor command:

Run “gconf-editor” command, expand “apps” and then “gdm”, click on “simple-greeter” and then check “disable_restart_buttons”, then right click on “disable_restart_buttons” and choose “Set as Default”.

In RHEL 5.x

The simplest way to achieve this in RHEL 5.x is to run the command “gdmsetup” in GUI as root user, un-check “Show Actions Menu” under “Menu Bar” in “local” tab. This would remove “Restart” & “Shut Down” buttons on the GUI log-in screen.

In RHEL 7.x

Edit (as root user) “/etc/dconf/db/gdm.d/01-custom-gdm-settings” file and the following lines:

[org/gnome/login-screen]
disable-user-list=true

Then update “dconf” database using the command “dconf update”, finally restart gdm service “systemctl restart gdm”

7) What does the umask value of 0022 indicates for a root user?

ANS:Before understanding this, one must understand the numerical values being used to represent permission bits in Unix environment. It is as shown below:

r – “read” permission – numerical equivalent value “4”
w – “write” permission – numerical equivalent value “2”
x – “execute” permission – numerical equivalent value “1”
s – “special” permission bit – numerical equivalent “4” for SUID (SetUserID), “2” for SGID(SetGroupID “1” for Sticky-bit.

u – “user”
g – “group”
o – “others”

Set/Unset Permissions: Using chmod command. Say for example you wish to set only “read & write (rw)” permission for owner, no permissions for group and others then this could be done like below:

$chmod 600 <filename> OR $chmod u+rw,go-rwx <filename>

Now, lets check what does 0022 umask value indicates:

0 – Indicates special character bit, not masked.
0 – Indicates mask nothing, all permission bits are set for “Owner”.
2 – Indicates mask 2 for “Group” (for files it is “x4x” meaning both read & write bits are set likewise for directories it is “x5x” meaning both read & execute bits are set)
2 – Indicates mask 2 for others ( as explained above)

Saying so, when a root user creates a file/directory this umask bit would be used to set the effective permissions. For a file it would be (666-022=644), rw-,r–,r– (read&write,read,read) respectively for user, group and others (ugo). However, when a directory is created it would be (777-022=755) rwx,r-x,r-x for ugo. Same way the default umask value for other users is 0002.

Original Source: SimplyLinuxFAQ

OTHER INTERVIEW QUESTIONS

  1. SQL Interview Questions
  2. RPA Interview Questions And Answers
  3. Android Interview Questions
  4. Mulesoft Interview Questions
  5. JSON Interview Questions
  6. PeopleSoft HRMS Interview Questions
  7. PeopleSoft Functional Interview Questions
  8. PeopleTools Interview Questions
  9. Peoplesoft Technical Interview Questions
  10. 199 Peoplesoft Interview Questions
  11. 200 Blue Prism Interview Questions
  12. Visualforce Interview Questions
  13. Salesforce Interview Questions
  14. 300 SSIS Interview Questions
  15. PHP Interview Questions And Answers
  16. Alteryx Interview Questions
  17. AWS Cloud Support Interview Questions
  18. Google Kubernetes Engine Interview Questions
  19. AWS Devops Interview Questions
  20. Apigee Interview Questions
  21. Actimize Interview Questions
  22. Kibana Interview Questions
  23. Nagios Interview Questions
  24. Jenkins Interview Questions
  25. Chef Interview Questions
  26. Puppet Interview Questions
  27. DB2 Interview Questions
  28. AnthillPro Interview Questions
  29. Angular 2 Interview Questions
  30. Hibernate Interview Questions
  31. Kubernetes Interview Questions

Tricky SQL Server Interview Questions And Answers For Experienced

SQL Server Interview Questions And Answers For Experienced 2018. Here Coding compiler sharing a comprehensive list of 250 SQL Server Interview Questions. This list is prepared by the industry expert SQL Server professionals, it will help you to crack your next SQL Server job interview. These complex SQL Server questions were asked in many top MNC companies like Infosys, IBM, TCS, Etc. Let’s start learning SQL Interview Questions and Answers, all the best for your future and happy SQL learning.

SQL Server Interview Questions

  1. What is a candidate key?
  2. What are alternate keys?
  3. What is a primary key?
  4. What is the difference between a primary key and a unique key? Are they the same?
  5. What is referential integrity?
  6. What is an Entity-Relationship Diagram (ERD)?
  7. What is a subquery?
  8. What is a correlated subquery?
  9. How do you use a subquery to find records that exist in one table and do not exist in another?
  10. What does it mean to normalize a database and why would you do it?
  11. What is denormalization?

SQL Server Interview Questions And Answers

Here is the list of 250 SQL Server interview questions and answers for freshers and experienced. Start learning now.

General RDBMS Interview Questions And Answers

Q. What is a candidate key?

A. A candidate key is one that can uniquely identify each row of a table. Generally, a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key and the rest are called alternate keys.

Q. What are alternate keys?

A. Any candidate keys not chosen as the primary key.

Q. What is a primary key?

A. A primary key is a special candidate key. It is an attribute or minimal set of attributes that not only uniquely identifies a specific occurrence of the entity, but also exists for every occurrence of an entity. The difference between a primary key and any other unique key is that SQL server automatically uses the primary key definition in various Referential integrity constructs.

In other words, the primary key is a field (or set of fields) that uniquely identifies each record of a table. A table can have only one key declared as primary. If a primary key consists of more than one column, duplicate values are allowed in one of the columns, but the combination of values from all the columns in the primary key must be unique.

Q. What is the difference between a primary key and a unique key? Are they the same?

A. No, these two are two different keys. By default, a primary key creates a clustered index on the column and unique keys create a nonclustered index. Primary keys do not allow NULL values, but unique keys allow one NULL value. However, both primary and unique keys enforce uniqueness of the column on which they are defined. You can use primary key constraints to enforce uniqueness as well as referential integrity. Defining a primary key on a table helps to relate that table to other tables. These relationships help to normalize a database. A table can have only one primary key.

Q. What is referential integrity?

A. Referential integrity is a relationship that requires that all foreign key column values must match to a primary key column value.

Q. What is an Entity-Relationship Diagram (ERD)?

A. An Entity Relationship Diagram (ERD) is a way to graphically describe the way tables and columns are connected in your database. Entities equate to tables, and relationships describe the connection between two entities, i.e. one-to-one, one-to-many, and many-to-many. A relationship works by matching data in key columns.

Basic SQL Server Interview Questions And Answers

Q. What are the types of relationships between tables?

A. There are three possible types of relationships between tables. The type of relationship depends on how the related columns are defined. The three types of relationships are:

One-to-Many Relationships

Many-to-Many Relationships

One-to-One Relationships

Q. What is One-to-Many Relationships?

A. A one-to-many relationship is the most common type of relationship. In this type of relationship, a row in Table A can have many matching rows in Table B, but a row in Table B can have only one matching row in Table A. For example, the Sales and Stores tables have a one-to-many relationship with each other: each Store can have many sales, but each sale can have only one store. This relationship uses the Stor_ID field for its key field.

Q. What is Many-to-Many Relationships?

A. In a many-to-many relationship, a row in Table A can have many matching rows in Table B, and vice versa. In SQL Server, you create such a relationship by defining a third table, called a “junction table”, whose primary key consists of the foreign keys from both Table A and Table B. For example, the Authors table and the Titles table have a many-to-many relationship that is defined by a one-to-many relationship from each of these tables to the Titleauthors table. The primary key of the Titleauthors table is the combination of the au_id column (the Authors table’s primary key) and the title_id column (the Titles table’s primary key).

Q. What is One-to-One Relationships?

A. In a one-to-one relationship, a row in Table A can have no more than one matching row in Table B, and vice versa. A one-to-one relationship is created if both of the related columns are primary keys or have unique constraints.

Q. What is a subquery?

A. A subquery is a nested select statement where the inner select statement is evaluated first. You can use the results of the inner select statement as the input for another select statement. For example, you can use the results of a subquery as a search condition that uses the IN ( ) function or EXISTS operator:

USE northwind

SELECT * FROM Orders WHERE orderId IN
(SELECT orderId FROM [Order Details]
WHERE OrderId = 10248)

USE pubs
SELECT * FROM authors WHERE au_id
NOT IN (SELECT au_id FROM titleauthor)

Q. What is a correlated subquery?

A. A correlated subquery is a subquery where the inner query is evaluated once for every value returned by the outer query. Generally, a query which has a subquery will execute the subquery once and substitute the resulting value or values into the WHERE clause of the outer query. In queries that include a correlated subquery (also known as a repeating subquery), the subquery depends on the outer query for its values.

For example, using the northwind database, if you want to find out the price of all the books ordered, you can use a correlated subquery. Price information about each book is in the [Order Details] table, and the Orders table has all the books ordered.

SELECT O.OrderID, O.OrderDate,

(SELECT MAX (Od.UnitPrice) FROM [Order Details] AS Od WHERE Od.OrderID = O.orderid) AS MaxUnitPrice
FROM Orders AS O

The subquery runs once for each row that the main query returns. This repeated access to the [Order Details] table could be inefficient. Generally, correlated subqueries can be re-written as a query using a join.

Q. How do you use a subquery to find records that exist in one table and do not exist in another?

A. Use a subquery with the NOT IN clause or NOT EXISTS clause.

For example, Find out authors who do not have any records in the titleauthor table?

USE pubs
SELECT * FROM authors WHERE au_id
NOT IN (SELECT au_id FROM titleauthor)

Prefered method is now an ANSI outer join where outside join table value is NULL.

SELECT a.*
FROM a
LEFT OUTER JOIN b
ON a.joinColumn = b.joinColumn
WHERE b.joinColumn IS NULL

Q. What does it mean to normalize a database and why would you do it?

A. Normalization is the process of organizing data in the most optimized way. This includes creating tables and establishing relationships between those tables to eliminate redundancy and inconsistant data.

There are rules for database normalization. Each rule is called a “normal form”. If the first rule is observed, the database is said to be in “first normal form”. If the first three rules are observed, the database is considered to be in “third normal form”. Although additional levels of normalization are possible, third normal form is considered the highest level necessary for most applications. If a database adheres to the first rule and the third rule, but is not in accordance with the second rule, it is still considered in the first normal form.

Benefits of Normalization:

  • Minimizes amount of space required to store the data by eliminating redundant data.
  • Minimizes the risk of data inconsistencies within a database.
  • Minimizes the introduction of possible update and delete anomalies.
  • Maximizes the stability of the data structure.

Q. What is First Normal form (1NF)?

A. First normal form eliminates repeating groups of data through the creation of separate tables of related data. You can reduce entities to first normal form by removing repeating or multivalued attributes to another child entity.

Q. What is Second Normal Form (2NF)?

A. Second normal form requires that each non-key attribute be fully dependent upon the entire primary key.

Q. What is Third Normal Form (3NF)?

A. Third normal form requires that each non-key attribute depend on the entire primary key (exactly like 2NF) and nothing but the primary key .

To achieve 3NF eliminate fields that do not depend on the key.

Q. What is Boyce/Codd normal form (BCNF)?

A. An entity is in BCNF if and only if all attributes are determined only by each full candidate (primary or alternate) key, and not by any other subset of candidate keys.

Q. What is Fourth Normal Form (4NF)?

A. Fourth normal form is a form of normalization that is not commonly used which further separates any multivalued attributes that may exist in tables by separating them into child table.

Q. What is denormalization?

A. Denormalization is the opposite of normalization process. It is deliberately introducing redundancy into a table design. In some situation, redundancy helps query performance as the number of joins can be reduced, and some calculated values can be kept in a column reducing the overhead of doing calculations with every query. An example of denormalization is a database that stores the quartely sales figures for each item as a separate piece of data. This approach is often used in data warehouse or in on-line analytical processing applications.

SQL Designing And Programming Interview Questions And Answers

Q. How can I detect whether a given connection is blocked?

A. A connection is blocked when it requires an object that another connection is using and has a lock on. One way is to use SQL Enterprise; Click on Node Management to expand it, then expand Current Activity by clicking on it, then click on Locks. Once you will click on Lock/Process ID, it will show all the Locks on the right hand side window.

Q. How would you design a database for an online site, which would average a million hits a day?

A. This is an open ended question to check your understanding about the subject. The interviewer wants to see how inquisitive you are and how well you prepare before you jump on the design board. The interviewer certainly expects some more questions in reponse from you to see your analytical ability.

Before you answer any thing you must ask, about the application. What kind of application it is supporting? Is it an On-line Transaction Processing (OLTP) or Decision Support System (DSS) application? What time of day is the traffic is highest? Is the traffic evenly distributed, or does it come and go in peaks? What is the spike threshold the site is expected to endure? What is the size of the database? How many tables will be there? What is the hardware configuration? Is it preexisting, or is the interviewer expecting you to design that as well? How many hard disks you will have? What is the performance expectation? What hardware is available? Are the servers running clustering or SAN technology?

To approach this question, first get all the facts about the application and the system, and then begin reciting the best practices of database design.

For a good database design there are many things to be considered, but few of them are of paramount importance, namely :

– Normalization and appropriate denormalization of the database

– Proper indexing of the tables

– Optimum use of the stored procedures, functions etc.

– Distribution of data tables, their indicies and transaction logs on different hard disks

– Proper choice of data types

After basic design with the help of a performace monitor, use the Index Tuning Wizard and Profiler to further refine the design to a more detailed level.

Above all, make sure you are desiging the right system. It would be unfortunate to ramble on for 15 minutes about all the correct things for a SQL Server implementation only to find out that the database will reside on a legacy server running Linux.

Most Asked SQL Server Interview Questions And Answers

Q. You are testing the performance of a query. The first time you run the query, the performance is slow. The second time you run the query, the performance is fast. Why is this?

A. The second query is faster bacause SQL server caches the data, and keeps the query plans in memory.

Q. What you can do to remove data from the cache and query plans from memory for testing the performance of a query repeatedly?

A. If you want to run your query and test its performance under the same circumstances each time, use command DBCC DROPCLEANBUFFERS after each run to remove the data from the memory and DBCC FREEPROCCACHE to remove the query plans from the memory.

Q. What is wrong in the following SQL statement?

UPDATE customer
SET c.name = u.name
FROM customer c, customerdetail cd
WHERE c.custid = cd.custid

A. In update clause, once an alias is defined, you must use that alias in the update clause or an error will be generated. The correct statement is below.

UPDATE c
SET c.name = u.name
FROM customer c, customerdetail cd
WHERE c.custid = cd.custid

Q. Write the fastest query to find out how many rows exist in a table.

A. The fastest query for this purpose is:

SELECT rows
FROM sysindexes
WHERE id = OBJECT_ID (tablename)
AND indid < 2

With this query, SQL does not have to do a full table scan or an index scan to find out the number of rows in a table. The rows column in the sysindexes table keeps the current rowcount dynamically for the clustered index. If table has a clustered index then indid = 1. If no clustered index exists then indid = 0 for the table.

The statement

SELECT COUNT(*) FROM TableName
requires a full table scan or full clustered index scan to determine the total number of rows. Recall that the interviewer asked for the fastest query that would return the results. SELECT COUNT(*)… will return the correct answer, but it will not be the fastest.

Q. The COUNT() function always returns a int value type. What should you do if you need to count rows from a query which you know will return a value that is too large for an int value type?

A. If you think that the count function will be returning rows more than 2^31 -1, then you can use the new function COUNT_BIG, which always returns a big integer value type.

Q. What is a derived table?

A. A derived table is just another name for the result of using another SELECT statement in the FROM clause of a SELECT statement. The result of an inner SELECT statement is a table, which is exactly what the FROM clause requires.

SELECT *
FROM (SELECT * FROM authors) as T
WHERE T.city LIKE ‘san%’

Q. You have a table with three columns: Amount1, Amount2, and Amount3. In a single row only one of these three columns will have a value and the other two will be null. Write a SQL query to retrieve the values from these columns.

A. Use the COALESCE function.

SELECT ‘Amount’= COALESCE (Amount1, Amount2, Amount3)
FROM TableName

COALESCE is equivalent to a searched CASE expression where a NOT NULL expression1 returns expression1 and a NULL expression1 returns expression2. In searched CASE expression form, it would look like this:

CASE

WHEN expression1 IS NOT NULL THEN expression1 ELSE expression2
END

COALESCE returns the first non-null value from the list.

Q. Write a query to get all of the employees and all of the orders that were processed this year. Employees who have no orders should also be displayed.

A. Use this query:

SELECT e.EmpID, e.FirstName, e.LastName, o.Orders FROM Orders o

RIGHT OUTER JOIN Employee e ON
o.EmpID = e.EmpID
AND DATEPART(YYYY, OrderDate) = DATEPART(YYYY, GetDate())
ORDER BY EmpID

Q. How can you fix a poorly performing query?

A. Some general issues that would cause a query to perform poorly that you could talk about would be: no indexes, table scans, missing or out of date statistics, blocking, excess recompilations of stored procedures, having procedures and triggers without the SET NOCOUNT ON directive, unnecessarily complicated joins, excessive normalization of the database, or inappropriate or unnecessary usage of cursors and temporary tables.

Some of the tools and techniques that help you troubleshoot performance problems are: SET SHOWPLAN_ALL ON, SET SHOWPLAN_TEXT ON, SET STATISTICS IO ON, SQL Server Profiler, Windows NT /2000 Performance monitor, and the graphical execution plan in Query Analyzer.

Q. What is the physical representation for a many-to-many relationship?

A. A many-to-many relationship is usually represented by a third table that resolves all valid combinations of the two entities.

For example, consider a hospital, where a patient can be treated by different doctors and a doctor can have many patients. If we have two tables, defining Patients and Doctors each, we need a third table to define the relationship between Patients and Doctors.

Common SQL Server Interview Questions And Answers

Q. What is the maximum length of an extended property?

A. The value of an extended property is a sql_variant. It can contain up to 7,500 bytes of data. (MRG: Add infomraiotn about extended properties)

Q. In which database can extended stored procedures be added?

A. Extended stored procedures can only be added to the master database. In SQL Enterprise Manager, the master database must be selected to activate the extended stored procedures option. Only a person in the sysadmin role can add extended stored procedures.

Extended stored procedures may also be installed via sp_addextendedproc, which will register the procedure in the master database.

Q. Why does this query return 0?

SELECT (3/4) * 100

A. Because 3/4 (.75) is converted into integer, but the result is less than one, therefore it becomes 0. To make this query work use

SELECT (3.0/4) * 100

or

SELECT (CAST (3 AS DOUBLE) / (4 AS DOUBLE) ) * 100

Q. If a column is an image value type, how you can compare column values? How you can use this column in join clause?

A. You cannot use the equal (=) sign to compare a column of type image. You have to use substring function.

E.g.

SELECT d.emp, e.empname
FROM dept d
INNER JOIN Employee e ON
SUBSTRING(d.empNo,1,30) = SUBSTRING(e.empno,1,30)

Q. Which data type cannot be used as a parameter in a UDF?

A. The timestamp data type and user-defined data types are not supported.

Q. Which four data types cannot be used as a return type from a user-defined function?

A. text, ntext, image, and timestamp.

Q. Can an extended stored procedure be called from inside a user-defined function?

A. Yes, however, the extended stored procedure, when called from inside a function, cannot return result sets to the client. Any ODS (open data services) APIs that return result sets to the client will return FAIL.

Q. How you can make a parameterized view?

A. Inline table-valued functions can be used to achieve the functionality of parameterized views.

CREATE FUNCTION CustomerNamesInRegion ( @RegionParameter nvarchar(30) )
RETURNS table
AS

RETURN ( SELECT CustomerID, CompanyName FROM Northwind.dbo.Customers WHERE Region = @RegionParameter
)
GO

SELECT *
FROM CustomerNamesInRegion(N’WA’)
GO

The RETURNS clause contains only the keyword table. You do not have to define the format of a return variable because it is set by the format of the result set of the SELECT statement in the RETURN clause.

There is no function_body delimited by BEGIN and END.

The RETURN clause contains a single SELECT statement in parentheses. The result set of the SELECT statement forms the table returned by the function. The SELECT statement used in an inline function is subject to the same restrictions as SELECT statements used in views.

Top SQL Server Interview Questions And Answers

Q. How long can an Error message be in RAISEERROR function?

A. The error message can have as many as 255 characters.

Q. What are the constraints on severity level in RAISEERROR?

A. Severity levels 0 through 18 can be used by any user. For severity levels 19 through 25, the WITH LOG option is required. Only the system administrator can issue RAISERROR with a severity level of 19 through 25.

Q. How can you log an error to the server event log from a stored procedure?

A. Use the WITH LOG option in the RAISERROR function.

RAISEERROR (“This is an error”, 19, NULL) WITH LOG

The WITH LOG option logs the error in the server error log and the event log. This option is required for messages with a severity level of 19 through 25, and it can be issued only by the system administrator.

Other options can be:

NOWAIT – Sends messages immediately to the client server.

SETERROR – Sets @@ERROR value to msg_id or 50000 regardless of the severity level.

This example returns an @@ERROR value of 50000:

RAISERROR(‘Test Only’,1,2) WITH SETERROR

This example returns an @@ERROR value of 101:

RAISERROR (101, 1, 2) WITH SETERROR

Q. Explain the Rollup operator.

A. The ROLLUP operator is an aggregate operator that delivers aggregates and super-aggregates for elements within a GROUP BY statement. For additional information see the example in the following question.

Q. Explain the Cube operator.

A. The ROLLUP operator is an aggregate operator that delivers aggregates and super-aggregates for elements within a GROUP BY statement. It differs from the CUBE operator only in that it is sensitive to column position in the GROUP BY clause.

Example

This example uses a SELECT query that contains an aggregate function and a GROUP BY clause, which lists pub_name, au_lname, and title, in that order.

SELECT pub_name, au_lname, title, “SUM” = SUM (qty)
FROM publishers, authors, titles, titleauthor, sales
WHERE publishers.pub_id = titles.pub_id
AND authors.au_id = titleauthor.au_id
AND titleauthor.title_id = titles.title_id
AND titles.title_id = sales.title_id
GROUP BY pub_name, au_lname, title
WITH ROLLUP

Q. What is an application role and explain a scenario when you would use one?

A. Application roles allow the application, rather than SQL Server, to take over the responsibility of user authentication. A user’s association with an application role is due to his ability to run an application that activates the role, rather than his being a member of the role.

Application roles are different from standard roles. Application roles contain no members. Microsoft Windows NT® 4.0 or Windows® 2000 groups, users, and roles cannot be added to application roles; the permissions of the application role are gained when the application role is activated for the user connection through a specific application or applications. Application roles are inactive by default and require a password to be activated. Approle is only active for the duration of the connection context in which it is established.

Q. On Friday, you issued several INSERT statements using Query Analyzer. You then verified the data had been correctly entered with a SELECT statement. On Monday, your users report that the data is not there. What happened?

A. IMPLICIT_TRANSACTION mode was enabled (on) for the connection.

In this mode, after inserting or manipulating data, you must issue the COMMIT TRANSACTION statement to save the data permanently. Otherwise, once the connection is broken all your inserts are rolled back. To turn on this option use the SQL statement:

SET IMPLICIT_TRANSACTIONS ON

To turn this options off use the SQL statement:

SET IMPLICIT_TRANSACTIONS OFF

Q. You have two tables with a one to many join based on a field named ID. You need to find records in the parent table that are not represented in the child table. How would you accomplish this?

A. You can use a LEFT JOIN to show records that exist in one table, but not another. For example:

SELECT parent.ID, child.ID
FROM parent
LEFT JOIN child
ON parent.ID = child.ID
WHERE child.ID is NULL

Q. Give an example of why you would want to denormalize a database.

A. The best reason to denormalize a database is to increase performance.

Q. Explain extended properties.

A. Extended properties are the properties that a user can assign to any object in a database. These extended properties can be used to store application-specific or site-specific information about the database objects. Because the property is stored in the database, all applications reading the property can evaluate the object in the same way. This helps enforce consistency in the way data is treated by all of the programs in the system.

For example, the caption of a column can be defined as an extended property. All applications can use the same caption in a user interface that displays information from that column. Another example can store help description information as an extended property.

To create an extended property use the following steps:

1) Open the Query Analyzer and launch the object browser.

2) Navigate to the column of the desired table.

3) Right click the column and select Extended Property.

A new dialog box will let you create the extended properties or edit exiting one.

To access them from your program use the fn_listextendedproperty function.

Q. You have couple of stored procedures that depend on a table. You dropped the table and recreated it. What do you have to do to reestablish those stored procedure dependencies?

A. You have to recreate the stored procedure, at the time of this writing SQL2000 doesn’t have very reliable automatic dependency tracking feature. This limitation may be removed in future version of SQL Server.

Essential SQL Server Interview Questions And Answers

Q. How can you append an identity column to a temporary table?

A. SELECT CommonName INTO #TempTable FROM tblApplication ALTER TABLE #TempTable ADD NameID INT identity

The above query is not very optimized. Alter table command logs updates on a row-by-row basis, and if the appropriate fill factor is not specified it will split pages too. The better option can be select into, with identity function, because SQL server has to pass through the data only once and SELECT INTO uses FAST BULK LOAD API to copy the data.

SELECT IDENTITY (int, 1,1) AS NAMEID
CommonName INTO #TempTable FROM tblApplication

Q. You schedule a job to run every minute. What will happen if the first job runs more than 1 min? Will the second instance of the job start?

A. No, Only one instance of a job can run at a time. If you execute a job manually while it is running as scheduled, SQL Server Agent refuses the request. The timer for the second job will start only after first job ends.

Q. Why should you use or avoid SELECT * …. statements?

A. You can use a SELECT * statement when you are familiar with the data structure and are aware of which columns you will be returning.

SELECT * statements should be avoided in several cases. For example, in the case of a stored procedure, if an underlying table structure is modified that the SELECT statement relies upon, aspects of the stored procedure will change. You may also notice a performance decrease when using a SELECT * when many columns are added to the table specified in the FROM clause.

Q. What is wrong with this statement?

SELECT TOP 5
FROM tblTable

A. The compiler will return an error because no output columns were specified. A correct statement would be

SELECT TOP 5 *
FROM tblTable

Q. You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes. To optimize performance, how should you distribute the tables and their indexes onto different file groups?

A. Try to keep the non-clustered indexes on different file groups from their tables and on different disks so that they can be scanned in parallel for data. You cannot separate clustered indexes from the underlying table.

Q. Which event (Check constraints, Foreign Key, Rule, Trigger, Primary key check) will be performed last for an integrity check?

A. Triggers are performed last for intregity checks.

Q. What is the fastest way to permanently delete a 1 million row table named customers?

A. Truncate the customers table and then drop table customers.

The TRUNCATE TABLE statement is a fast, nonlogged method of deleting all rows in a table. It is almost always faster than a DELETE statement with no conditions because DELETE logs each row deletion and TRUNCATE TABLE logs only the deallocation of whole data pages. TRUNCATE TABLE immediately frees all the space occupied by data and indexes. The distribution pages for all indexes are also freed.

When a TRUNCATE TABLE is performed, the definition of the table remains in the database, along with its indexes and other associated objects. The DROP TABLE statement must be used to drop the definition of the table.

SQL Server Developer Interview Questions And Answers

Q. In a stored procedure, some errors terminate the stored procedure, how you can bypass these errors and continue execution? For example

USE Northwind

GO

SELECT * FROM aTable

IF @@ERROR<>0 BEGIN

PRINT ‘ Table does not exist’

— create a new table here

END

A. One workaround is to use the sp_executesql command.

DECLARE @err int

EXEC @err = sp_executesql N’ SELECT * FROM aTable’

IF @err <> 0 BEGIN

PRINT ‘ Table does not exist’

— create a new table

END

Other alternative is write a separate procedure, and check @@ERROR after the execution.

CREATE PROCEDURE CheckTable
AS
SELECT * FROM aTable

USE Northwind
GO
EXEC CheckTable
IF @@ERROR <> 0 BEGIN
PRINT ‘Table does not exist’
— create a new table
END

Q. After removing a table from database, what other related objects have to be dropped explicitly?

A. Referring Stored Procedures and views that refer to the table need to be dropped explicitly.

DROP TABLE removes a table definition and all data, indexes, triggers, constraints, and permission specifications for that table, however, any view or stored procedure that references the dropped table must be explicitly dropped by using the DROP VIEW or DROP PROCEDURE statement.

DROP TABLE cannot be used to drop a table being referenced by a FOREIGN KEY constraint. The referencing FOREIGN KEY constraint or the referencing table must first be dropped.

When a table is dropped, “rules” or “defaults” on it lose their binding, and any constraints or triggers associated with it are automatically dropped. If you re-create a table, you must rebind the appropriate rules and defaults, re-create any triggers, and add all necessary constraints.

You cannot use the DROP TABLE statement on system tables.

If you delete all rows in a table (DELETE tablename) or use the TRUNCATE TABLE statement, the table exists until it is dropped.

Q. You want to check the syntax of a complicated Update SQL statement without executing it. What command should you use?

A. SET NOEXEC ON

When SET NOEXEC is ON, Microsoft SQL Server compiles each batch of Transact-SQL statements but does not execute them. When SET NOEXEC is OFF, all batches are executed after compilation.

The execution of statements in SQL Server consists of two phases: compilation and execution. This setting is useful for having SQL Server validate the syntax and object names in Transact-SQL code when executing. It is also useful for debugging statements that would usually be part of a larger batch of statements.

SET NOEXEC is set at execute or run time and not at parse time.

Q. You are the database developer for a leasing company. Your leasing database includes a lease table that has a column which keeps Social security numbers. Each SSN must be unique. You want the data to be physically stored in order by SSN. What constraint should you add to the SSN column on the lease table?

A. A UNIQUE CLUSTERED constraint should be used to achieve the requirement that the data is physically stored in the order of SSN.

Q. You are designing a database for your company. Your Company has 10 departments and each department has between 25 to 100 employees. Each employee may work for one or more departments. How can you represent this relationship in your ERD (entity relationship diagram)?

A. This is a classic example of a many-to-many relationship. Create a new table entity. Create a one-to-many relation from the employee to the new entity. Create a many-to-one relationship from the entity to the department entity.

You need to create an additional table to act as a junction table to let the many-to-many relationship be translated into two one-to-many relationships.

Q. Mary’s company is a research company that does experiments. Mary’s company database includes an Experiment table. The Experiments table stores all the Experiments and their ID. There is also a Project table, which keeps all the Projects with their ID. How should the database be designed, so that an experiment cannot be repeated in a Project, but a single experiment can belong to more than one Project?

A. Add a column in Experiment table, and name that column ProjectID. For Experiment.ProjectID define a foreign key constraint from Experiment table to Projects Table.

Q. John exports information periodically from a Microsoft SQL Server database to an Oracle Database. What is the best way to do this?

A. Data Transformation Services (DTS) is the best way. Create a DTS package to connect to the Oracle Database and export the information. DTS is discussed in more depth in a later section of the book.

Q. You are designing a database for your human resources department. In the employee table, there is a field for Social Security Number, which cannot contain NULL values. If no value is given, you want a value of UNKNOWN to be inserted in this field. What is the best approach?

A. Create a DEFAULT constraint on the Social Security Number field that will populate the field with a value of UNKNOWN if the Social Security Number is left blank. Remember, this will work only if Social security field does not have uniqe constraint.

Alternately, in the design of the table, you can define a default property for the Social Security Number.

Q. Is it true that rules do not apply to data already existing in a database at the time the rule is created?

A. Yes. Rules do not apply to data already existing in the database at the time the rule is created.

Q. Is it true, that there is no difference between a rule and a check constraint?

A. No, it is false. Rules are a backward compatibility feature that performs some of the same functions as CHECK constraints. CHECK constraints are the preferred, standard way to restrict the values in a column.

Rules do not apply to data already existing in the database at the time the rules are created, and rules cannot be bound to system data types.

Best SQL Server Interview Questions And Answers

Q. Can a rule be bound to any column of any data type?

A. No. Rules cannot be bound to system data types.

Q. What is RAID, and how it can influence database performance?

A. RAID is a redundant array of inexpensive (or independent) disks.

RAID

Configure the database on a RAID 0 drive and then place the transaction log on a mirrored drive (RAID 1).

A hardware disk array improves I/O performance because I/O functions, such as striping and mirroring, are handled efficiently in firmware. Conversely, an operating system-based RAID offers lower cost but consumes processor cycles. When cost is a consideration and redundancy and high performance are required, Microsoft Windows NT(r) stripe sets with parity are a good solution.

Data striping (RAID 0) is the RAID configuration with the highest performance, but if one disk fails, all the data on the stripe set becomes inaccessible. A common installation technique for relational database management systems is to configure the database on a RAID 0 drive and then place the transaction log on a mirrored drive (RAID 1). You can get the best disk I/O performance for the database and maintain data recoverability (assuming you perform regular database backups) through a mirrored transaction log.

If data must be quickly recoverable, consider mirroring the transaction log and placing the database on a RAID 5 disk. RAID 5 provides redundancy of all data on the array, allowing a single disk to fail and be replaced in most cases without system downtime. RAID 5 offers lower performance than RAID 0 or RAID 1 but higher reliability and faster recovery.

Q. You work at the corporate office of a Fortune 500 company that has regional offices in 100 countries. Each regional office maintains its own customer table. This information needs to be brought to the corporate office and merged, to do some analysis for the marketing department. The marketing department also needs to uniquely identify each customer. How should you design the customer table?

A. Use a uniqueidentifier datatype to contain the customer ID.

CREATE TABLE customer(

cust_id uniqueidentifier NOT NULL DEFAULT newid(), company varchar(30) NOT NULL, …

A single globally unique identifier column can be created within each table that contains values unique across all networked computers in the world. A column that is guaranteed to contain globally unique values is often useful when similar data from multiple database systems must be merged (for example, in a customer billing system with data located in various company subsidiaries around the world). When the data is merged into the central site for consolidation and reporting, using globally unique values prevents customers in different countries from having the same billing number or customer ID.

Q. Explain the DBCC PINTABLE command. When would you use it?

A. DBCC PINTABLE is best used to optimize performance from small, frequently referenced tables. The pages for the small table are read into memory the first time they are used, and subsequent references to the data does not require a disk read.

SQL Server does not flush pinned pages when it needs space to read in a new page. DBCC PINTABLE does not cause the table to be read into memory. As the pages from the table are read into the buffer cache by normal Transact-SQL statements, they are marked as pinned pages. SQL Server still logs updates to the page and, if necessary, writes the updated page back to disk. However, SQL Server does keep a copy of the page available in the buffer cache until the table is unpinned with the DBCC UNPINTABLE statement.

Q. There is a table with 100 rows of data. You want to add a new column to the table using the ALTER TABLE command. Which of the following is true?

A.This column can allow Null values

B.This column can be restricted to Not Null

C. This column can be an identity column

A. The answer is both A and C. You can add an identity column to a table that already has existing data.

You can add a column, which allows null. If you want to add a column which does not allow null then you must define a default value for the column.

MS SQL Server Interview Questions And Answers

Q. You have to design a database for a manufacturing plant. Among other things, this database maintains the attendance of the workshop employees who work in 3 shifts. The Attendance table should have a field named ‘Shift’, which stores the shift that the employee worked. The Workshop supervisor should be able to input only 1, 2 or 3 in this field. What is the best design, to implement this requirement?

A. Use a check constraint. Constraints offer a way to have Microsoft SQL Server enforce the integrity of a database automatically. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity, preferred over triggers, rules, and defaults. They are also used by the query optimizer to improve performance in selectivity estimation, cost calculations, and query rewriting. Rules, a backward compatibility feature, also perform some of the same functions as check constraints.

Q. What is a transaction and why is it important?

A. A transaction is a sequence of one or more actions, which together form a logical unit of work. Generally, the actions are interdependent and all must be successfully completed or undone for the database to remain in a consistent state. The popular example of a transaction is a bank account transfer from checking to savings. The money is withdrawn from checking and deposited to savings as one complete unit. It would be an incomplete transaction if the data were removed from checking and the savings information was not updated.

Q. What is deadlock?

A. A deadlock occurs between two processes, when one process is waiting for an object the other process has locked. A thread in a multi-threaded system may acquire one or more resources (locks). If another thread (Thread B) currently owns the resource being acquired, the first thread (Thread A) may have to wait for the owning thread to release the target resource. The waiting thread (Thread B) is said to have a dependency on the owning thread (Thread A) for that particular resource.

If the owning thread (Thread A) wants to acquire another resource that is currently owned by the waiting thread, the situation becomes a deadlock: both threads cannot release the resources they own until their transactions are committed or rolled back, and their transactions cannot be committed or rolled back because they are waiting on resources the other owns.

Deadlocking is often confused with normal blocking. When one transaction has a lock on a resource that another transaction wants, the second transaction waits for the lock to be released. The second transaction is blocked, not deadlocked.

Q. What is a livelock?

A. A livelock occurs when a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.

Q. How you can minimize the deadlock situation?

A. To minimize deadlocks:

Access objects in the same order.

If all concurrent transactions access objects in the same order, deadlocks are less likely to occur. Use stored procedures for all data modifications, to standardize the order of accessing objects.

Avoid user interaction in transactions.

Do not write an application where a user needs to reply a prompt requested by an application during a transaction.

Keep transactions short and in one batch.

When several long-running transactions execute concurrently in the same database, chances of having a deadlock increase. The longer the transaction, the longer the exclusive or update locks are held, blocking other activity and leading to possible deadlock situations.

Use a low isolation level.

Read committed holds shared locks for a shorter duration than a higher isolation level such as serializable.

Use bound connections.

Two or more connections opened by the same application can cooperate. Any locks acquired by the secondary connections are held as if they were acquired by the primary connection, and vice versa, and therefore do not block each other.

SQL Server Interview Questions For Freshers

Q. What is the importance of concurrency control?

A. Managing records so that no more than one person can update a record at any time.

Q. Define Joins.

A. A join is a way of taking the results of one table, view, or query and correlating them with the results of another table, view, or query. Join conditions can be specified in either the FROM or WHERE clauses; specifying them in the FROM clause is recommended. WHERE and HAVING clauses can contain search conditions to further filter the rows selected by the join conditions. Joins can be categorized as inner, outer and cross joins.

Inner joins (the most common join operation, which uses some comparison operator like = or <>). These include equi-joins and natural joins.

Inner joins use a comparison operator to match rows from two tables based on the values in columns from each table.

When executing an INNER JOIN the keyword INNER is optional.

For example, here is an inner join retrieving the authors who live in the same city and state as a publisher:

USE pubs
SELECT a.au_fname, a.au_lname, p.pub_name
FROM authors a
INNER JOIN publishers p
ON a.city = p.city
AND a.state = p.state

ORDER BY a.au_lname ASC, a.au_fname ASC

The tables or views in the FROM clause can be specified in any order with an inner join or full outer join; however, the order of tables or views specified when using either a left or right outer join is important.

SQL Joins Interview Questions And Answers

Q. What is an outer join?

A. A join that includes all rows from the side specified as ‘outer’ regardless of whether there is a matching row or not.

SELECT * FROM

authors a

FULL OUTER JOIN titleauthor ta
ON a.au_id = ta.au_id

Because an outer join includes unmatched rows, you can use it to find rows that violate foreign key constraints.

Q. Define a cross join.

A. This is an example of a Transact-SQL cross join:

USE pubs

SELECT au_fname, au_lname, pub_name

FROM authors

CROSS JOIN publishers

ORDER BY au_lname DESC

The result set contains the number of author rows multiplied by the number of publisher rows. (For example, if authors has 23 rows and publishers has 8; 23 multiplied by 8 equals 184 total rows).

A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table.

However, if a WHERE clause is added, the cross join behaves as an inner join.

Q. How you can change a cross join into an inner join?

A. If a where clause is added to the cross join query it will behave as an inner join.

Q. Define constraints and give an example of their use?

A. Constraints are used to maintain domain and entity integrity in a database.

Types of constraints: NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY.

A NOT NULL constraint would prevent a particular column from having null entries. For example, the Birth Date field in a medical record.

The CHECK constraint will limit a column to values that are defined by the check constraint. For example, a date field could be limited to dates that are greater than or equal to the current date.

A UNIQUE constraint will return an error if a value for a column has been used in another row in the table. This is helpful when you want to enforce that all values are unique, but the column is not the Primary Key, for example, with Drivers License or Social Security Numbers.

A PRIMARY KEY constraint works similarly to the UNIQUE constraint; however, the PRIMARY KEY also impacts the physical storage of the data. SQL Server enforces a PRIMARY KEY constraint with a UNIQUE constraint.

A FOREIGN KEY constraint works similarly to a CHECK constraint, except that for its domain of valid values, it will use the PRIMARY KEY of a table. For example, a database has a BOOKS table and an AUTHORS table. The BOOKS table has an AUTHORID. The AUTHORS table has a PRIMARY KEY called AUTHORID. The BOOKS table could create a FOREIGN KEY constraint that would validate that any AUTHORID entered was already in the AUTHORS table.

SQL Server Query Interview Questions

Q. Write a SQL Query to sort on different column name according to the parameters passed in the function.

A.

CREATE FUNCTION [ListProducts] (@OrderBy int)
RETURNS TABLE
AS

RETURN
(
SELECT productID, ProductName FROM Products
ORDER BY
CASE WHEN @OrderBy = 1 THEN ProductID END,

CASE WHEN @OrderBy = 2 THEN ProductName

END

)

select * from NorthWind.dbo.ListProducts (2)

Q. What is the downside of using UDF?

A. User defined functions are powerful and flexible; however, UDF’s use row-by-row processing, which can be very expensive. Let us see it in detail with an example:

If I have a function, which gives me the day of the week

CREATE FUNCTION GetDayofWeek (@Date Datetime, @Day int)
RETURNS CHAR(12)
BEGIN
RETURN ( SELECT CONVERT (CHAR, DATEADD(dd,-(DATEPART(dw, @Date
) – @Day ), @Date), 101))
END

if I execute these two statements, one with UDF, one with out it.

select top 100 Empid, dbo.GetDayOfWeek (JobDate, 1 ) from Timesheet

select top 100 Empid,

CONVERT (CHAR, DATEADD(dd,-(DATEPART(dw, JobDate ) – 1 ), JobDate), 101)
from Timesheet

SQL Indexes Interview Questions

Q. What is an index?

A. An index is a structure, which provides an efficient method for locating a particular row or set of rows.

It is commonly used to enforce uniqueness constraints.

Q. What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?

A. The preferred way to build indexes on tables is to start with the clustered index and then build the nonclustered indexes. When dropping all indexes, drop the nonclustered indexes first and the clustered index last. That way, no indexes need to be rebuilt.

If a clustered index is created on a table with several secondary indexes, all of the secondary indexes must be rebuilt so that they contain the clustering key value instead of the row identifier (RID). Likewise, if a clustered index is deleted on a table that has several nonclustered indexes, the nonclustered indexes are all rebuilt as part of the DROP operation.

Q. Can a unique index be created on a column, which contains NULL?

A. if a column contains NULL in more than one row, you cannot create a unique index on that column. NULL values are treated as duplicate values for indexing purposes. Therefore, if there is only one row with a null value, a unique index can be created on it, however if more than one row has a NULL value, then a unique index can not be created.

Q. How would you choose between a clustered and a non-clustered index?

A. A clustered index determines the storage order of data in a table. A table can contain only one clustered index.

Before creating clustered indexes, understand how your data will be accessed.

Consider using a clustered index for:

• Columns that contain a limited number of distinct values, such as a state column that contains only 50 distinct state codes. However, if there are very few distinct values, such as only 1 and 0, no index should be created.

• Queries that return a range of values using operators such as BETWEEN, >, >=, <, and <=.

• Columns that are accessed sequentially.

• Queries that return large result sets.

• Columns that are frequently accessed by queries involving join or GROUP BY clauses; typically these are foreign key columns.
• Column(s) specified in the ORDER BY or GROUP BY clause. This eliminates the need for SQL Server to sort the data because the rows are already sorted.
• OLTP-type applications where very fast single row lookup is required, typically by means of the primary key. Create a clustered index on the primary key.

Clustered indexes are not a good choice for:

• Columns that undergo frequent changes. When columns change that are part of a clustered index, the entire row moves because SQL Server must keep the rows data values in physical order. This is an important consideration in high-volume transaction processing systems where data tends to be volatile.

• Covered queries. The more columns within the search key, the greater the chance for the data in the indexed column to change, resulting in additional I/O.

Q. Your table has a large character field. There are queries that use this field in their search clause. What should you do?

A. Creating indexes on very large fields is not advisable. SQL Server 2000 provides a new function CHECKSUM, which computes a checksum on a row or a column, and its value is always a 4 byte integer. You can create a computed column to be the checksum of your large character field and then build an index on that computed column. The values returned by CHECKSUM are not guaranteed to be absolutely unique, but there will be few duplicates. Since there is the possibility of two character string values having the same value for the checksum, your queries will need to include the full string that you’re looking for.

DROP INDEX titles.titleind
GO

ALTER TABLE titles
ADD check_title AS CHECKSUM(title)
GO

CREATE INDEX check_title_index ON titles(check_title)
GO

SELECT *
FROM titles
WHERE title = ‘Straight Talk About Computers’
AND check_title =
CHECKSUM(‘ Straight Talk About Computers’)

SQL Server Interview Questions PDF

Q. What is a fill factor?

A. When creating an index, you can specify a fill factor to leave extra gaps and reserve a percentage of free space on each leaf level page of the index to accommodate future expansion in the storage of the table data and reduce the potential for page splits. The fill factor value is a percentage from 0 to 100 that specifies how much to fill the data pages after the index are created.

Q. When you should use a low fill factor?

A. A large number of unique values and data is updated often dictate that the fill factor should be low and the index should be non-clustered.

If data is changing very frequently, keep the fill factor low (75%) so less page splits will take place, which will increase the performance.

Q. What are statistics?

A. Statistics determine the selectivity of the indexes. If an indexed column has unique values then the selectivity of that index is more, as opposed to an index with non-unique values. Query optimizer uses these statistics in determining whether to choose an index or not while executing a query.

Some situations under which you should update statistics:

1) If there have been significant changes in the key values in the index

2) If a large amount of data in an indexed column has been added, changed, or removed (that is, if the distribution of key values has changed), or the table has been truncated using the TRUNCATE TABLE statement and then repopulated

3) The database has been upgraded from a previous version

SQL 2000 provides auto updating of statistics.

Q. What is clustering?

A. Clustering is physically ordering the rows of table to match the order of the index.

Q. What is the difference between DBCC INDEXDEFRAG and DBCC REINDEX?

A. DBCC REINDEX drops the index and creates the index again. DBCC INDEXDEFRAG is an online operation, it does not hold long-term locks that can block running queries or updates. With INDEXDEFRAG the index is always available, unlike DBREINDEX.

DBCC INDEXDEFRAG can be considerably faster than running DBCC DBREINDEX on a relatively unfragmented index, but a large amount of fragmentation can cause INDEXDEFRAG to run considerably longer than DBREINDEX, which may or may not outweigh the benefit of its online capabilities.

To improve the clustering of pages, rebuild the index.

DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. It can rebuild all of the indexes for a table in one statement.

DBCC DBREINDEX is not supported for use on system tables.

Q. How you can find out if an index is useful to the optimizer?

A. DBCC SHOW_STATISTICS (table, target)

The results returned indicate the selectivity of an index and provide the basis for determining whether an index is useful to the optimizer. The lower the density returned, the higher the selectivity.

Q. Where are full-text indexes stored?

A. Full-text indexes are stored in the server’s file system. Regular SQL indexes are stored in the database in which they are defined.

Q. How many full-text indexes can a table have?

A. One. Each table can have only one full-text index. Each table can have several regular SQL indexes.

Q. Indexes are updated automatically. Is the full-text index also updated automatically?

A. No. Full-text indexes are not updated automatically.

Q. How is a full-text index updated?

A. Full-text indexes are not updated automatically. The stored procedure sp_fulltext_catalog must be run to update the full-text indexes. Regular SQL indexes are updated automatically as data is modified.

Full-text indexes are grouped into a catalog of full-text indexes for the database in which the index is defined. Regular SQL indexes are not grouped.

Full-text indexes are created, managed, and dropped via stored procedures.

SQL Server Interview Questions By Shivprasad Koirala

Q. Can you force a query to use a specific Index?

A. Yes, by using index hints.

SELECT fname, lname
FROM emps (INDEX (idx_fname, idx_lname))

Q. Which data type columns are the best candidates for full-text indexing?

A. Datatypes text and varchar are the best candidates for full-text indexing.

Q. When would you prefer to have a minimum number of indexes?

A. In an OLTP application, you want a minimum number of indexes. An online transaction processing (OLTP) database is typically characterized by having a large number of concurrent users’ actively adding and modifying data.

Indexes must be updated each time a row is added or modified. To avoid over indexing heavily updated tables, keep indexes narrow.

Q. Why is there a performance difference between two similar queries where one uses UNION and the other uses UNION ALL?

A. The UNION query has to sort all of the results and remove any duplicate rows, this step is performed even if there are no duplicated rows in the results. The UNION ALL query bypasses the sort step and will use the indexes you have on the individual tables.

The UNION operator allows you to combine the results of two or more SELECT statements into a single result set. Result sets combined using UNION must have the same structure. They must have the same number of columns, in the same order, and the corresponding result set columns must have compatible data types.

Q. What is the difference between OPENROWSET and OPENQUERY?

A. Both of these functions execute a pass-through Query on the given linked server. OPENROWSET, Includes all connection information necessary to access remote data from an OLE DB data source. This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data using OLE DB. Both the functions can be referenced in the FROM clause of a query as though it is a table name. Although the query may return multiple result sets, but these functions returns only the first one.

OPENQUERY is the preferred way, OPENROWSET has to have connection information, password, and user name hard coded into T-SQL, which makes it vulnerable to breaking, if ever the connection information changes. Writing passwords in connection string text also increase the chance of security breaches.

Q. How you can add messages to the NT event log from within a stored procedure?

A. XP_logevent will log a user-defined message into the SQL Server™ log file and the Microsoft Windows NT Event Viewer. xp_logevent can also be used to send an alert without sending a message to the client.

Q. What are three ways you can use an identity value inside a trigger? Why would you prefer one way over another?

A. There are three ways to get an Identity value. IDENT_CURRENT(), SCOPE_IDENTITY() and @@IDENTITY. All three return last-generated identity values. However, the scope and session make the result different in each of these functions.

Q. How can I get the name of the first day of the month using SQL Query?

A. SELECT DATENAME (dw, CAST(DATEPART ( mm,GETDATE()) AS CHAR(2)) + ‘/1’ + ‘/’ + CAST(DATEPART (YYYY,GETDATE()) AS CHAR(4)))

Q. How can I return the name of last day of the current month using SQL Query?

A. This is a little more interesting. The easiest way to do this is with a small trick. Divide and conquer. If the current month is December, return the DATENAME value for 12/31 concatentated with the current year. If the month is not December, return the value for the first of the next month, then substract one to return the last day of the previous month. This will return the last day of the current month and will automatically take into account leap years and leap centuries as well as months that just do not have 31 days.

SELECT
CASE
WHEN DATEPART ( mm,GETDATE()) = 12 THEN

DATENAME(dw, CAST( ’12/31/’ + CAST((DATEPART (YYYY,GETDATE())) AS VARCHAR(4)) AS DATETIME) – 1)
ELSE

DATENAME(dw, CAST(CAST((DATEPART ( mm,GETDATE())+1) AS VARCHAR(2)) + ‘/1’ + ‘/’ +
CAST((DATEPART (YYYY,GETDATE())) AS VARCHAR(4)) AS DATETIME) – 1)
END

SQL Views Interview Questions And Answers

Q. List some of the rules that apply to creating and using a ‘view’.

A. When creating and using a view, these rules apply:

CREATE VIEW statements cannot be combined with other SQL statements in a single batch.

You cannot create a trigger on a view.

Data modification statements (INSERT or UPDATE) are allowed on multi-table views if the data modification statement affects only one base table. Data modification statements cannot be used on more than one table in a single statement.

INSERT statements are not allowed if a computed column exists within the view.

All column(s) being modified must adhere to all restrictions of the base table. This applies to column nullability, constraints, identity columns, and columns with rules and/or defaults and base table triggers.

UPDATE statements cannot change any column in a view that is a computation, nor can they change a view that includes aggregate functions, built-in functions, a GROUP BY clause, or DISTINCT.

You cannot use READTEXT or WRITETEXT on text or image columns in views.

Q. You added a row to a view, but the row is not shown on the view.

Explain how this can happen, and how you can remedy the situation.

A. By default, data modification statements on views are not checked to determine whether the rows affected will be within the scope of the view. You can issue an INSERT statement on a view to add a row to the underlying base table, but not to add it to the view. Similarly, you can issue an UPDATE statement that changes a row so that the row no longer meets the criteria for the view. If all modifications should be checked, use the WITH CHECK option.

For example, if you insert a value of ‘AAA’ into a view that only returns values that are LIKE ‘B%’. This would not be allowed if the WITH CHECK option was in place.

SQL Query Interview Questions And Answers

Q. Can an ORDER BY clause be used in a creation of a view?

A. Yes, but only if the TOP clause is also used.

For example:

CREATE VIEW [ORDERBYVIEW] AS
SELECT TOP 10 customerID, companyname
FROM customers
ORDER BY companyname

The ORDER BY clause is invalid in views, inline functions, derived tables, and subqueries, unless TOP is also specified.

Q. ‘Order by’ is not allowed in a view. How can you sort information from a view?

A. Using ‘SELECT TOP’ you can have a view sorted in the desired order, for e.g.

CREATE VIEW vAuthors AS
SELECT TOP 100 PERCENT au_lname, au_fname
FROM Authors ORDER BY au_lname
GO

SELECT * vAuthors

FROM GO

Q. What is a derived Table?

A. Derived tables are a SELECT statement that you use in a FROM clause in place of tables references.

Transact-SQL has extensions that support the specification of objects other than tables or views in the FROM clause. These other objects return a result set, or rowset that form a virtual table. The SELECT statement then operates as if the result set were a table.

These virtual tables can help you in executing certain queries that are not possible without having a view or a temp table.

SELECT au_lname, au_fname , royaltyper
FROM (SELECT A.au_lname, A.au_fname, TA.royaltyper
FROM Authors A
JOIN TitleAuthor TA on
A.au_id = TA.au_id
WHERE state = ‘CA’)
ORDER BY au_lname

Q. What are Information Schema Views?

A. Information Schema Views are objects that provide indirect access to the data in the system catalogs.

SQL server provides a number of views for accessing the system catalogs. These objects provide meta data and system level information from the server. You should always use these views instead of querying system catalog tables directly.

These views are ANSI SQL-92 compliant, so you can depend up on them, even if SQL server internal tables or their structure will change; these views should remain consistent.

You must refer to these views using INFORMATION_SCHEMA database schema. These views reside in MASTER database, but they run in the context of the current database.

USE pubs
SELECT *
FROM INFORMATION_SCHEMA.TABLES

Q. What is a partitioned view?

A. A partitioned view is a view that unites tables together making the data appear as it is from one table. For example for a large internet site may use a partitioned view to unite twelve tables for the year. Every month would have a separate table. Using portioned views would allow these tables to be treated as a single table.

There are two types of partitioned views: Local Partitioned View (LPV) and Distributed Partitioned View (DPV). In a local partitioned view, all participating tables and the view reside on the same instance of SQL Server. In a distributed partitioned view, at least one of the participating tables resides on a different (remote) server.

Q. What is an Indexed View?

A. A View is a conceptual table that is sometimes called a virtual table. Views do not store any data. The result set of a non-indexed view is not stored permanently in the database. Each time a query references the view, SQL Server dynamically merges the logic needed to build the view result set with the logic needed to build the complete query result set from the data in the base tables.

The overhead of dynamically executing query and building the result set can be substantial for views that involve complex processing of large numbers of rows.

Indexed views have the answer to this. If complex views are frequently referenced in queries, you can improve performance by creating a unique clustered index on the view. When a unique clustered index is created on a view, the view is executed and the result set is stored in the database in the same way a table with a clustered index is stored.

SQL Server DBA Interview Questions

Q. How you can get a list of all the table constraints in a database?

A. SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE.

See the question on ANSI SQL Schema view for detail.

SQL Server Administration Interview Questions

Q. How you can get the list of largest tables in a database?

A. System table ‘sysindexes’ has all the information, you need.

SELECT object_Name (id) , dpages * 8
FROM sysindexes
WHERE indid in (1,0) AND objectproperty (id, ‘IsUserTable’) = 1 ORDER BY rowcnt desc

Q. How you can move data or databases between servers and databases in SQL Server?

A. Some of the options you have are: BACKUP/RESTORE, detaching and attaching databases, replication, DTS, BCP, log shipping, INSERT…SELECT, SELECT…INTO, creating INSERT scripts to generate data.

Q. If no size is defined while creating the database, what size will the database have?
A. The size of the model database determines the initial size of a database if no size is indicated in the CREATE DATABASE statement.

Q. Can a database be shrunk with users active?

A. Yes. Users can be working in the database when it is shrunk. This includes system databases.

Q. How can you set the database to single user mode and restrict the access to dbo use only?

A. In SQL Server 2000, a database cannot be in single-user mode with dbo use only. Instead, the following alternative options are available by using the ALTER DATABASE command:

ALTER DATABASE database SET SINGLE_USER.

This command restricts access to the database to only one user at a time.

ALTER DATABASE database SET RESTRICTED_USER.

This command restricts access to the database to only members of the db_owner, dbcreator, or sysadmin roles.

ALTER DATABASE database SET MULTI_USER.

This command returns access to the database to its normal operating state.

Q. As a general practice, it is recommended to have dbo be the owner of all database objects. However, in your database you find number of tables owned by a user other than dbo, how could you fix this?

A. One alternative is

DECLARE
@TableName varchar (50)

DECLARE TableCur CURSOR FOR
SELECT NAME FROM sysobjects WHERE xtype = ‘U’

OPEN TableCur

FETCH NEXT FROM TableCur into @TableName WHILE @@FETCH_STATUS = 0
BEGIN

SELECT @TableName = ‘OLDUSERNAME.’ + @TableName EXEC sp_changeobjectowner @TableName , ‘dbo’ FETCH NEXT FROM TableCur into @TableName
END

CLOSE TableCur
DEALLOCATE TableCur

SQL Server DBA Interview Questions And Answers For Experienced

Q.How you can list all the indexes for a table in a database?

A.

DECLARE
@TABLENAME varchar(255)
select @TABLENAME =’Application’

select sysindexes.name, ‘TableName’ = sysobjects.name, ‘INDEX-TYPE’ =

CASE
WHEN indid = 1 THEN ‘clusterd’
WHEN indid > 1 THEN ‘non-clustered’

END
from sysindexes JOIN sysobjects on
sysindexes.id = sysobjects.id
where sysobjects.name = @TABLENAME
and sysobjects.xtype = ‘U’
and indid < 255

Q. Why does a SQL statement work correctly outside of a user-defined function, but incorrectly inside it?

A. You may have included a statement in the BEGIN-END block that has side effects, which are not allowed in user-defined functions. Function side effects are any permanent changes to the state of a resource that has a scope outside the function. Changes can be made only to local objects such as local cursors or variables. Examples of actions that cannot be performed in a function include modifications to database tables, operations on cursors that are not local to the function, sending e-mail, attempting a catalog modification.

Q. Can a table be moved to different Filegroup?

A. Once a table is created it cannot be moved to a different file group.

Q. Can a database be shrunk to 0 Bytes, if not, why?

A. A database cannot be shrunk smaller than the Model system database, which starts at 1.5 MB.

SQL Server does not shrink a database to a size any smaller than the size that was specified in the CREATE DATABASE statement.

Q. What does the Automatic recovery do?

A. The automatic recovery process is initiated when the SQL Server service starts to insure that all databases are consistent. It rolls forward any committed transactions that have not been written to the database and rolls back any uncommitted transactions.

Q. Can an automatic recovery be initiated by a user?

A. Automatic recovery is performed by the SQL Server Service when the SQL server restarts, It cannot be initiated by a user.

Q. What is the primary use of the model database?

A. The model database is used as a template for all new user databases. Users do not use the model database. Template can include specific settings, security constructs and all sorts of useful stuff.

Q. What information is maintained within the msdb database?

A. The msdb database contains information about tasks, alerts, and operators for both user-defined tasks and tasks related to replication.

SQL Server Administration Interview Questions And Answers

Q. What stored procedure can you use to display the current processes?

A. The stored procedures sp_who and sp_who2 can be used to display the current processes as well as which process is blocking another process.

Q. What stored procedure would you use to view lock information?

A. The stored procedure sp_lock can be used to obtain information about all locks or about locks affiliated with a specific process ID.

Q. How can a database be repaired?

A. DBCC CHECKDB is the safest repair statement because it catches and repairs the widest possible range of errors. If only allocation errors are reported for a database, execute DBCC CHECKALLOC with a repair option to correct them.

DBCC CHECKDB is a superset of DBCC CHECKALLOC and includes allocation checks in addition to checks of index structure and data integrity.

DBCC CHECKTABLE checks the linkages and sizes of text, ntext and image pages for the specified table. However, DBCC CHECKTABLE does not check the allocations of pages in the specified table. Use DBCC CHECKALLOC to check page allocations.

DBCC CHECKTABLE requires a shared lock on all tables and indexes in the database for the duration of the operation.

To perform DBCC CHECKTABLE on every table in the database, use DBCC CHECKDB.

Q. How can you find out if the current user is a member of the specified Microsoft® Windows NT® group or Microsoft SQL Server™ role?

A. The Is_Member function.

IS_MEMBER ({group | role})

Q. Your SQL Server is running out of disk space. You notice that there are several large files with LDF extensions. What are these files?

A. LDF files are the database log files.

Q. You notice that the transaction log on one of your databases is over 4GB. The size of the data file is 2MB. What could cause this situation, and how can you fix it?

A. A large transaction log can mean several things. It is helpful to know if the log grew slowly over time or all at once. It is possible that an exceptional number of transactions occurred quickly, thereby increasing the size of the log. It is also possible that the log was set up to grow automatically and has never been truncated or shrunk. Should check for a stuck transaction too.

Q. You accidentally delete the MSDB database. What effect does this have on your existing SQL databases, and how do you recover?

A. Your ability to use SQL Server Agent to schedule alerts, jobs, and recording operators has been eliminated. To recover from this situation, restore the MSDB database from a backup.

Q. Where can you add custom error messages to SQL Server?

A. Custom messages can be added to the sysmessages table in the master database.

Q. Is it important for a Database Administrator to understand the operating system and file access?

A. You should answer this one honestly for you. Different companies have different philosophies on this, and no answer is correct for all situations.

Q. What is the difference between writing data to mirrored drives versus RAID5 drives.

A. The difference is performance. RAID5 drives can be much slower than writing to a mirrored drive set. This is due to the overhead of computing and writing the check data that is needed for recovery.

Important SQL Queries Asked in Interviews

Q. In the physical file layout, where should the transaction log be stored in relation to the data file?

A. For up to the minute restorations, the transaction log should be stored on a different physical drive as the data file.

Q. You have separate development and production systems. You want to move a copy of a development database into production. To do this, you do a backup on the development system and restore to the production system. After a few minutes, you begin getting calls from several customers saying that they are denied access to the system. Why?

A. When the restore happened, you also restored the security from the development system onto the production system. The customers do not have access to the development system. One way to avoid this is to script out all the security in the production database prior to doing the restore and then to reapply the security after the restore.

Q. What is a mixed extent?

A. A mixed extent is a single extent that contains multiple tables. Extents are the basic unit in which space is allocated to tables and indexes.

To make its space allocation efficient, SQL Server does not allocate entire extents to tables with small amounts of data. SQL Server has two types of extents:

Uniform extents are owned by a single object; all eight pages in the extent can only be used by the owner object.

Mixed extents are shared by up to eight objects.

Q. You have a table with close to 100 million records. Recently, a huge amount of this data was updated. Now, various queries against this table have slowed down considerably. What is the quickest option to remedy the situation?

A. Run the UPDATE STATISTICS command.

UPDATE STATISTICS will update the statistics for the table. The sp_updatestats stored procedure will update all the tables in the database, which is not required in the situation. There is no need to recreate the index, as the updating statistics should be first step to see the query reached to the optimized level of speed.

Once the statistics have been updated, the query analyzer will be able to make better decisions about which index to use.

If Auto update Statitics is on, then you don’t have to do any of this.

Q. How can you check the level of fragmentation on a table?

A. DBCC SHOWCONTIG. To display fragmentation information for the data and indexes of the specified table, use DBCC SHOWCONTIG. See SQL Server Books On-Line for additional information.

Q. You have developed an application which uses many stored procedures and triggers to update various tables. Users ocassionally get locking problems. Which tool is best suited to help you diagnose the problem?

A. SQL Server Profiler. Use SQL Server Profiler with a trace to observe Lock conflicts.

Q. Which table keeps the locking information?

A. SysLockInfo contains information on all granted, converting, and waiting lock requests. This table is a denormalized tabular view of internal data structures of the lock manager and is stored only in the master database.

Q. You want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables. Which other statement will keep the database in good condition?

A. Execute the Update Statistics command for tables that are accessed in the query. Update Statistics updates information about the distribution of key values for one or more statistics groups in the specified table. UPDATE STATISTICS is run automatically when an index is created on a table that already contains data.

The stored procedure Sp_Updatestats will update statistics for all the tables in the current database.

Complex SQL Server Interview Questions And Answers

Q. During a recent migration project, John inserted 10,000 records in a table that has an Identity Column called ticketID, which automatically increases by 1 each time a record is inserted in the table. A month after the database went live; John noticed that record with ticketID 5123 has some incorrect information. So John deletes this record and decides to re-insert this record in the table. He wants to re-use the ticketID 5123. He needs to achieve this while the database is in production. What should he do?

A. John can do this with the following code:

SET IDENTITY_INSERT Tickets ON
GO

INSERT INTO Tickets ( ticketID, FirstName, LastName)
Values (5123, ‘John,Doe)
GO

Set IDENTITY_INSERT Tickets ON allows explicit values to be inserted into the identity column of a table.

Q. Jenny wants to export data to Pivot table in Excel spreadsheet from a table in SQL Server. This data changes frequently. She wants to automate the process of updating the Excel spreadsheet using the SQL Job Scheduler. What tool is the best choice for the task?

A. Use Data Transformation Services (DTS) to populate the spreadsheet. Using DTS you can import and export data between heterogeneous sources. DTS is covered in depth later in the book.

Q. You have written an application in VB which uses SQL 7 for its database. You have used many stored procedure and triggers to make your application fast. However, users complain that saving records take too much time. To rectify the problem, you start the profiler and create a trace using the trace wizard. How would you go about identifying the cause of the problem?

A. Find the worst performing query. As you know from the users that the problem is in while saving the record, find the worst performing query. You can create a trace that captures events relating to T-SQL event classes, specifically RPC:Completed and SQL:BatchCompleted. Include all data columns in the trace, group by duration, and specify event criteria, for example, that the duration of the event must be at least 1,000 milliseconds. This event criterion eliminates short-running events from the trace. The duration minimum value can be increased as required. If you want to monitor only one database at a time, specify a value for the database ID event criteria. Use the find the worst performing queries option in the Create Trace Wizard to automatically create this trace definition.

Q. You have a table with employee information that rarely changes. However this table is used from many applications in the organization to validate the data and to produce reports. What would be the optimal fill factor to choose for indexes created on this table?

A. 100. Tables that rarely change can use fill factor of 100%. More frequent change requires low fill factor. If you set fill factor to 100, SQL Server creates both clustered and nonclustered indexes with each page 100 percent full. Setting fill factor to 100 is suitable only for read-only tables, to which additional data is never added.

The default for fill factor is 0. Smaller fill factor values cause SQL Server to create new indexes with pages that are not full. For example, a fill factor value of 10 is a reasonable choice if you are creating an index on a table that you know contains only a small portion of the data that it will eventually hold. Smaller fill factor values cause each index to take more storage space, allowing room for subsequent insertions without requiring page splits.

Since the table in question keeps the employee information and will be changed rarely, only when an employee leaves the company or a new employee joins the company, which is a rare occurrence not a daily or weekly occurrence. It is safe to have this table with 100% fill factor.

Q. What is the difference between a fill factor of 100 and 0?

A. The fill factor value is a percentage from 0 to 100 that specifies how much to fill the data pages after the index is created. A value of 100 means the pages will be full and will take the least amount of storage space. This setting should be used only when there will be no changes to the data, for example, on a read-only table. A lower value leaves more empty space on the data pages, which reduces the need to split data pages as indexes grow but requires more storage space. This setting is more appropriate when there will be changes to the data in the table. A value of 0 behaves like 100 but leaves some extra space in the upper level of the data tree.

Q. How will you know when statistics on a table are obsolete?

A. Looking at the query plan and look at the numbers for ‘Estimated Row count’ and ‘Row Count’, if the difference is very big, say more than double or three times, it means the statistics are obsolete on the table. You should run update statistics on the table to make the statistics current.

Q. Explain different backup plans.

A. Full database backup, which backs up the entire database including the transaction log.

Differential database backup performed between full database backups. You cannot perform a differential backup, if you have not already done the full database backup. Differential backup backs up all the data since the last Full backup.

Transaction log backup or incremental backup.

File(s) and Filegroup(s) backup.

Use BACKUP to back up database files and filegroups instead of the full database when time constraints make a full database backup impractical. Separate transaction log backups must be performed. After restoring a file backup, apply the transaction log to roll the file contents forward to make it consistent with the rest of the database.

Q. What is a full backup?

A. A full database backup copies all the pages from a database to a backup device; it can be a local disk file or a network disk file, a local tape drive. SQL Server also copies the portion of the transaction log that was active while the backup was in process.

Q. Explain a differential backup.

A. A differential backup copies only the extents that have changed since the last full backup. Generally, you make several differential backups between full backups, and each differential backup contains all the changes since the last full backup.

SQL Server 2000 tells which extents need to be backed up by examining a special page called the Differential Changed Map (DCM) in each file of the database. A file’s DCM contains a bit for each extent in the file. Each time you make a full backup, all the bit values revert to 0. When any page in an extent is changed, the page’s corresponding bit in the DCM page changes to 1. SQL Server copies the portion of the transaction log that was active during the backup.

Q. Explain an incremental backup.

A. A database has a transaction log that records data modifications made in the database. The log records every transaction. A transaction log backup copies all the log records that SQL Server has written since the last log backup. Even if you’ve made full database backups, a log backup always contains all the records since the last log backup.

Exact behavior of the BACKUP LOG command depends on your database’s recovery-model setting. If the database is using the full recovery model, the BACKUP LOG command copies the entire contents of the transaction log. If the database is using the simple recovery model, you cannot perform a log backup because the log is truncated regularly.

In the bulk_logged recovery model, a transaction log backup copies the contents of the log and all the extents containing data pages that bulk operations have modified since the last log backup.

In a typical scenario, an administrator would make a series of log backups between full database backups, with each log backup containing only the log records recorded since the last log backup.

Q. What is Log shipping?

A. Log shipping increases a SQL Server database’s availability by automatically copying and restoring the database’s transaction logs to another database on a standby server. Because the standby database receives all changes to the original database, it’s an exact duplicate of the original database—out of date only by the delay in the copy-and-load process.

Log shipping is better than replication in some scenarios. For example, after a switchover, you need to know exactly which transactions the standby server holds. When you use replication that information is not available, and you have to be willing to lose a certain number of transactions. However, when you use log shipping, you can find out which transactions the standby server holds because you know the last point of consistency.

Q. Every night you run a full backup. After every 3 three hours you make a differential backup. Every hour you make an incremental backup. In a worst-case scenario, how much work you can lose?

A. In the worst case you will loose, one hour of work, as every hour you take incremental backup.

Q. Explain a Checkpoint?

A. A Checkpoint is essentially a bookmark for activity in the database transaction log. A database has a transaction log that records data modifications made in the database. The log records every transaction. SQL Server stores enough information in the log to either redo (roll forward) or undo (roll back) the data modifications that make up a transaction

As writing data on disk is a slow process, SQL Server caches modifications in buffers for a period of time to optimize disk writes. A page in this cached buffer is known as a dirty page. Writing this dirty buffer page to disk is called flushing the page. In SQL Server, first log images are written to disk before the corresponding data modification.

A commit operation writes all log records for a transaction to the log file. A commit operation does not have to force all the modified data pages to disk as long as all the log records are flushed to disk. A system recovery can roll the transaction forward or backward using only the log records.

Periodically, SQL Server ensures that all dirty log and data pages are flushed. This is called a checkpoint.

Q. Explain an Automatic Checkpoint.

A. By default SQL Server always generates automatic checkpoints. The interval between automatic checkpoints does not depend on time but on the number of records in the log.

The interval between automatic checkpoints is calculated from the ‘recovery interval’ server configuration option. This option specifies the maximum time SQL Server should use to recover a database during a system restart. SQL Server estimates how many log records it can process in the recovery interval during a recovery operation. The interval between automatic checkpoints also depends on whether or not the database is using the simple recovery model.

If the database is using the simple recovery model, an automatic checkpoint is generated whenever the log becomes 70 percent full or the number of log records reaches the number SQL Server estimates it can process during the time specified in the recovery interval option.

If the database is using either the full or bulk-logged recovery model, an automatic checkpoint is generated whenever the number of log records reaches the number SQL Server estimates it can process during the time specified in the recovery interval option.

Automatic checkpoints truncate the unused portion of the transaction log if the database is using the simple recovery model. The log is not truncated by automatic checkpoints if the database is using the full or bulk-logged recovery models.

Tricky SQL Queries For Interview

Q. How you can list all the tables in a database?

A. SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES

Or

SELECT name FROM sysobjects WHERE type = ‘U’

The first query will tell you all table name plus system tables and views too.

Q. How can you list all the columns in a database?

A. SELECT * FROM INFORMATION_SCHEMA.COLUMNS

Q. How can you list all the table constraints in a database?

A. SELECT * FROM INFORMATION_SCHEMA. TABLE_CONSTRAINTS.

Q. What are the advantages DTS has over bcp?

A. DTS has many functions that bcp does not provide, Moving data between:

SQL Server and non-SQL Server databases.

Two different kind of ODBC data sources.

DTS contains functions for modifying and transforming data fields during the bulk copy operation.

DTS can copy other objects (views, stored procedures, constraints, rules, user defined datatypes and user defined function etc ) between two SQL database . It can copy even indexes and triggers between two sql databases.

Q. How do you rebuild an identity column?

A. DBCC CHECKIDENT

Q. How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (CSV) file? Or how can you import data from MS Access to a table in a database? Or how can you export data from a table to an Excel file?

A. To transfer data from a text file to a database table or vice versa use DTS.

Open SQL server enterprise manager, right click on a database, and choose ‘All Tasks’ and then ‘Import task’. Follow the instruction on the DTS wizard.

You should practice couple of scenarios before you go for an interview as it often happens that you may asked to perform these tasks.

Q. When does the auto update index statistics feature in SQL server turn itself on?
A. If the number of rows in a table are greater than 6, but less than or equal to 500, then statistics are automatically updated when there have been 500 modifications made.

If the number of rows in the table is greater than 500, then updates are automatically made when (500 plus 20 percent of the number of rows in the table) has been modified.

For addtioinal information refer to http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q195565&.

Q. What specific conditions database should meet, before you can Bulk copy data into it using BCP.

A.First is Select into/bulk copy option should be activated on the database. You can reach to this option by right clicking on the database and choosing property option.

Second, the destination table should be free of indexes.

SQL Replication Interview Questions

Q. What is database replication? What are the different types of replication you can set up in SQL Server?

A. Replication is the process of copying/moving data between databases on the same or different servers.

SQL Server supports the following types of replication scenarios:

Snapshot replication

Transactional replication (with immediate updating subscribers, with queued updating subscribers)

Merge replication

All these different kind of replications are very well defined in ‘Books on line’, please Refer to BOL for further detail.

Q. Which database stores information about replication?

A. The master database stores information about replication. The master and distribution databases keep all information about tables used in replication. See System Tables in books online. MSDB has information about the replication jobs.

Q. Your company has 50 branches all over the country. All the branches, including the Head Office have SQL Server as the database. Every night all 50 branches upload certain information to the Head Office. Which Replication topology is best suited for the above scenario?

A. Central Subscriber is the best topology for this scenario. In a Central Subscriber scenario, a number of Publishers replicate information into a common destination table at a Subscriber. The destination table is partitioned horizontally and contains a location-specific column as part of the primary key. Each Publisher replicates rows containing location-specific data.

This replication configuration may be useful, for example, for rolling up inventory data from a number of servers at local warehouses into a central Subscriber at corporate headquarters. It could also be used to roll up information from autonomous business divisions within a company, or to consolidate order processing from dispersed locations.

Q. Which of the following option(s) is(are) an inappropriate usage of merge replication: a company time sheet database, a static look up table, a high transaction based application that requires real time replication to subscribers or a company information price list that is updated at remote sites and replicated to a central database.

A. The static look up table and high transaction based applications that require real time replication to subscribers are not good candidates for merge replication.

Static look up tables are most effective with snap shot replication. High transaction based applications that require real time replication are best implemented with transactional replication.

SQL Server Interivew Questions For Experienced

Q. What are the restraints imposed on the table design by a Merge Replication?

A. You should not use a timestamp column in the table. Merge replication does not support timestamp columns. Timestamp values are generated automatically by the local server and guaranteed unique within a specific database only. Therefore, it is impossible for a change to the timestamp value created at one server to be applied to the timestamp column at another server. You must remove the timestamp column from any table you want to publish using merge replication.

SQL Security Interview Questions

Q. A user is a member of the Public role and the Sales role. The Public role has select permission on all the tables. The Sales role does not have select permission on some of the tables. Will the user be able to select from all tables?

A. No, the user will not be able to select information from tables. Permissions assigned to a role supercede those assigned to the role Public. This is true whether permissions assigned to the role are more restrictive or less restrictive than those assigned to the role Public.

Q. If a user does not have permission to a table, but has permission to a view created on it, will he be able to view the data in table?

A. Yes. The user permission for the object referenced by a view is ignored. If a user does not have select permission on the table, but if he has permission on the view based on same table, he can select from the view.

In this case, view and table must belong to the same owner, if the table owner is different then the view owner, then user will not be able to select on view. The owner of the view must own the table also for the above scenario.

Q. A user has not been given a user account for any database, but has a valid login in the SQL server. Can he use the database?

A. Any user who has not been given a User Account for a database will be allowed to use permissions assigned to the User Account guest. Thus, if a user has a valid Login ID for an SQL Server but has not been assigned to a database role or given a User Account for the database, the user has access via the account guest.

A user who has been given a User Account for a database will automatically be a member of the database role public. The user may also be assigned to other database roles.

Q. Tony works in the Sales Department and has created a table named OrderDetail for the Sales department. You write a stored procedure which will help Mark, a sales representative, update the OrderDetail table. However, when Mark uses the stored procedure he gets an error. You realize that this is a security issue. What is required to enable Mark to use your stored procedure?

A. You must assign EXECUTE permission to Mark on your stored procedure, and Tony must assign UPDATE permission on the Table. For tables and views, the owner can grant INSERT, UPDATE, DELETE, SELECT, and REFERENCES permissions, or ALL permissions. A user must have INSERT, UPDATE, DELETE, or SELECT permissions on a table before they can use it in any INSERT, UPDATE, DELETE, or SELECT statements.

The owner of a stored procedure can grant EXECUTE permissions for the stored procedure. If the owner of a base table wants to prevent users from accessing the table directly, they can grant permissions on views or stored procedures referencing the table, but not grant any permissions on the table itself.

The REFERENCES permission lets the owner of another table use columns in your table as the target of a REFERENCES FOREIGN KEY constraint from their table.

You can eliminate this problem by having dbo own all objects in a database. In that case, the only thing you would need to have done was to grant Mark execute permissions to the stored procedure.

SQL Transactions Interview Questions

Q. Define Concurrency Control.

A. Concurrency Control is the practice of defining controls so that multiple users can use and update data in a database simultaneously. In a multi-user system, we require some kind of mechanism to protect one-person change adversely affecting the others change. There are two main types of concurrency control, Optimistic Concurrency Control, and Pessimistic Concurrency Control.

Q. What is Pessimistic Concurrency Control?

A. In Pessimistic Concurrency Control a lock is placed on data while it is in use and no other process or user can access that data until that lock is released. Use Pessimistic Concurrency Control when the need for data integrity is paramount. Pessimistic Concurrency Control is not appropriate in a multi-user read-only situation, such as a data warehouse or on-line analytical processing application.

SQL Server Interview Questions And Answers For Experienced

Q. What is Optimistic Concurrency Control?

A. In Optimistic concurrency control, works on the assumption that no other user will be changing the data. Users do not lock data when they read it. When an update is performed, the system checks to see if another user changed the data after it was read. If another user updated the data, an error is raised. Typically, the user receiving the error rolls back the transaction and starts over.

Users specify the type of concurrency control in a transactions and in cursor by specifying there isolation level.

Q. Explain Isolation levels.

A. An isolation level determines the degree of isolation of data between concurrent transactions. SQL-92 defines the following isolation levels, all of which are supported by SQL Server:

READ COMMITTED

Specifies that shared locks are held only while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in nonrepeatable reads or phantom data. This option is the SQL Server default.

READ UNCOMMITTED

Implements dirty read, or isolation level 0 locking, which means that no shared locks are issued and no exclusive locks are honored. When this option is set, it is possible to read uncommitted or dirty data. Values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. This is the least restrictive of the four isolation levels.

REPEATABLE READ

Locks are placed on all data that is used in a query, preventing other users from updating the data, but new phantom rows can be inserted into the data set by another user and are included in later reads in the current transaction.

SERIALIZABLE

Places a range lock on the data set, preventing other users from updating or inserting rows into the data set until the transaction is complete. This is the most restrictive of the four isolation levels.

SQL Interview Questions 108

The default isolation level is READ COMMITTED. When the isolation level is specified, the locking behavior for all SELECT statements in the SQL Server session operates at that isolation level and remains in effect until the session terminates, or until the isolation level is set to another level.

USE pubs
GO

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE GO

BEGIN TRANSACTION
SELECT au_lname FROM authors

Q. What is the difference between the REPEATABLE READ and SERIALIZABLE isolation levels?

A. In a Repeatable Read isolation level, new rows can be inserted into the dataset. In a Serializable isolation level all the rows are locked for the duration of the transaction, no insert, update or delete is allowed.

SQL Interview Questions For Experienced Professionals

Q. What is the default isolation level in SQL server?

A. READ COMMITTED is the default isolation level for SQL server. READ COMMITTED specifies that shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in nonrepeatable reads or phantom data. This option is the SQL Server default.

Q. What is the most restrictive isolation level?

A. SERIALIZABLE is the most restrictive isolation level. SERIALIZABLE places a range lock on the data set, preventing other users from updating or inserting rows into the data set until the transaction is complete. This is the most restrictive of the four isolation levels.

Q. What is the least restrictive isolation level?

A. READ UNCOMMITTED is the least restrictive isolation level. READ UNCOMMITTED implements dirty read, or isolation level 0 locking, which means that no shared locks are issued and no exclusive locks are honored. When this option is set, it is possible to read uncommitted or dirty data; values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. This is the least restrictive of the four isolation levels.

Q. How do you determine the current isolation level?

A. To determine the transaction isolation level currently set, use the DBCC USEROPTIONS statement.

Q. What are the conditions an underlying table must satisfy before a cursor can be used by a positioned UPDATE or DELETE statement?

A. The SELECT statement in the cursor declaration must contain the FOR BROWSE option. To use the FOR BROWSE option, the table must have both a unique index and a timestamp column.

Q. Explain Locks.

A. A lock is an object created by SQL Server to indicate that a user is currently using a resource. The lock does not allow other users to perform operations on the resource that would adversely affect the first user who owns the lock. Locks are managed internally by system software, are acquired, and released based on actions taken by the user.

Microsoft® SQL Server™ 2000 uses locks to implement concurrency control among multiple users in a database at the same time. Transactions and locks are managed on a per connection basis.

SQL Server locks are applied at various levels of granularity in the database. Locks can be acquired on rows, pages, keys, ranges of keys, indexes, tables, or databases. SQL Server dynamically determines the appropriate level at which to place locks for each Transact-SQL statement.

The level at which locks are applied does not have to be specified by users and needs no configuration by administrators.

Q. Explain Lock escalation.

A. Lock escalation is the process of converting many fine-grain locks into fewer coarse-grain locks, reducing system overhead. Microsoft® SQL Server™ 2000 automatically escalates row locks and page locks into table locks when a transaction exceeds its escalation threshold.

SQL Server may dynamically escalate or deescalate the granularity or type of locks. For example, if an update acquires a large number of row locks and has locked a significant percentage of a table, the row locks are escalated to a table lock. If a table lock is acquired, the rowlocks are released. SQL Server 2000 rarely needs to escalate locks; the query optimizer usually chooses the correct lock granularity at the time the execution plan is compiled.

Q. Under what condition it is possible to have a page level lock and row lock at the same time for a query?

A. If enough contiguous keys in a nonclustered index node are selected to satisfy the query, SQL Server may choose to do both row and page locking for the same query, placing page locks on the index and row locks on the data. This reduces the likelihood that lock escalation will be necessary.

Q. Explain how to use transactions efficiently.

A. Get all required input from users before a transaction is started. Do not open a transaction while browsing through data. Keep the transaction as short as possible. After you get all the data, start a transaction, execute the modification statements, then immediately commit or roll back. Do not open the transaction before it is required. Make intelligent use of lower transaction isolation levels. Not all transactions require the serializable transaction isolation level. Make intelligent use of lower cursor concurrency options, such as optimistic concurrency options. Access the least amount of data possible while in a transaction. This lessens the number of locked rows, thereby reducing contention between transactions.

SQL Server Triggers Interview Questions

Q. What you can do to delete a table without the delete trigger firing?

A. TRUNCATE TABLE statement is not caught by a DELETE trigger. Although a TRUNCATE TABLE statement is, in effect, like a DELETE without a WHERE clause (it removes all rows), it is not logged and thus cannot execute a trigger. Since permission for the TRUNCATE TABLE statement defaults to the table owner and is not transferable, only the table owner should be concerned about inadvertently circumventing a DELETE trigger with a TRUNCATE TABLE statement.

Q. Other than Truncate statement, which other command can by-pass the trigger on the tables?

A. The WRITETEXT statement, whether logged or unlogged, does not activate a trigger.

Disabling the recursive triggers setting only prevents direct recursions. To disable indirect recursion as well, set the nested triggers server option to 0 using sp_configure.

If any of the triggers do a ROLLBACK TRANSACTION, regardless of the nesting level, no further triggers are executed.

Q. What are the differences between Triggers and Stored Procedures?

A. Triggers are called automatically by SQL server in response to some action on the table, e.g. insert, delete and update. Stored Procedures can be called from triggers.

Triggers are a special class of stored procedure defined to execute automatically when an UPDATE, INSERT, or DELETE statement is issued against a table.

Triggers contain Transact-SQL statements, much the same as stored procedures.

Q. Is this statement true: A trigger can reference objects outside the current database?

A. Yes, a trigger is created only in the current database; however, a trigger can reference objects outside the current database.

Q. Can a trigger be created on a view?

A. No, a trigger cannot be created on a view.

Q. Will the WRITETEXT statement activate a trigger?

A. No, the WRITETEXT statement, whether logged or unlogged, does not activate a trigger.

Q. Can a table be created inside a Trigger?

A. CREATE TABLE statements are not allowed in a trigger.

Q. When should you use an INSTEAD OF trigger?

A. INSTEAD OF triggers are executed instead of the triggering action. INSTEAD OF triggers can also be defined on views. Each table or view can have one INSTEAD OF trigger for each triggering action (UPDATE, DELETE, and INSERT). You can work around this limitation by creating multiple views on top of the table or view in question, each with their own INSTEAD OF Triggers.

INSTEAD OF triggers allow views that would normally not surpport updates to allow updates. A view made up of multiple base tables must use an INSTEAD OF trigger to support inserts, updates and deletes that reference data in the tables. Another advantage of INSTEAD OF triggers is that they allow you to process data before updating the table. Let’s explore this with an example

SET NOCOUNT ON
GO

USE tempdb
GO

CREATE TABLE Customer
(ID int Identity,
LastName varchar(30),
FirstName varchar (30),
Status varchar (30)
)
GO

CREATE TABLE CreditLimit
(CustomerID int,
CreditLimit float)
GO

INSERT Customer VALUES (‘Rafat’, ‘Sarosh’, ‘Normal’)
INSERT Customer VALUES (‘Tony’, ‘Nitzke’,’Normal’)
INSERT Customer VALUES (‘Paul’, ‘Sponenburg’,’Premium’)

INSERT CreditLimit VALUES (1,10000)
INSERT CreditLimit VALUES (2,15000)
INSERT CreditLimit VALUES (3,20000)

GO

CREATE VIEW ViewCustomer AS

SELECT FirstName , LastName , CreditLimit FROM Customer join CreditLimit ON ID = CustomerID

GO

CREATE TRIGGER ViewCustomer_INSERT ON ViewCustomer INSTEAD OF INSERT AS

INSERT Customer (FirstName, LastName,status)
SELECT FirstName, LastName, CASE
WHEN CreditLimit < 20000 THEN ‘Normal’
ELSE ‘Premium’
END

FROM inserted
INSERT CreditLimit SELECT SCOPE_IDENTITY() , creditlimit FROM
inserted
GO

INSERT ViewCustomer (FirstName, LastName,CreditLimit) VALUES
(‘Aseem’,’Shukla’, 25000)
GO

SELECT * FROM Customer
SELECT * FROM CreditLimit
GO

DROP TABLE Customer
DROP TABLE CreditLimit
DROP VIEW ViewCustomer
GO

Use an INSTEAD OF trigger when you would like to:

• Ignore parts of a batch.

• Log the problem rows.

• Take an alternative action if an error condition is encountered.

Q. Can the “If Update (colName)” statement be used in a delete trigger?

A. No, IF UPDATE (column) Tests for an INSERT or UPDATE action to a specified column and is not used with DELETE operations, as you cannot delete specific columns.

Stored Procedures Interview Questions

Q. Why should one not prefix user stored procedures with ‘sp_’?

A. If the stored procedure does not exist in the master database, do not prefix your stored procedure with ‘sp_’, as it causes a performance penalty. SQL server gives name resolution preference to the master database for procedure that have ‘sp_’ suffix. Once the SQL fails to find the stored procedure in the master database, it assumes that this procedure requires a recompilation as it is not in the cache, and acquires an exclusive lock on the stored procedure for a short time. This lock causes the performance hit.

The exclusive lock is required because only one copy of a stored procedure is generally in the cache at any time. This requires serialization of some parts of the compilation process, and this synchronization process is accomplished in part through the use of compile locks.

Read more on http://support.microsoft.com/support/kb/articles/q263/8/89.asp

Q. What are the results of running this script?

CREATE PROCEDURE Test2
AS
CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (2)
SELECT Test2Col = x FROM #t
GO

CREATE PROCEDURE Test1
AS
CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (1)
SELECT Test1Col = x FROM #t
EXEC Test2
GO

CREATE TABLE #t(x INT PRIMARY KEY)
INSERT INTO #t VALUES (99)
GO

EXEC Test1
GO

A. 1

2

All references to the name within the stored procedure are resolved against the temporary table created in the procedure, not the version that existed before the procedure. Nested stored procedures can also create temporary tables with the same name as a temporary table created by the stored procedure that called it. All references to the table name in the nested stored procedure are resolved to the table created in the nested procedure.

SQL Server Stored Procedures Interview Questions And Answers

Q. Which table keeps information about Stored Procedures?

A. The SysObjects table contains one row for each object (constraint, default, log, rule, stored procedure, and so on) created within a database. In tempdb, this table includes a row for each temporary object.

Q. What will be the value of @@FETCH_STATUS if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?

A -2.

Q. Why and when do stored procedure recompile?

A. Stored procedure will recompile if there is a sufficient number of rows in a table referenced by the stored procedure that have changed. SQL Server will recompile the stored procedure to be sure that the execution plan has the up-to-date statistics for the table. By default for temporary tables SQL Server determines that after 6 modifications any stored procedure referencing that table will need to be recompiled.

http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q195565& Here are few of the reasons why stored procedures will recompile:

• Dropping and recreating the stored procedure.

• Using WITH RECOMPILE clause in the CREATE PROCEDURE or the EXECUTE statement

• Changing the schema of any referenced objects

• Running the sp_recompile system stored procedure against a table referenced by the stored procedure
• Stored procedures plan dropping from the cache.

• Any reference to the temporary tables in the stored procedure.

The following SET options are ON by default in SQL Server, and changing the state of these options in your stored procedure will cause the stored procedure to recompile:

SET ANSI_DEFAULTS
SET ANSI_NULLS
SET ANSI_PADDING
SET ANSI_WARNINGS
SET CONCAT_NULL_YIELDS_NULL

A run-time recompilation of a stored procedure takes place in the following situation:

• Data in a table referenced by the routine has changed.

• The procedure contains a mixture of DDL and DML operations.

• Certain operations on temporary tables are performed.

Q. How can you find out which stored procedures are recompiling?

A. Use the SQL Profiler.

To determine if you have a problem with a specific stored procedure:

Start Profiler.

Start a new trace.

On the Events Tab, remove all default events and add SP:Recompile, SP:Starting, and SP:Completed under Stored Procedure events. If you want to determine the statement that causes the recompile also add SP:StmtStarting and SP:StmtCompleted to the selection.

Click on the filter tab, and add filter to reduce the clutter.

Q. How can you stop stored procedures from recompiling?

A. By using sp_executesql and using the KEEPFIXED PLAN query hint. KEEPFIXED PLAN Forces the query optimizer not to recompile a query due to changes in statistics or to the indexed column (update, delete, or insert). Specifying KEEPFIXED PLAN ensures that a query will be recompiled only if the schema of the underlying tables is changed or sp_recompile is executed against those tables.

SELECT COUNT(*) FROM #Temp OPTION (KEEPFIXED PLAN)
Recompiling takes place when temporary objects are created and referenced throughout the code. Temporary objects will not exist when the initial compilation of the code takes place, so SQL Server has to recompile the stored procedure during execution. This recompilation takes place after the temporary object is referenced for the first time.

By placing all of your temporary table creation statements together, SQL Server can create plans for those temporary tables when one of the tables is referenced for the first time. Recompile will still take place during the execution of the stored procedure, but it will happen only twice, not as many times as many temp tables you have. (Once for the stored procedure and once when the first reference to a temporary table is made).

SQL Server will also be able to reuse the execution plan for the stored procedure the next time the procedure is called there will be no recompiles. Like permanent objects, if you change the schema of a temporary table, the change will cause the stored procedure to recompile as well. Make all schema changes (such as index creation) right after your create table statements and before you reference any of the temporary tables.

Use SQL Profiler to determine if and when your procedures are being recompiled.

SQL Server Cursors Interview Questions And Answers

Q. How many types of cursor type are there?

A. ODBC, ADO, and DB-Library define four cursor types supported by Microsoft® SQL Server™2000. The DECLARE CURSOR statement has been extended; thus you can specify the four cursor types for Transact-SQL cursors.

The four API server cursor types supported by SQL Server are:

Static cursors

Dynamic cursors

Forward-only cursors

Keyset-driven cursors

Static cursors detect few or no changes but consume relatively few resources while scrolling, although they store the entire cursor in tempdb. Dynamic cursors detect all changes but consume more resources while scrolling, although they make the lightest use of tempdb. Keyset-driven cursors lie in between, detecting most changes but at less expense than dynamic cursors.

Although the database API cursor models consider a forward-only cursor to be a distinct type of cursor, SQL Server does not. SQL Server considers both forward only and scroll as options that can be applied to static, keyset-driven, and dynamic cursors.

Q. What is the difference between insensitive and scroll cursor?

A. Insensitive cursors make a temporary copy of the data to be used by the cursor. All requests to the cursor are answered from this temporary table; modifications made to base tables will not be reflected in the data returned by fetches made to this cursor. This cursor does not allow modifications. In other words, this cursor remains insensitive to changes to underlying tables.

In a scroll cursor, committed deletes and updates made to the underlying tables (by any users) are reflected in subsequent fetches.

Q. If a table does not have a unique index, can a cursor be opened on it?

A. Yes, but only insensitive cursors can be opened on a table which does not have a unique index.

Q. Can a cursor be updated? If yes, how you can protect which columns are updated?

A. By default, cursors are updatable. To prevent updates from occurring to any row use READ ONLY options.

To specify the columns which can be updatable, use UPDATE OF option. For e.g.

DECLARE MyCursor CURSOR FOR
Select * from Emp for UPDATE OF( FirstName ).

If OF column_list is supplied, only the columns listed will allow modifications. If no list is supplied, all columns can be updated unless the cursor has been defined as READ ONLY.

Q. While using a cursor, how can you differentiate between a deleted row and a row that has been inserted with NULL data values?
A. Use the global variable @@FETCH_STATUS after each FETCH is made against the cursor. This is covered in greater detail in the next question.

Q. How can you know if the row fetched from cursor is still valid in underlying table?

A. A global variable, @@FETCH_STATUS, will be updated at every execution of FETCH. At a successful fetch, @@FETCH_STATUS will be set to 0. If no data was fetched because the requested cursor position exceeded the results set, −1 will be returned. If the row returned is no longer a member of the results set (if the row was deleted from the base table after the cursor was opened), @@FETCH_STATUS will return −2.

Always use this to determine the validity of the data returned from a cursor fetch prior to attempting any operation against that data.

Q. How can you find out how many rows returned in a cursor?

A. Use the @@CURSOR_ROWS function to determine how many rows have been returned.

Q. What does it mean if @@CURSOR_ROW returns a negative number?

A. Once a cursor has been opened; use the global variable @@CURSOR_ROWS to receive the number of qualifying rows in the last opened cursor. @@CURSOR_ROWS returns:

−m If the cursor is being populated asynchronously. The value returned (−m) refers to the number of rows currently in the keyset.

n If the cursor is fully populated. The value returned (n) refers to the number of rows.

0 If no cursors have been opened or the last opened cursor has been closed or deallocated.

Q. How can you set the threshold at which SQL Server will generate keysets asynchronously?

A. Use the cursor threshold configuration option.

Q. What is the difference between Deallocate cursor and Close cursor?

A. Deallocate removes the cursor data structures. A closed cursor can be re-opened. DEALLOCATE releases all data structures associated with the cursor and remove the definition of the cursor.

Q. Define Cursor Locking.

A. The SELECT statement in a cursor definition obeys the transaction locking rules that apply to any other SELECT statement. In cursors, an additional set of scroll locks can be acquired based on the specification of a cursor concurrency level.

The transaction locks acquired by any SELECT statement are controlled by:

The transaction isolation level setting for the connection.

Any locking hints specified in the FROM clause.

These locks are held until the end of the current transaction for the SELECT statements. When SQL Server is in autocommit mode, each individual SQL statement is a transaction and the locks are freed when the statement finishes. If SQL Server is in explicit or implicit transaction mode, then the locks are held until the transaction is either committed or rolled back.

The locks generated by an independent SELECT or a cursor are always acquired when a row is retrieved.

Cursors retrieve the rows at different times depending on the type of cursor:

Static cursors and Keyset-driven cursors retrieve the entire result set at the time the cursor is opened. This locks each row of the result set at open time.

Dynamic cursors (including forward-only cursors) do not retrieve rows until they are fetched. Locks are not acquired on the rows until they have been fetched.

Fast forward-only cursors vary in when they acquire their locks depending on the execution plan chosen by the query optimizer. If a dynamic plan is chosen, no locks are taken until the rows are fetched. If worktables are generated, then the rows are read into the worktable and locked at open time.

SQL Datatypes Interview Questions And Answers

Q. Between Cast and Convert which function would you prefer and why?

A. Both the functions are used to convert one data type to another. CAST is based on the SQL-92 standard and is preferred over CONVERT. You may prefer to use convert, in situations where you want to convert a datetime value to a specific style.

Q. What are the new data types are introduced in SQL 2000?

A. SQL Server 2000 introduces three new data types. bigint is an 8-byte integer type. sql_variant is a type that allows the storage of data values of different data types. table is a type that allows applications to store results temporarily for later use. It is supported for variables, and as the return type for user-defined functions.

Q. Why it is recommended to avoid referencing a floating point column in the WHERE clause?

A. Approximate numeric data consists of numeric data preserved as accurately as the binary numbering system allows. Many floating-point values cannot be accurately represented in binary notation. For these numbers, it is necessary to store an approximation of the decimal number. Examples of these numbers are floating-point values ending in .3, .6, and .7. The IEEE 754 specification provides four rounding modes: round to nearest, round up, round down, and round toward zero. SQL Server uses round up. It is best to avoid referencing to floating-point columns in WHERE clauses. I.e. Float and Real.

Q. You have to store user responses of ‘Yes’ and ‘No’. What kind of data type is best suited for this task?

A. The bit datatype is best suited to store Yes/No, True/False, and 1/0 values.

Q. What is the Exact Numeric data type in SQL?

A. Exact numeric data consists of numeric data with accuracy preserved to the least-significant digit. Exact numeric datatypes are different from the approximate numeric datatypes float and real, which cannot store all decimal numbers with complete accuracy. The decimal and numeric datatypes are identical in the SQL Server. Both are provided for ANSI compatibility.

These are the exact numeric datatypes:

decimal[(p[, s])] and numeric[(p[, s])]

Q. Explain timestamp datatype?

A. The timestamp is a datatype that is automatically updated every time a row containing a timestamp column is inserted or updated. Values in timestamp columns are not datetime data, but binary(8) varbinary(8) data, indicating the sequence of SQL Server activity on the row. A table can have only one timestamp column.

The timestamp datatype has no relation to the system time it is simply a monotonically increasing counter whose values will always be unique within a database.

Q. How can a user-defined datatype be created?

A. Sp_addtype creates a user-defined datatype. Executing sp_addtype creates a user-defined datatype and adds it to the systypes system table. Once a user datatype is created, you can use it in the CREATE TABLE and ALTER TABLE statements, as well as bind defaults and rules to it.

sp_addtype typename, phystype [, nulltype]

Define each user datatype in terms of one of the physical (SQL Server − supplied) datatypes, preferably specifying NULL (allow null entries) or NOT NULL (disallow them). A user-defined datatype name must be unique in the database, but user-defined datatypes with different names can have the same definition.

Examples

A. Datatype That Does Not Allow Null Values

This example creates a user-defined datatype named ssn to be used for columns that hold social security numbers.

Notice that varchar(11) is enclosed in single quotation marks because it contains punctuation (parentheses).

sp_addtype ssn, ‘VARCHAR(11)’, ‘NOT NULL’

Q. What are the approximate numeric data types?

A. Float and Real are approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data type range can be precisely represented.

Q. You are creating an application where Users are asked their gender. In the gender combo box you have three options: ‘Male’ , ‘Female’ and ‘I choose not to disclose’. These options are stored in the table as 1, 0 or NULL. Which datatype should you use?

A. Specify the bit data type for the column.

Q. Which data types generate inaccurate results if used with an = or <> comparison in a WHERE clause of a SQL statement?
A. Float, Real. The float and real data types are known as approximate data types. The behavior of float and real follows the IEEE 754 specification on approximate numeric data types.

Approximate numeric data types do not store the exact values specified for many numbers; they store an extremely close approximation of the value. For many applications, the tiny difference between the specified value and the stored approximation is not noticeable. At times, though, the difference becomes noticeable. Because of this approximate nature of the float and real data types, do not use these data types when exact numeric behavior is required, such as in financial applications, in operations involving rounding, or in equality checks. Instead, use the integer, decimal, money, or smallmoney data types.

Avoid using float or real columns in WHERE clause search conditions, especially the = and <> operators.

It is best to limit float and real columns to > or < comparisons.

Q. Beginning with SQL Server Version 7.0, a new enhanced data type nchar was added. What type of data is supported with this data type?

A. Unicode Data. Unicode data is stored using the nchar, nvarchar, and ntext data types in SQL Server.

Use these data types for columns that store characters from more than one character set.

Q. What will happen if a column containing char type data is changed to the nchar data type?

A. The nchar data type takes double the amount of bytes to save the same amount of information. Unicode data can be saved in this column. Unicode data is stored using the nchar, nvarchar, and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. Unicode characters store the character set and the character; as a result it requires twice the space as compared to char datatype.

Q. To automatically record the time on which the data was modified in a table, which data type should you choose for the column?

A. Use the datetime datatype. Date and time data types are used for representing date and time of day. Date and time data from January 1, 1753, to December 31, 9999, to an accuracy of one three-hundredth second, or 3.33 milliseconds. Values are rounded to increments of .000, .003, or .007 milliseconds, as shown in the table.

timestamp – A database-wide unique number. The storage size is 8 bytes.

The value of a timestamp column is unique within a database.

A table can have only one timestamp column. The value in the timestamp column is updated every time a row containing a timestamp column is inserted or updated. This property makes a timestamp column a poor candidate for keys, especially primary keys. Any update made to the row changes the timestamp value, thereby changing the key value. If the column is in a primary key, the old key value is no longer valid, and foreign keys referencing the old value are no longer valid.

XML in SQL Interview Questions And Answers

Q. What is XDR?

A. In Microsoft® SQL Server™ 2000, the XML-Data Reduced (XDR) language is used to create the schemas. The XDR is flexible and overcomes some of the limitations of the Document Type Definition (DTD), which also describes the document structure. Unlike DTDs, XDR schemas describe the structure of the document using the same syntax as the XML document. Additionally, in a DTD, all the data contents are character data. XDR language schemas allow you to specify the data type of an element or an attribute.

Q. What is the difference between FOR AUTO and FOR NESTED?

A. The NESTED mode of the client-side FOR XML is similar to the AUTO mode of the server-side FOR

Q. What is the difference between FOR XML RAW and FOR XML AUTO?
A. RAW: Takes the query result and transforms each row in the result set into an XML element with a generic identifier <row /> as the element tag.

For e.g.

SELECT AppID, CommonName FROM Application for XML RAW

<row AppID=”6″ CommonName=”Information services Intranet systems”/> <row AppID=”127″ CommonName=”Pulp Sales System”/>

<row AppID=”153″ CommonName=”Pulp Dryer System”/> <row AppID=”154″ CommonName=”Chip Systems”/>
<row AppID=”155″ CommonName=”Time Collection System”/>

AUTO: Returns query results in a simple, nested XML tree. Each table in the FROM clause is represented as an XML element. The columns listed in the SELECT clause are mapped to the appropriate element attributes.

<ApplicationAppID=”6″ CommonName=”Information services Intranet systems”/>

<Application AppID=”127″ CommonName=”Pulp Sales System”/> <Application AppID=”153″ CommonName=”Pulp Dryer System”/> <Application AppID=”154″ CommonName=”Chip Systems”/> <Application AppID=”155″ CommonName=”Time Collection System”/>

Q.Explain FOR XML EXPLICIT Mode?

A. In an EXPLICIT mode, the query writer controls shape of the XML document returned by the

execution of the query. The query must be written in a specific way so that the additional information about the expected nesting is explicitly specified as part of the query.

See SQL Server Books On-Line for a detail. You may be asked to write a query which uses XML EXPLICIT mode.

Q. Using the Customer, and Order table in Northwind database, Please write a query to produce following XML?

<Results>
<Data>

<row id=”ALFKI” name=”Maria Anders” orderid=”10643″/> <row id=”ALFKI” name=”Maria Anders” orderid=”10692″/> <row id=”ALFKI” name=”Maria Anders” orderid=”10702″/> <row id=”ALFKI” name=”Maria Anders” orderid=”10835″/> <row id=”ALFKI” name=”Maria Anders” orderid=”10952″/>
</Data>
</Results>

A.

SELECT ‘<Results><Data>’

SELECT 1 AS Tag,
NULL AS Parent,
dbo.Customers.CustomerID AS [row!1!id],
dbo.Customers.ContactName AS [row!1!name],
dbo.Orders.OrderID AS [row!1!orderid]
FROM dbo.Customers, dbo.Orders
WHERE dbo.Customers.CustomerID = dbo.Orders.CustomerID
FOR XML EXPLICIT

SELECT ‘</Data></Results>’

Advanced SQL Server Interivew Questions And Answers

Q. What is XML Schema?

A. An XML schema describes the structure of an XML document and also describes the various constraints on the data in the document. When you specify XPath queries against the schema, the structure of the XML document returned is determined by the schema against which the XPath query is executed.

In an XSD schema, the <xsd:schema> element encloses the entire schema; all element declarations must be contained within the <xsd:schema> element. You can describe attributes that define the namespace in which the schema resides and the namespaces that are used in the schema as properties of the <xsd:schema> element.

The minimum XSD schema is:

<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:sql=”urn:schemas-microsoft-com:mapping-
schema”>

</xsd:schema>

Q. What is mapping schema?

A. A mapping schema is, in effect, an XML view of the relational data. These mappings can be used to retrieve relational data as an XML document. In the context of the relational database, it is useful to map the arbitrary XSD schema to a relational store. One way to achieve this is to annotate the XSD schema. An XSD schema with the annotations is referred to as a mapping schema, which provides information pertaining to how XML data is to be mapped to the relational store.

Q. What is XPath?

A. XPath (XML Path Language) is a graph navigation language. XPath is used to select a set of nodes from an XML document. Each XPath operator selects a node-set based on a node-set selected by a previous XPath operator.

XPath language is defined by the W3C as a standard navigation language. The XPath language specification, XML Path Language (XPath) version 1.0 W3C Proposed Recommendation 8 October 1999, can be found at the W3C Web site at http://www.w3.org/TR/1999/PR-xpath-19991008.html. A subset of this specification is implemented in SQL Server 2000.

Q. What keyword you will use to get schema appended to the result set of a ‘for XML’ query?

A.

SELECT TOP 2 Customers.CustomerID
FROM Customers
FOR XML RAW

Query will produce following result

<row CustomerID=”ALFKI”/>
<row CustomerID=”ANATR”/>

To get the schema appended to the result set, write the query as follows:

SELECT TOP 2 Customers.CustomerID
FROM Customers
FOR XML RAW, XMLDATA

<Schema name=”Schema5″ xmlns=”urn:schemas-microsoft-com:xml-data” xmlns:dt=”urn:schemas-microsoft-com:datatypes”>

<ElementType name=”row” content=”empty” model=”closed”> <AttributeType name=”CustomerID” dt:type=”string”/> <attribute type=”CustomerID”/>
</ElementType>
</Schema>

<row xmlns=”x-schema:#Schema5″ CustomerID=”ALFKI”/> <row xmlns=”x-schema:#Schema5″ CustomerID=”ANATR”/>

Q. If I execute this query

SELECT Customers.CustomerID, Orders.OrderID, Customers.ContactName
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
FOR XML AUTO

Following result set is returned:

<Customers CustomerID=”ALFKI” ContactName=”Maria Anders”> <Orders OrderID=”10643″/>
<Orders OrderID=”10692″/>
<Orders OrderID=”10702″/>
<Orders OrderID=”10835″/>
<Orders OrderID=”10952″/>
<Orders OrderID=”11011″/>
</Customers>

How can I rewrite this query to get all attributes as an element?

A. If ELEMENT key word is used, the query will return an element centric result set.

SELECT Customers.CustomerID, Orders.OrderID, Customers.ContactName
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
FOR XML AUTO, ELEMENTS

<Customers>

<CustomerID>ALFKI</CustomerID> <ContactName>Maria Anders</ContactName>
<Orders><OrderID>10643</OrderID></Orders>
<Orders><OrderID>10692</OrderID></Orders>
<Orders><OrderID>10702</OrderID></Orders>
<Orders><OrderID>10835</OrderID></Orders>
<Orders><OrderID>10952</OrderID></Orders>
<Orders><OrderID>11011</OrderID></Orders>
</Customers>

SQL Clustering Interview Questions

Q. Explain Active/Passive and Active/Active cluster configurations?

A. Active/Passive cluster configuration is a combination of two nodes, one called a primary node and another called the secondary node. The primary node suporst the clients and the secondary node acts are a failover backup node. An Active/Active cluster configuration is two simultaneous mirrored active/passive configurations.

OTHER INTERVIEW QUESTIONS

  1. SQL Interview Questions
  2. SQL Server Interview Questions For Experienced
  3. RPA Interview Questions And Answers
  4. Android Interview Questions
  5. Mulesoft Interview Questions
  6. JSON Interview Questions
  7. PeopleSoft HRMS Interview Questions
  8. PeopleSoft Functional Interview Questions
  9. PeopleTools Interview Questions
  10. Peoplesoft Technical Interview Questions
  11. 199 Peoplesoft Interview Questions
  12. 200 Blue Prism Interview Questions
  13. Visualforce Interview Questions
  14. Salesforce Interview Questions
  15. 300 SSIS Interview Questions
  16. PHP Interview Questions And Answers
  17. Alteryx Interview Questions
  18. AWS Cloud Support Interview Questions
  19. Google Kubernetes Engine Interview Questions
  20. AWS Devops Interview Questions
  21. Apigee Interview Questions
  22. Actimize Interview Questions
  23. Kibana Interview Questions
  24. Nagios Interview Questions
  25. Jenkins Interview Questions
  26. Chef Interview Questions
  27. Puppet Interview Questions
  28. DB2 Interview Questions
  29. AnthillPro Interview Questions
  30. Angular 2 Interview Questions
  31. Hibernate Interview Questions
  32. ASP.NET Interview Questions
  33. Kubernetes Interview Questions

30 RPA Interview Questions And Answers 2018 – Robotic Process Automation

30 RPA Interview Questions And Answers 2018. Here Coding compiler sharing a list of 30 Real-Time Robotic Process Automation Interview Questions with Answers. These RPA questions will help you to crack your next RPA job interview. All the best for your future. Happy learning.

RPA Interview Questions

  1. What Is Robotic Process Automation(RPA)?
  2. Explain The Characteristics Of RPA?
  3. What Are The Benefits Of RPA?
  4. What are the advantages of Robotic Process Automation?
  5. What are the Popular RPA Vendors?
  6. Explain About RPA Worldwide Implementation?
  7. What are the important Phases of RPA Life Cycle?
  8. What are Limitations of Robotic Process Automation?
  9. How to Select an RPA Tool?
  10. What are the challenges did you face in your project while implementing Robotic Process Automation?

Read More: Robotic Process Automation Interview Questions

RPA Interview Questions And Answers

RPA Interview Questions 1) What Is Robotic Process Automation(RPA)?

Answer) Robotic automation refers to a style of automation where a machine, or computer, mimics a human’s action in completing rules-based tasks.

RPA Interview Questions 2) Explain The Characteristics Of RPA?

Answer)

Code Free:

RPA doesn’t require programming skills. Employees with any subject expertise can be trained to automate RPA tools instantly. The whole work revolves around RPA chart which provides a flowchart designer to graphically link, drag and drop icons to represent steps in a process.

User-Friendly:

RPA adoption originates within business operations rather inside IT departments. RPA projects require less IT skills and less investment. Eventually, the automation is lowered at a substantial rate.

Non- Disruptive:

RPA avoids complexity and risk. The software robots access to end users systems via a controlled user interface, hence reducing the necessity of underlying systems programming.

Related Article: Benefits of Robotic Process Automation

Latest RPA Interview Questions

RPA Interview Questions 3) What Are The Benefits Of RPA?

Answer) Wide-Range Automation:

RPA speeds up and executes perfect accuracy across different fields viz. banking, healthcare, insurance, telecom, communications, etc. Virtually complex programs are automated on a wide-range by improving the transaction process.

Quick ROI:

RPA will increase productivity across varied industries. One Software robot is efficient of accomplishing the work of approximately 3 employees. This innovation builds positive ROI much faster than expected. Moreover, cost productions might reach 20% in time.

Enterprise Scalability:

RPA is highly flexible and scalable with reduced time of induction. Robots perform massive complex operations in parallel, starting from desktop to cloud environments. All this operation is carried out, by allowing multiple users to monitor and control robots from various business units through a single secure device.

Powerful Analytics:

Gathering agile and exhaustive data enable better management and insights into forever growing business enhancements. Improved governance is achieved through a prescribed set of automation tools.

Cost-Saving:

Implementing RPA within an enterprise has shown a drastic reduction in overall costs when compared to traditional non-RPA methods.

RPA Interview Questions 4) What are the advantages of Robotic Process Automation?

Answer) Advantages of RPA are:

Faster:

As bots are dealing with the execution here, a greater measure of work can be done in a relatively much shorter period. A faster delivery, coupled with accuracy.

Consistency:

It is a safe, non-invasive technology that doesn’t interfere with the inherent systems and provides impeccable consistency in performing the activities across the board, each and every time.

Cost Effective:

It has been projected that using robotics cuts operational costs, Robots can operate 24*7 and take no leave when compared to humans.

Increased Customer Satisfaction:

Providing better quality of work with optimum accuracy and improved customer/client interaction leads to increased customer and client satisfaction.

Accuracy & Quality:

RPA offers better services to processes that have a high probability of human error, thereby increasing accuracy. Robots are reliable, consistent and do not whine when expected to work tirelessly.

Improved Analytics:

Having access to error-free, perfect data from various sources would improve the quality of analytics in the process.

Related Article: RPA Case Study – Customer Service & Support

RPA Interview Questions 5) What Are The Popular RPA Tools & Vendors?

Answer) Popular RPA Tools & Vendors are:

  • Automation Anywhere
  • Blue Prism
  • Openspan
  • UIPath
  • Verint
  • BlackLine
  • NICE Actimize
  • Datamatics
  • Kofax
  • EdgeVerve
  • HelpSystems

Top Robotic Process Automation (RPA) Interview Questions

RPA Interview Questions 6) Explain About RPA Worldwide Implementation?

Answer) RPA is constantly leveraging in the market worldwide. It is already being implemented by broad-range of industries. Enterprises now enjoy the freedom of optimizing costs and going up freeing their resources. This ultimately leads to new business visions in crowded marketplaces.

RPA Interview Questions 7) What are the important Phases of RPA Life Cycle?

Answer) Phases of RPA Life Cycle:

Analysis:

The first phase in RPA begins with analysis. Business team and RPA Architect work together to understand a business process for RPA development.

Bot Development:

RPA developer (Team) starts working on the requirement in their environment possibly a distinct development environment.

Testing:

Some companies conduct Testing by Separate Testing Team, while some have a dedicated testing team which performs a dedicated QA like normal SDLC flow. Best Practice is to have a dedicated testing team which performs QA of the developed bot.

Deployment and Maintenance:

After the Development and Testing phases, a bot is ready for distribution and enters maintenance phase.

Related Article: RPA Case Study – Data Migration & Management

RPA Interview Questions 8) What is the difference between thin client and thick client?

Answer)

Thin client:

It is any application that we cannot get the quality properties while spying using any RPA tools.

e.g. Any virtual environment

Thick client:

It is any application that we get pretty handful of attribute features using RPA tools

e.g. calculator, Internet explorer

RPA Interview Questions 9) What are Limitations of Robotic Process Automation?

Answer) Limitations of RPA are:

RPA surely improves company efficiency by powering repetitive human effort, but there are limitations to the types of work that it can be applied to – especially ones that require judgment.

RPA is not a cognitive computing solution. It cannot learn from experience and therefore has a ‘shelf life’.

Implementing RPA to a broken and incompetent process will not fix it. RPA is not a Business Process Management solution and does not bring an end-to-end process view.

Enterprises need to be aware of various inputs coming from multiple sources. It cannot read any data that is non-electronic with unstructured inputs.

RPA Interview Questions 10) How to Select an RPA Tool?

Answer) By considering several factors we select a RPA Tool for Businness Process Automation,

Technology

First and foremost is the technology in which RPA tool has been built, like Microsoft, .NET, IBM Mainframe, Java, web etc. The tool has to be platform independent, considering many of the organizations perform their day to day tasks outside the local desktop using Citrix or Virtual machines etc. So the automation solution should be able to support any application and platform.

Interface

Next most important feature is the RPA tool’s user interface. A complex user interface will delay the process of implementation and increase the learning curve and adaptability. A more user-friendly interface like drag and drop, auto capture, image recognition etc. would be better.

Management

It is important to know how effectively and easily the robots can be managed considering these robots are going to be replacing your human workforce. There should be a high level of visibility and control in terms of process monitoring, process change, development, re-use etc.

Security

Security is one of the most important factors to be considered. How safe are the robots when compared to the humans? After all robots/RPA tools are also a piece of software, so how much more security controls can be implemented, test the code rigidly and lock it up, the better.

Related Article: RPA Use Case in IT And Infrastructure

Top RPA Interview Questions And Answers

RPA Interview Questions 11) What are the important Phases of RPA Life Cycle?

Answer) Phases of RPA Life Cycle:

Analysis

The life cycle in RPA begins with analysis phase. Business team and RPA Architect work together to identify a business process for RPA development.

Bot Development

RPA developer(Team) starts working on the requirement in their environment possibly a separate development environment.

Testing

There are two approaches on which testing is being carried out.

Some organizations conduct Testing by Separate Testing Team, While other few have a dedicated testing team which performs a dedicated QA like normal SDLC flow.

Best Practice is to have a dedicated testing team which performs QA of the developed bot.

Deployment and Maintenance

After the Development and Testing closure, a bot is ready for deployment and enters maintenance phase.

RPA Interview Questions 12) What Is Blue Prism’s Robotic Automation?

Answer) Robotic Automation refers to process Automation’s where computer software drives existing enterprise application software in the same way that a user does.

Automation is a tool or platform that operates other application software through the existing application user interface.

RPA Interview Questions 13) Is Robotic Automation Like Screen Scraping Or Macros?

Answer) No, clerical Robotic Automation is a generation on from old technologies like screen scraping or macros.

The major differences are:

Robots are universal application orchestrators – any application that can be used by a person can be used by a modern robot, whether mainframe, legacy, bespoke application, web service enabled or even a closed 3rd party API hosted service.

Robots collect procedural knowledge which over time build into a shared library that can be re-used by any other robot or device (in the same way objects are built in traditional SW engineering).

Applications are “read” by the robot, either through dedicated APIs where they exist, through the OS prior to application display, or through the screen in the context of the native application.

In this last case the modern robot “reads” an application screen in context and in the same way a user does. As part of the robot training, it is shown how to read the application’s display much like a user is shown.

Related Article: Robotic Process Automation in Human Resources

Best RPA Interview Questions And Answers

RPA Interview Questions 14) How to implement Robotic Process Automation?

Answer) There are mainly 6 steps to be followed for a successful RPA implementation.

  • Identify the Automation Opportunities
  • Optimize the Identified Processes
  • Build a Business Case
  • RPA Vendor Selection
  • Pilot RPA Development
  • Ramp up and Continue Building Expertise RPA bots.

RPA Interview Questions 15) Is Blue Prism An Rpa Tool?

Answer) Yes, Blue Prism is an RPA Tool.

RPA Interview Questions 16) What Systems Can Blue Prism Robotically Integrate?

Answer) Blue Prism has incorporated many years of experience of integration and numerous technologies into its software. The technologies used are secure, reliable and robust.

Instead of creating new adaptors for each unique application we have developed technology adaptors for all the technologies employed at the presentation layer, Java, Windows, Web, Green Screen/Mainframe and even Citrix.

This coupled with a wide range of dedicated tools that have been developed means that we are confident in being able to link any system with the click of a button. This proven application orchestration capability ensures that new processes can be rapidly designed, built and tested without any impact on existing systems.

RPA Interview Questions 17) Explain about RPA Testing?

Answer) At a broader level, RPA testing can be grouped into 2 categories.

First one is testing the business processes automated through RPA and the second one is testing the instructions passed on to Robots to execute user actions.

Business Process Testing

This is nothing but the conventional testing done for any application. The end to end business process automated by the RPA tool has to be validated here.

If we have to test the RPA use case, a scenario would be to test if Robot is able to get the file from the server, read the data from the application, compare these two data sources, identify any conflicts and send an email notification to respective owner. All combinations of data are to be validated like it is done for any other application.

Robots Testing

There are multiple aspects when testing Robots. The first one is the interpretation of the models by Robots. It is very important that the Robots are able to interpret the instructions given through the models correctly and able to perform actions on the UI accordingly. This need not be tested regularly but when the model is designed/modified or before a Robot is put into use.

Related Article: RPA Case Study – Digital Online Initiatives

RPA Interview Questions 18) What Hardware Infrastructure Do I Need To Run Blue Prism’s Robotic Automation Platform?

Answer) Blue Prism has been designed for flexibility and to meet the most robust IT standards for IT operational integrity, security, and supportability.

The software can be deployed either as a front office or back office process, running quite happily on a standard desktop in the front office or on any scale of systems for back-office processing.

RPA Interview Questions 19) What Is Process Studio?

Answer) A Blue Prism Process is created as a diagram that looks much like a common business flow diagram.

Processes are created in an area of Blue Prism named Process Studio which, as we will see, looks similar to other process modeling applications (such MS Visio) and uses standard flow diagram symbols and notation.

RPA Interview Questions 20) Is Blue Prism’s Robotic Automation Platform Secure And Auditable?

  1. Security and auditability are built into the Blue Prism robotic automation platform at several levels. The runtime environment is completely separate to the process editing environment.
  2. Permissions to design, create, edit and run processes and business objects are specific to each authorized user.
  3. A full audit trail of changes to any process is kept, and comparisons of the before and after effect of changes are provided.
  4. The log created at run-time for each process provides a detailed, time-stamped history of every action and decision taken within an automated process.
  5. Our clients tend to find that running a process with Blue Prism gives them a lot more control than a manual process, and from a compliance point of view assures that processes are run consistently, in line with the process definition.

RPA Interview Questions And Answers For Experienced

RPA Interview Questions 21) How Do I Get Started On Delivering Processes Using Blue Prism?

Answer) Blue Prism recommends a phased approach to getting started as the Operational Agility framework is eminently scalable. It is typical to target the configuration of between 1 and 10 processes initially with a rolling program of processes being introduced once the framework is established.

RPA Interview Questions 22) What Support Do I Need From Blue Prism Professional Services?

Answers) It really depends on the skills you already have in-house and the way you wish to work. Blue Prism can provide a full range of services from basic training, support and mentoring with a view to quickly getting your team independently delivering ongoing automation, right through to a full turnkey package where we will take responsibility for delivering business benefit within agreed service levels.

Related Article: RPA Case Study – Back Office Administration

RPA Interview Questions 23) Why Blue Prism?

  1.  Automation process can be designed within IT Governance
  2.  Supports both internal and external Encryption/Decryption Keys
  3.  Provides Audit Logs enabling
  4. High-level Robustness because of .NET customized code within the process automation (Tool is capable of doing all the activities whatever can be done using .NET)

RPA Interview Questions 24) How Long Does It Take In Developing Automated System?

Answer) The basic knowledge required to begin creating automated processes. The project for the initial Operational Agility framework creation. During this time the trainees are delivering automated processes into the production environment therefore generating business benefit.

RPA Interview Questions 25) How Much Does Robotic Automation Cost?

Answer) A “fully loaded” office robot is approximately a 1/3rd the cost of globally sourced agents. The flexibility and ease of deployment mean that this comparison is easy to maintain and judge the nested approach to a given task.

Advanced RPA Interview Questions And Answers

RPA Interview Questions 26) What Is The Difference Between Thin Client And Thick Client?

  1. Thin client is any application that we cannot get the attribute properties while spying using any RPA tools. For eg , Citrix or any virtual environment.
  2.  And thick client is any application that we get pretty handful of attribute properties using RPA tools eg calculator, Internet explorer
  3.  To gain in-depth knowledge and be on par with practical experience, then explore RPA Training Course.

Related Article: Blue Prism Interview Questions

RPA Interview Questions 27) Does Blue Prism Require Coding?

  1.  Blue Prism’s digital workforce is built, managed and owned by the user or customer, spanning operations and technology, adhering to an enterprise-wide robotic operating model.
  2.  It is code-free and can automate any software.
  3.  The digital workforce can be applied to automate processes in any department where clerical or administrative work is performed across an organization.

RPA Interview Questions 28) What Are The Differences Between Blue Prism And Uipath?

Answer) UiPath and Blue Prism both the tools have their respective software/Studio and they are very good. UI and BP both have visual process designers for developing the solutions.

Differences between Blue Prism and UiPath

In terms of programming languages

  1.  Blue Prism Uses C# for coding
  2.  UiPath uses VB for coding

In terms of Control Room/Dashboard

  1.  UiPath control room – The Orchestrator – is web-based, you can access it from the browser or mobile.
  2.  BP have client based servers, accessible only through their apps.

In terms of cost and uses

UiPath:

  • Lower cost of development
  • Easier to learn and operate
  • You can learn by your self
  • Study materials are easily available on internet

Blue Prism:

  • Good for mass scale deployment of large number of robots
  • Higher cost of acquiring and using BP
  • Limited training available as the only source of training is BP
  • Training cost of Blue Prism is too high

Related Article: Automation Anywhere Interview Questions

RPA Interview Questions 29) Explain The Typical Uses Of RPA?

  1.  Double-data entry – user rekeying of data and data entry is made easy from one system to another.
  2.  Application migration – migrates application data and records as part of an upgrade.
  3.  Automation of reports – automates data to provide accurate reports.
  4.  Rule-based decision making – RPA can handle decision matrices efficiently and arrive at simple rule-based decisions accurately.
  5.  Well-defined Processing – Automatically enters inputs from source systems into target systems.

RPA Interview Questions 30) What Are The Advantages Of Using RPA?

By using RPA:

  •  Revenue is expanded.
  •  More product is made available on the Internet.
  •  Promote Self-Service options.
  •  Present information regarding an issue automatically.
  •  Efficiency is increased.

RPA Tutorials For Beginners

  1. Introduction to Robotic Process Automation
  2. Know The Reality of Robotic Process Automation

Robotic Process Automation Case Studies

RPA Tools Interview Questions

  1. RPA Interview Questions
  2. Blue Prism Interview Questions
  3. Automation Anywhere Interview Questions

Want to learn Robotic Process Automation from industry experts?

Contact us.