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

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

Android Interview Questions And Answers For Freshers Experienced

Android Interview Questions And Answers For Freshers Experienced 2018. Here Coding compiler sharing a list of 295 android interview questions for experienced and freshers. This list will help you to prepare well for android technical job interviews and crack your next android job interview. All the best for your future and happy learning.

Android Interview Questions

  1. What is URLConnection?
  2. What is logging (Logcat)?
  3. What is AsyncTask?
  4. What is JSON?
  5. How many different logcat types are there?
  6. What are the names of the specific logcats?
  7. Logging methods require two strings, what does each string represent?
  8. What are the four AsyncTask methods that must be overridden?
  9. Where are permissions declared?
  10. What is meant by responsive design?

Android Interview Questions And Answers

1) What is URLConnection?

A) An URLConnection used to send and receive data over the web. Data may be of any type and length. This class may be used to send and receive streaming data whose length is not known in advance.

2) What is logging (Logcat)?

A) The logging (Logcat) system provides a mechanism for collecting and viewing system debug output.

3) What is AsyncTask?

A) AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

4) What is JSON?

A) JSON is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.

5) How many different logcat types are there?

A) 5

6) What are the names of the specific logcats?

A) Verbose, Debug, Info, Warn and Error

7) Logging methods require two strings, what does each string represent?

A) The first string (Tag) identifies where the log is coming from and the second is the specific log message.

8) What are the four AsyncTask methods that must be overridden?

A) onPreExecute, doInBackground, onProgressUpdate, onPostExecute

9) Where are permissions declared?

A) AndroidManifest.xml file

10) What is meant by responsive design?

A) Its a layout that adjust automatically depending on screen size.

Android Interview Questions For Freshers

11) What are the three layout managers?

A) LinearLayout, RelativeLayout, and FrameLayout

12) Why are view recycled?

A) Less memory overhead, smoother scrolling and less view management.

13) What is Activity Lifecycle?

A) onCreate, onStart, onResume, onPause, onStop, onDestroy

14) What is onPause?

A) Partially visible, Popup or Dialog

15) What is onStop?

A) Not visible

16) What is Service Lifecycle

A) onCreate, startCommand, onBind

17) What is onUnbind?

A) stopService/stopSelf, onDestroy

18) What are Android Components?

A) Activity, Service, Broadcast Receiver, Content Provider

19) What Android 4.0 Library contains?

A) A project folder that contains the android.jar file which includes all class libraries needed to build an Android app for a specified version

20) What main/assets/ directory contains?

A) Directory that contains asset files that are accessed through classic file manipulation

Android Interview Questions And Answers For Freshers

21) What main/gen/ directory contains?

A) Directory that contains automatically generated JAVA files

22) What is Change Gravity?

A) A tool that changes the linear alignment of a control so that is is aligned to the left, center, right top or bottom of an object or the screen

23) What is compound condition?

A) More than one condition included in an If statement

24) What is decision structure?

A) A fundamental control structure used in computer programming that deals with the different conditions that occur based on the values entered into an application

25) What is equals method?

A) A method of the String class that JAVA uses to compare strings

26) What is hexadecimal color code?

A) A triplet of three colors using hexadecimal numbers, where colors are specified first by a pound sign followed by how much red (00 to FF), how much green (00 to FF), and how much blue, (00 to FF) are in the final color.

27) What is If Else statement?

A) A statement that executes one set of instructions if a specified condition is true and another set of instructions if the condition is false.

28) What is if statement?

A) A statement that executes one set of instructions if a specified condition is true and takes no action if the condition is not true.

29) What is isChecked() method?

A) A method that tests a checked property to determine if a RadioButton object has been selected.

30) What is launcher icon?

A) An icon that appears on the home screen to represent the application.

Android Developer Interview Questions And Answers For Freshers

31) What is margin?

A) Blank space that offsets a control by a certain amount of density independent pixels (dp) on each of its four sides.

32) What is nest?

A) To place one statement, such as an If statement, within another statement.

33) What is Radio Group?

A) A group of RadioButton controls; only one RadioButton control can be selected at a time.

34) What is toast notification?

A) A message that appears as an overlay on a user’s screen, often displaying a validation warning.

35) What is ACTION_VIEW?

A) A generic action you can use to send any request to get the most reasonable action to occur.

36) What is adapter?

A) Provides a data model for the layout of a list and for converting the data from the array into list items.

37) What is array variable?

A) A variable that can store more than one value

38) What is a break?

A) A statement that ends a case within a Switch statement and continues with the statement following the Switch decision structure.

39) What is a case?

A) A keyword used in a Switch statement to indicate a condition. In a Switch statement, the case keyword is followed by a value and a colon.

40) What is an element?

A) A single individual item that contains a value in an array.

Android Basic Interview Questions And Answers

41) What is ListActivity?

A) A class that displays a list of items within an app.

42) What is onListItemClick()?

A) A method called when an item in a list is selected.

43) What is position?

A) The placement of an item in a list. When an item in a list is selected, the position of the item is passed from the onListItemClick method and evaluated with a decision structure. The first item is assigned the position of 0, the second item is assigned the position of 1, and so forth.

44) What is setListAdapter?

A) A command that projects your data to the onscreen list on your device by connecting the listActivity’s object to array data.

45) What is Switch?

A) A type of decision statement that allows you to choose from many statements based on an integer or char input.

46) What is URI?

A) An acronym for Uniform Resource Identifier, a URI is a string that identifies the resources of the Web. Similar to a URL, a URI includes additional information necessary for gaining access to the resources required for posting the page.

47) What is URL?

A) An acronym for Uniform Resource Locator, a URL is a Web site address.

48) What is 9-patch image?

A) A special image with predefined stretching areas that maintain the same look on different screen sizes

49) What is android:oneshot?

A) An attribute of the animation-list that determines whether an animation plays once and then stops or continues to play until the Stop Animation button is tapped.

50) What is AnimationDrawable class?

A) A class that provides the methods for Drawable animations to create a sequence of frame-by-frame images

Android Basic Interview Questions And Answers For Freshers

51) What is animation-list?

A) An XML root element that references images stored in the drawable folders

52) What is Frame animation?

A) A type of animation, also called frame-by-frame animation, that plays a sequence of images, as in a slide show, with a specified interval between images.

53) What is motion tween?

A) A type of animation that specifies the start state of an object, and then animates the object a predetermined number of times or an infinite number of times using a transition.

54) What is setBackgroundResource?

A) A method that places images in the frame-by-frame display for an animation, with each frame pointing to an image referenced in the XML resource file.

55) What is startAnimation?

A) A method that begins the animation process of a View object by calling the AnimationUtils class utilities to access the resources necessary to load the animation.

56) What is Tween animation?

A) A type of animation that, instead of using a sequence of images, creates an animation by performing a series of transformations on a single image, such as position, size, rotation, and transparency, on the contents of a View object.

57) What is tween effect?

A) A transition that changes objects from one state to another, such as moving, rotating, growing, or shrinking.

58) What is Android Application Module?

A) The container for application’s source code, resource files, and application level settings, such as the module-level build file, resource files, and Android Manifest file

59) What is Test Module?

A) Module that contains the source code to test application projects and is built into test application that run on a device

60) What is JUnit?

A) A unit testing framework for the Java programming language

Android Developer Interview Questions For Freshers

61) What is TDD (Test-driven development)?

A) A software development process that relies on the repetition of a very short development cycle: first an automated test case is written that defines a desired improvement of new function

62) What is Test case?

A) Set of conditions under which a tester will determine whether an application, software system or one of features is working as was originally established for it to do

63) What is Software system?

A) System of intercommunicating components based on software forming part of the computer system

64) What is Library module?

A) Module that contains shareable Android source code and resources that developer can reference in Android projects

65) What is GAE (Google App Engine)?

A) A PaaS cloud computing platform for developing and hosting web applications in Google-managed data centers

66) What is PaaS?

A) A category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure

67) What is GCM (Google Cloud Messaging)?

A) A mobile service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications

68) What is .idea/ directory?

A) Directoty for IntelliJ IDEA settings

69) What is app/ directory?

A) A folder that contains application module directories and files

70) What is gradle/ directory?

A) A folder that contains the gradle-wrapper files

Basic Android Interview Questions And Answers For Freshers

71) What is .gitignore?

A) Specifies the untracked files that Git should ignore

72) What is build.gradle?

A) Customizable properties for the build system

73) What is gradle.properties?

A) Project-wide gradle settings

74) What is gradlew?

A) Gradle startup script for Unix

75) What is gradlew.bat?

A) Gradle startup script for Windows

76) What is local.properties?

A) Customizable computer-specific properties for the build system, such as the path to the SDK installation

77) What is .iml directory?

A) Module file created by IntelliJ IDEA to store module information

78) What is settings.gradle?

A) Specifies the sub-projects to build

79) What is build/ directory?

A) Directory that contains build folders for the specified build variants

80) What is libs/ directory?

A) Directory that contains private libraries

Android Questions For Freshers

81) What is src/ directory?

A) Directory that contains the stub Activity file and other source code files

82) What is androidTest/ directory?

A) Directory that contains the instrumentation tests

83) What is main/java/com.<project>.<app>?

A) Directory that contains Java source code for the app activities

84) What is main/jni/ directory?

A) Directory that contains native code using the JNI

85) What is Android NDK?

A) A toolset that allows you to implement parts of your app using native-code languages

86) What is IDL (interface definition language)?

A) A specification language used to describe a software component’s API

87) What is main/res/ directory?

A) Directory that contains application resources, such as drawable files, layout files, and string values

88) What is anim/ directory?

A) Directory for XML files that are compiled into animation objects

89) What is color/ directory?

A) Directory for XML files that describe colors

90) What is drawable/ directory?

A) Directory for bitmap files (PNG, JPG, or GIF), 9-Patch image files, and XML files that describe Drawable shapes or Drawable objects that contain multiple states

Android Developer Interview Questions

91) What is ColorStateList?

A) An object you can define in XML that you can apply as a color, but will actually change colors, depending on a state of the View object to which it is aplied

92) What is mipmap/ directory?

A) Directory for app launcher icons

93) What is layout/ directory?

A) Directory for XML files that are compiled into screen layouts

94) What is menu/ directory?

A) Directory for XML files that define application menus

95) What is raw/ directory?

A) Directory for arbitrary raw asset files

96) What is AAPT (Android Asset Packaging Tool)?

A) AAPT is a part of SDK that allows developers to view, create and update Zip-compatible archives

97) What is values/ directory?

A) Directory for XML files that define resources by XML element type

98) What is xml/ directory?

A) Directory for miscellaneous XML files that configure application components

100) What is AndroidManifest.xml?

A) The control file that describes the nature of the application and each of its components

Important Android Interview Questions And Answers

101) What is app.iml/ directory?

A) IntelliJ IDEA module

102) What is proguard-rules.pro?

A) ProGuard settings file

103) What is API Level, codename of Android 2.3.3 – 2.3.7?

A) 9-10, Gingerbread

104) What is API Level, codename of Android 4.0.3 – 4.0.4?

A) 15, Ice Cream Sandwich

105) What is API Level, codename of Android 4.1 – 4.3?

A) 16-18, Jelly Bean

106) What is API Level, codename of Android 4.4?

A) 19, KitKat

107) What is API Level, codename of Android 5.0 – 5.1?

A) 20-21, Lollipop

108) API Level, codename of Android 6.0?

A) 23, Marshmallow

109) What is android:minSdkVersion?

A) Specifies the minimum API Level on which the application is able to run

110) What is android:targetSdkVersion?

A) Specifies the API Level on which the application is designed to run

Most Asked Android Interview Questions And Answers

111) What is android:maxSdkVersion?

A) Specifies the maximum API Level on which the application is able to run

112) What is applicationId?

A) Fully qualified package name for the application

113) What is hexadecimal color code?

A) A triplet of three colors using hexadecimal numbers, where colors are specified first by a pound sign followed by how much red (00 to FF), how much green (00 to FF), and how much blue, (00 to FF) are in the final color.

114) What is isChecked() method?

A) A method that tests a checked property to determine if a RadioButton object has been selected.

115) What is toast notification?

A) A message that appears as an overlay on a user’s screen, often displaying a validation warning.

116) What is ACTION_VIEW?

A) A generic action you can use to send any request to get the most reasonable action to occur.

117) What is ListActivity?

A) A class that displays a list of items within an app.

118) What is onListItemClick()?

A) A method called when an item in a list is selected.

119) What is setListAdapter?

A) A command that projects your data to the onscreen list on your device by connecting the listActivity’s object to array data.

120) What is 9-patch image?

A) A special image with predefined stretching areas that maintain the same look on different screen sizes

Android Interview Questions For Experienced

121) What is setBackgroundResource?

A) A method that places images in the frame-by-frame display for an animation, with each frame pointing to an image referenced in the XML resource file.

122) What is startAnimation?

A) A method that begins the animation process of a View object by calling the AnimationUtils class utilities to access the resources necessary to load the animation.

123) What is Tween animation?

A) A type of animation that, instead of using a sequence of images, creates an animation by performing a series of transformations on a single image, such as position, size, rotation, and transparency, on the contents of a View object.

124) What is tween effect?

A) A transition that changes objects from one state to another, such as moving, rotating, growing, or shrinking.

125) What is TDD (Test-driven development)?

A) A software development process that relies on the repetition of a very short development cycle: first an automated test case is written that defines a desired improvement of new function

126) What is GAE (Google App Engine)?

A) A PaaS cloud computing platform for developing and hosting web applications in Google-managed data centers

127) What is GCM (Google Cloud Messaging)?

A) A mobile service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications

128) What is Android NDK?

A) A toolset that allows you to implement parts of your app using native-code languages

129) What can sensors measure?

A) Relative humidity
Pressure
Magnetic field
Steps taken
Proximity
The rate of ratation of the device on x,y,z axes

130) What is a Physical Sensor?

A) Sensors that pieces of hardware that are physically present on the device. Know as Hardware Sensors.

Top Android Interview Questions Experienced

131) What are Synthetic sensors?

A) Sensors that are not physicall present on the device. They are derived from one or more sensors

132) What is Raw?

A) Values directly given by the sensor without any correction logic.

Accelerometers, proximity sensors, light sensors,

133) What is Calibrated?

A) Values from sensors that are corrected by the operating system

134) What is Fused?

A) Sensors that gets values from two or more sensors. These values are combined to one value

135) What is SensorManager?

A) Provides access for your app to the sensors.

136) What is Continuous?

A) That report mode when sensor events are generated at a constant rate defined by the sampling peroid

137) What is On change?

A) That report mode when sensor events are generated only if the measured values have changed since the last known value

138) What is One shot?

A) The report mode when sensors only are triggerd once in the entire duration of the event

139) What is Special Trigger?

A) The report mode when the sensor only is trigged when it’s called on. It listen for an event to fire

140) Which of the following are true about Intent.CALL_ACTION?

A) dial + dialled

Android Interview Questions And Answers For Experienced

141) Activity results handled by the onActivityResult() method are differentiated from one another using which code?

A) Result Code

142) Which of the following is layout that you can use in a window in an Android application?

A) FrameLayout

143) How do you access the string resource stored in the strings.xml file?

A) You can use the getResources() method

144) Which of the following methods is used to return a View from a layout file given the ID of the View?

A) .findViewById(int id)

145) Which of the following used to detect when a user clicks or taps on a button?

A) OnClickListener

146) What is contained within the manifest xml file?

A) The permissions the application requires Correct

147) Android: Which attribute will be used in XML if the Java code needs a reference to View??

A) android:id

148) How do you programmatically determine whether a RadioButton is checked?

A) You should check the isChecked() method

149) What is NotificationManager class?

A) The NotificationManager class is used to display notifications on the device’s status bar

150) Which dialog box can you use in you Android application?

A) AlertDialog

Android Interview Questions For 1 Year Experience

151) On android, a layout can contain other layout?

A) True

152) How to set data for a Spinner control?

A) Use method setAdapter()

153) In auto-generated code of an Android app, what is R class?

A) Contains IDs of the project resources

154) How does Android system manage activity’s life cycle?

A) Via system activity stack

155) What is the correct HTML5 element for playing video files?

A) <video>

156) Does CSS support to detecting device size and orientation?

A) True

155) What is NOT correct about Controller in Sencha Touch?

A) Responsible for responding to events that occur within your app

156) Which file is entry point for Sencha Touch app?

A) app.js

157) Which doctype is correct for HTML5?

A) <!DOCTYPE html>

158) Which kind of application when creating with Sencha Touch?

A) Hybrid app

159) Graphics defined by SVG is in which format?

A) XML

160) In HTML5, onblur and onfocus are?

A) Event attributes

170) Which Android File API to create a file?

A) openFileOutput()

171) Does HTML5 native support for local storage?

A) True

Android Web Services Interview Questions And Answers

172) How to check if browser supports web storage?

A) Check if typeof(Storage) !== “undefined”

173) How to apply stylesheet with HTML element by id?

A) #id

174) How to get the form data in Sencha Touch?

A) getFormInstance().getValues();

175) Which permission needed in order to use MapActivity?

A) <uses-permission android:name=”android.permission.INTERNET” />

176) On android services, onStart() and onBind() are the same?

A) False

177) Do we need API key for displaying Google Maps in Android?

A) yes

178) How to register a broadcast receiver?

A) Via AndroidManifestxml file

179) Is color a new HTML5 element of input type?

A) yes

180) Intent mylntent = new Intent(IntentACTION_VIEW Uri.pars(“http://www.google.com”)); startActivity(myIntent)

A) myIntent is implicit Intent.

Android Interview Questions And Answers For 1 Year Experience

181) In android intent. The activity can be embedded inside of another activity that hosts gadgets is belonged to

A) CATEGORY_GADGET

182) Where we can create tables and columns to them, create views or triggers?

A) onCreate()

183) “Gingerbread” is nickname of which version?

A) Android versiov2.3.x

184) By default UI components made in the UI editor should have text defined in file?

A) string.xml

185) SQLite database save data in which storage?

A) Internal storage

186) How to set layout’s attribute programmatically in android?

A) Use LayoutParams class

187) What is base of all Sencha Touch component?

A) ExtComponent

188) Which method to display a dialog?

A) show()

189) How to change the main color of Sencha Touch application?

A) Change the $base-color variable in app.scss

190) Which activity class do you need to inherit to show Google map?

A) MapActivity class

Android Interview Programming Questions

191) What are 2 ways a Service can run?

A) Bounded and Unbounded

192) How to show or hide a Sencha Touch component?

A) Call .show() or .hide() method of component itself

193) When a dialog is requested for the first time, which method will Android call from your Activity?

A) onCreateDialog(int)

194) Do we need to declare all of Controller in app.js with Sencha Touch?

A) Yes

195) In android, normally SDCard is?

A) External storage

196) Which of the following is best choice for simple animations for your website?

A) JavaScript

197) Which statement is correct about web storage?

A) It is key/value data

198) Android UI is threadsafe? Is it true or false?

A) False

199) Do we need to register all of View classes in app.js with Sencha Touch?

A) No

200) Which class do we use for listening location update?

A) LocationManager class

Android Interview Questions For 2 Years Experience

201) How to make a TextView to be editable?

A) Either set its attribute editable =’true’ or Use EditText class instead of TextView class

202) What is NOT correct about Store in Sencha Touch?

A) Load data via a Proxy

203) How to define a new Sencha Touch class?

A) Use Extdefine()

204) If the action is ACTION_CALL. what the data field would be?

A) URI with the number to call

205) Android MapActivity is?

A) Base class with code to manage the boring necessities of any activity that displays a MapView

206) There are five different methods to store persistent data. They are: Shared Preferences. Internal Storage. External Storage. Network and __?

A) SQLite Database

207) What are location providers in Android?

A) GPS & Network

208) Android AsyncTask create new thread in background?

A) True

209) What is not true about the Android application lifecycle?

A) Each activity of an app is run in its own process

210) Intent myIntent = new Intent(this. ActivityTwo.class);?

A) myIntent is explicit Intent

Android Interview Questions With Answers

211) What is value on component’s attribute layout_widtlf and layout_heighl to display the component big enough to?

A) wrap_content

212) What is TRUE about localStorage?

A) It is never expired

213) How to listen to an event in Sencha Touch class?

A) Write event handler within listeners:{} body

214) Which method to open a Hap connection to an Uri?

A) url.openConnection()

215) Which statement is NOT correct about PhoneGap?

A) It doesn’t support for Java phone

216) Which are location providers in android?

A) GPS

217) How many CSS files can be included in a Sencha Touch project?

A) Many

218) You must declare all application components in Manifest file in this way?

A) <provider> elements for content providers

219) In class SQLiteOpenHelper class, there are 2 methods we should usually override. What are they?

A) onCreate() and onUpgrade()

220) Is the main thread called the UI thread?

A) Yes

Android Interview Questions And Answers For 2 Years Experience

221) If the action is ACTION_CALL, what the data field would be ?

A) URI with the number to call

222) Android Async Task create new thread in background?

A) true

223) Which of following is true?

A) myIntent is explicit intent

224) Which method to opena Http connection to an Uri?

A) url.openConnection()

225) Which are location provider in Android ?

A) LBS

226) How many css file can be included in a Sencha Touch project ?

A) many

227) How to set position of a Sencha Touch component?

A) all of above

228) In Android, which of the following statement is CORRECT to reload a layout?

A) setContentView(R.layout.some_layout)

229) In Android, which layout mode defines the positions of each component relative to each other?

A) RelativeLayout

230) Read the following content and answer the question?

A) SmsManager&lt

Android Developer Job Interview Questions

231) Does AsyncTask create new thread in background?

A) True

232) In Android, which manifest permission is needed when use GPS location?

A) ACCESS_FINE_LOCATION

233) How can you define the minimum version of Android required?

A) Using the minSdkVersion attribute in the AndroidMan

234) Toast is a class to display a message in Android. How to set position of a Toast?

A) Using setGravity()

235) In Android, what does dp unit stand for?

A) density-independent

236) In Android, which method you can use to obtain the path of the external storage?

A) getExternalStorageDirectory()

237) What is the permission you need to declare in AndroidManifes?

A) WRITE_EXTERNAL_STORAGE

238) Given a table data (click to see the figure). And assume that this is on a device at 160 dpi?

A) dp * scaler = px

239) In Android, does Service create new thread in background?

A) False

240) To display a notification on upper left of Android screen, which of the following class you need to use?

A) NotificationManager + Notification

Android Based Interview Questions

241) You need to process when user clicks on a notification on upper left of Android screen?

A) PendingIntent

242) Which is the method you need to use to post a notification to be shown in the status bar?

A) notify(…)

243) To develop your own service in Android, what you need to do?

A) implements onStartCommand, onBind, onUnbind, onRebind, onCreate, onDestroy methods

244) To get data from Webserver to Android application, which of the following class you need to use to establish connection?

A) HttpURLConnection

245) What is the name of Android class do we need to use to build up an JSON object?

A) JSONObject

246) Assume that we have an Android object named stored in reader variable, and inside it has a child object named?

A) JSONObject mainObj = reader.getJSONObject(&amp;quot;main&amp;quot;);

247) In Android, can we change the GPS setting by write my own Java code?

A) False

248) When you need to use mp3 file in Android application, which folder you need to create and store mp3 file?

A) raw folder

249) Which of the following is NOT a right codename of Android version?

A) Eclair

250) What is the android:versionCode attribute in the AndroidManifest.xml file?

A) It is used to programmatically check if an application can be upgraded.

Android Interview Questions For 3 Year Experience

251) When you have two or more activities with the same INTENT FILTER action name, the Android OS will display a

A) True

252) Which of the following is the based class for the main application class in an Android application that has a user interface?

A) Activity

253) In Android, which is two location providers that you can use to obtain your position data?

A) LocationManager.GPS_PROVIDER and LocationManager.NETWORK_PROVIDER

254) In Android, the process technical to convert an address into its latitude and longitude is called?

A) Geocoding

255) What happen if the latitude is less than -90 or greater than 90?

A0 It returns an IllegalArgumentException

256) Given the following statements using openFileOutput function to store data into a file in Android?

A) The created file can be accessed by all the other applications at the same time.

257) How many activities are in focus at any time?

A) Just one

258) What is a change Gravity?

A) A tool that changes the linear alignment of a control so that is is aligned to the left, center, right top or bottom of an

259) What onListItemClick() function used for?

A) A method called when an item in a list is selected

260) What setListAdapter() function used for?

A) A command that projects your data to the onscreen list on your device by connecting the listActivity

Android Related Interview Questions

261) In Sencha Touch, app folder contains?

A) the Models, Views, Controllers and Stores for your app

262) Choose right kind of layouts supported in Sencha Touch?

A) Justify Layout

263) As discussed, there are 4 main components in Android application. And in AndroidManifest.xml file, you need to declare?

A) elements for configurations

264) Which shortcut key we can use to change orientation in an AVD simulator?

A) Ctrl+F11

265) In Android, what is contained within the XML files in layout folder?

A) The layouts and direction of screen of the app

266) What is Content Provider?

A) It is a means to share data between applications which are by default run in completely different space by Dalvik instances

267) What is Fragment?

A) A fragment can be displayed without be embedded in an activity.

268) In Android, what is the meaning of the following code in MainActivity class?

A) the main thread calls the UI thread

269) Sencha Touch is?

A) a Java framework

270) There is a kind of animation that using an XML file to define a sequence of pictures using?

A) Tween Animation

Android Interview Questions And Answers For 2 Years Experience

271) Given the following code AsyncHttpClient asynClient = new AsyncHttpClient()?

A) Yes, if it is not yet completed (success or failed)

271) PhoneGap uses HTML5, CSS, and __________ to write and deploy application.

A) JavaScript

272) Can PhoneGap work with Contacts data of mobile device?

A) true

273) Can PhoneGap framework support for playing audio?

A) true

274) When to use ASyncTask?

A) When connecting to external services for specific and short time consuming services

275) What’s Volley and what’s positive and negative with it?

A) An HTTP library that makes networking for the app easier.
Very good at handling multiplie network connections.
Not god for large download or streaming operations.

276) What types of permissions exists?

A) Normal permission – Permission that wont directly risk the user’s privacy

Dangerous permission – can give the app access to the user’s confidential data. I

277) What’s wake locks?

A) It puts the device suspended mode when the user aren’t using the device, to save battery time. If the app wants to do operations in the background without making the go to suspending mode it has request a wake lock from the system

278) What is Wake up sensor?

A) Sensor that will wake the Application Processor (AP). up from its suspended mode to report sensor events

279) What is None wake up sensor?

A) Sensors that doesn’t wake the AP. Instead the sensor event is queued in a FIFO queue

280) What is CryptoObject?

A) Wrapper class for the so called crypto object

Android Technical Interview Questions And Answers For Experienced

281) What is an implicit intent?

A) An implicit intent can specify an action that your app may not be able to do, but other apps on the phone likely could. Before launching this kind of intent, confirm that another app is able to perform the action like so:

// Verify that there are applications registered to handle this intent
// (resolveActivity returns null if none are registered)
if (sendIntent.resolveActivity(getPackageManager()) != null) {
startActivity(sendIntent);
}

282) What are the activity lifecyle callbacks?

A) onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()

It’s best to clean up resources on onStop() and onPause(), since it’s not always guaranteed that onDestroy() will be called.

283) What are three common reasons to use an Intent?

A) To start an activity, start a service (one time operation such as downloading a file), or deliver a broadcast.

284) What is DDMS? Describe some of its capabilities.

A) DDMS is the Dalvik Debug Monitor Server that ships with Android. It provides a wide array of debugging features including:

port-forwarding services
screen capture
thread and heap information
network traffic tracking
incoming call and SMS spoofing
simulating network state, speed, and latency
location data spoofing

285) What is the relationship between the life cycle of an AsyncTask and an Activity? What problems can this result in? How can these problems be avoided?

A) Since the Async task is not tied to the lifecycle of the activity, you need to clean up an Async task if it is still running when an activity is destroyed, or it may lead to a memory leak or an IllegalArgumentException if the Async task tries to update the UI of an Activity that is no longer existing.

286) What is the difference between a fragment and an activity? Explain the relationship between the two.

A) Activity is a single, focused operation that a user can perform.
Activity implementations can make use of one or more fragments to make modular UI design, and scaling UI between small and large screens.

A fragment is essentially a modular section of an activity, with its own lifecycle and input events, and which can be added or removed at will. It is important to remember, though, that a fragment’s lifecycle is directly affected by its host activity’s lifecycle; i.e., when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all of its fragments.

287) What is difference between Serializable and Parcelable ? Which is best approach in Android ?

A) Serializable is a standard Java interface. You simply mark a class Serializable by implementing the interface, and Java will automatically serialize it in certain situations.

Parcelable is an Android specific interface where you implement the serialization yourself. It was created to be far more efficient than Serializable, and to get around some problems with the default Java serialization scheme.

288) What are two launch modes for activities?

A) A launch mode is a way to associate a new instance of an activity to the current task …you can do this either via manifest file or intent flags.

289) What is the difference between Service and IntentService? How is each used?

A) A service runs on the main thread, and an Intent service runs asynchronously.

290) How do you supply construction arguments into a Fragment?

A) Bundle, via Fragment.setArguments(Bundle) and retrieved via Fragment.getArguments(Bundle)

Android Interview Questions For Senior Developer

291) Which method is called only once in a fragment life cycle?

A) onAttach()

292) How to define a JSON Object from a String?

A) JSONObject climate = new JSONObject(jsonString)

Build a URI from a String called GITHUB_BASE_URL
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();

return url;

293) How to Build a URL from URI?

A) URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}

294) Where should we add permission to the applications?

A) AndroidManifest.xml

295) The correct sintaxis to add Internet Permission?

A) <uses-permission android:name=”android.permission.INTERNET” />

OTHER INTERVIEW QUESTIONS

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

Mulesoft Interview Questions And Answers For Experienced

Mulesoft Interview Questions And Answers For Experienced 2018. Here Coding compiler presenting a list of 25 Mule ESB interview questions and answers for experienced and freshers. This list of Mulesoft questions will help you to understand what kind of questions will be asked in Mule ESB interviews. All the best for your Mulesoft job interview and happy learning.

Mulesoft Interview Questions

  1. What is Mulesoft?
  2. What is Mule ESB?
  3. What is MuleSoft Anypoint platform used for?
  4. Is MuleSoft open source?
  5. What is Mulesoft used for?
  6. Is Mulesoft a middleware?
  7. Why do we need ESB?
  8. What are Web Services?
  9. What is the use of Web service?
  10. What are the different types of Web services?
  11. What is a REST web service?
  12. What are the advantages of RESTful web services?
  13. What is SOAP Web Service?
  14. What are the advantages of Soap Web Services?
  15. What is the difference between SOAP and REST?

Mulesoft Interview Questions And Answers

Mulesoft Interview Questions # 1) What is Mulesoft?

Answer ) MuleSoft provides the most widely used integration platform (Mule ESB & CloudHub) for connecting SaaS & enterprise applications in the cloud and on-premise.

Mulesoft Interview Questions # 2) What is Mule ESB?

Answer ) Mule ESB is the runtime engine of Anypoint Platform, is a lightweight Java-based enterprise service bus (ESB) and integration platform that allows developers to connect applications together quickly and easily, enabling them to exchange data.

Mulesoft Interview Questions # 3) What is MuleSoft Anypoint platform used for?

Answer) MuleSoft’s Anypoint Platform of integration products is designed to tie together software as a service (SaaS) and on-premises software.

Mulesoft Interview Questions # 4) Is MuleSoft open source?

Answer ) MuleSoft is open source technology and it provides open source SOA middleware and related products.

Mulesoft Interview Questions # 5) What is Mulesoft used for?

Answer ) Mulesoft is an integration platform that allows developers to connect applications together quickly and easily, enabling them to exchange data.

Mule ESB Interview Questions # 6) Is Mulesoft a middleware?

Answer ) Mule Enterprise Service Bus is a middleware technology that quickly, easily, and securely connects the enterprise. Unlike typical middleware software, Mule as an ESB is a Java-based middleware solution that is easy to use and easy to scale.

Mule ESB Interview Questions # 7) Why do we need ESB?

Answer ) ESB, a middleware technology, is a Bus-like architecture used to integrate heterogeneous systems. In ESB, each application is independent and yet able to communicate with other systems. It, thus, prevents scalability issues and ensures that communication happens only through it.

Mule ESB Interview Questions # 8) What are Web Services?

Answer ) Web service is a functionality or a small piece of program in any programming language that can be accessed over HTTP. Message format can be XML or JSON or any other program as long as the other programs can understand and communicate.

A Web service can be of synchronous or asynchronous type. Any web service has a server-client relationship and it can have multiple clients.

Mule ESB Interview Questions # 9) What is the use of Web service?

Answer ) Web services are XML-based information exchange systems that use the Internet for direct application-to-application interaction. These systems can include programs, objects, messages, or documents. A web service is a collection of open protocols and standards used for exchanging data between applications or systems.

Mule ESB Interview Questions # 10) What are the different types of Web services?

Answer ) There are mainly two types of web services.

  • SOAP web services.
  • RESTful web services.

Mule ESB Interview Questions

Mule ESB Interview Questions # 11) What is a REST web service?

Answer ) Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web.

Mule ESB Interview Questions # 12) What are the advantages of RESTful web services?

Answer ) Advantages of RESTful Web Services

Fast: RESTful Web Services are fast because there is no strict specification like SOAP. It consumes less bandwidth and resource.

Language and Platform independent: RESTful web services can be written in any programming language and executed in any platform.

Can use SOAP: RESTful web services can use SOAP web services as the implementation.

Permits different data format: RESTful web service permits different data format such as Plain Text, HTML, XML and JSON.

Mule ESB Interview Questions # 13) What is SOAP Web Service?

Answer ) SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services. SOAP is a W3C recommendation for communication between two applications.

SOAP is XML based protocol. It is platform independent and language independent. By using SOAP, you will be able to interact with other programming language applications.

Mule ESB Interview Questions # 14) What are the advantages of Soap Web Services?

Answer ) WS Security: SOAP defines its own security known as WS Security.

Language and Platform independent: SOAP web services can be written in any programming language and executed in any platform.

Disadvantages of Soap Web Services:

Slow: SOAP uses XML format that must be parsed to be read. It defines many standards that must be followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.

WSDL dependent: SOAP uses WSDL and doesn’t have any other mechanism to discover the service.

Mule ESB Interview Questions # 15) What is the difference between SOAP and REST?

Answer ) SOAP -> REST
1. SOAP is a protocol. -> REST is an architectural style.
2. SOAP stands for Simple Object Access Protocol. -> REST stands for REpresentational State Transfer.
3. SOAP can’t use REST because it is a protocol.  -> REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.
4. SOAP uses services interfaces to expose the business logic.  -> REST uses URI to expose business logic.
5. SOAP defines standards to be strictly followed. -> REST does not define too much standards like SOAP.
6. SOAP defines standards to be strictly followed. -> REST does not define too much standards like SOAP.
7. SOAP requires more bandwidth and resource than REST. -> REST requires less bandwidth and resource than SOAP.
8. SOAP defines its own security. -> RESTful web services inherit security measures from the underlying transport.
9. SOAP permits XML data format only. -> REST permits different data format such as Plain text, HTML, XML, JSON etc.
10. SOAP is less preferred than REST. -> REST more preferred than SOAP.

Mule ESB Interview Questions And Answers

Mulesoft Interview Questions # 16) What is a Web service API?

Answer ) An API (Application Programming Interface) is the means by which third parties can write code that interfaces with other code. A Web Service is a type of API, one that almost always operates over HTTP (though some, like SOAP, can use alternate transports, like SMTP).

Mulesoft Interview Questions # 17) What is RAML?

Answer ) RAML stands for RESTful API Modeling Language is a YAML-based language for describing RESTful APIs. It provides all the information necessary to describe RESTful or practically RESTful APIs.
RAML is similar to WSDL, it contains endpoint URL, request/response schema, HTTP methods and query and URI parameter.

Mulesoft Interview Questions # 18) Why we use RAML?

Answer) RAML helps client know, what the service is and how all the operations can be invoked. RAML helps the developer in creating the initial structure of this API. RAML can also be used for documentation purpose.

Mulesoft Interview Questions # 19) What are the different types of variables in Mule ESB?

Answer ) The different types of variables in Mule ESB are:

  • Flow Variable
  • Session Variable
  • Record Variable

Mulesoft Interview Questions # 20) What are the various types of Exception Handling in Mule ESB?

Answer ) The types of exception handling in Mule ESB are:

  1. Default Exception Handling
  2. Global Exception Handling
  3. Catch Exception Handling
  4. Choice Exception Handling

Mulesoft Interview Questions # 21) What are the Flow Processing Strategies?

Answer ) Synchronous Flow Processing Strategy, Queued Flow Processing Strategy, Asynchronous Flow Processing Strategy, Thread Per Processing Strategy, Queued Asynchronous Flow Processing Strategy, Non-blocking Flow Processing Strategy, Custom Processing Strategy, Rollback Exception Handling.

Advanced Mulesoft Interview Questions For Experienced

Mulesoft Interview Questions # 22) What is caching and why to use it?

Answer ) Caching is a concept with is used to store frequently used data in the memory, file system or database which saves processing time and load if it would have to be accessed from original source location every time.

Mulesoft Interview Questions # 23) What is Mule Cache Scope and what are its storage types?

Answer ) Caching in Mule ESB can be done by Mule Cache Scope. Mule Cache Scope has 3 storage types –

In-memory: This store the data inside system memory. The data stored with In-memory is non-persistent which means in case of API restart or crash, the data been cached will be lost.

Configuration Properties:

  • Store Name
  • Maximum number of entries
  • TTL (Time to live)
  • Expiration Interval

Managed-store: This stores the data in a place defined by ListableObjectStore. The data stored with Managed-store is persistent which means in case of API restart or crash, the data been cached will no be lost.

Configuration Properties:

  • Store Name
  • Maximum number of entries
  • TTL (Time to live)
  • Expiration Interval
  • Persistence (true/false)

Simple-test-file-store: This stores the data in a file. The data stored with Simple-test-file-store configuration is persistent which means in case of API restart or crash, the data been cached will no be lost.

Configuration Properties:

  • Store Name
  • Maximum number of entries
  • TTL (Time to live)
  • Expiration Interval
  • Persistence (true/false)
  • Name and location of the file

Mulesoft Interview Questions # 24) What are Flow Processing Strategies?

Answer ) Flow processing strategies in Mulesoft are:

  • Synchronous Flow Processing Strategy
  • Queued Flow Processing Strategy
  • Asynchronous Flow Processing Strategy
  • Thread Per Processing Strategy
  • Queued Asynchronous Flow Processing Strategy
  • Non-blocking Flow Processing Strategy
  • Custom Processing Strategy

Mulesoft Interview Questions # 25) How can we create and consume SOAP service in Mule?

Answer ) Creating SOAP Service – We can create a SOAP service same as we create Mule Project With RAML, the only change is instead of RAML we need to import Concert WSDL. Consuming SOAP Service – We can use Web Service Consumer or CXF component in our mule flow to access/consume SOAP service.

Other INTERVIEW QUESTIONS

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