Originally published by me in another blog at DevOps Interview Questions and Answers and reproduced here for larger audience.
Sunday, 25 December 2016
DevOps Interview Questions
Vagrant Interview Questions
Originally published by me in another blog at Vagrant Interview Questions and reproduced here for larger audience.
1. What is Vagrant
?
1. What is Vagrant
2. How Vagrant helps making development environment easy?
3. Can you name some hypervisors on which Vagrant provides wrapper around?
4. Does Vagrant also provides wrapper of dev-ops tools?
5. Which all dev-ops tools does Vagrant provides wrapper over?
6. Does Vagrant supports Docker Containers also?
7. Which server environments Vagrant provides support?
8. What all steps required to configure Vagrant?
9. What are the commands for making Vagrant up and running?
10. What are the benefits of using Vagrant?
11. What is vagrantfile and its use?
12. How Vagrant helps programmers in development?
13. How Vagrant helps operations engineers in devops?
14. How Vagrant benefits software designers?
15. How does Vagrant provider helps you to manage other Virtual Environment
16. How can you share your environment with others?
17. What is Vagrant Provisioning?
18. What does synced folders do?
19. What is Vagrant Multi-Machine?
20. What is Vagrant box?
Cloud Computing Interview Questions and Answers
Cloud is an emerging trend these days and that is why these days interviewer is asking more questions on cloud computing. Cloud especially IAAS cloud and virtualization are very close terms and you should also know virtualization interview questions for IAAS.
Here are some basic questions on cloud computing:
Here are some basic questions on cloud computing:
What is cloud computing and why should we go for using cloud computing(advantages)?
Cloud Computing is a model in which configurable and scalable computing resources (storage, network, application etc) are provided as a service to end user over internet with minimal effort.
Basically cloud computing has the following features:
(a) Utility computing
(b) Programmatic
(c) Grid
(d) On-demand
(e) Scalable
(f) Usage based billing
(g) Virtualization
Basically cloud computing has the following features:
(a) Utility computing
(b) Programmatic
(c) Grid
(d) On-demand
(e) Scalable
(f) Usage based billing
(g) Virtualization
The advantages / benefits of cloud computing is as under:
(a) Cost effective
(b) Highly scalable
(c) Pay as per use
(d) Only operational expenditure (No setup expenditure)
(e) Data backup
(f) Quick restore in case of disaster
(g) Software as a service
(h) Minimal management effort
(i) Time Saving
(a) Cost effective
(b) Highly scalable
(c) Pay as per use
(d) Only operational expenditure (No setup expenditure)
(e) Data backup
(f) Quick restore in case of disaster
(g) Software as a service
(h) Minimal management effort
(i) Time Saving
What are different types of cloud?
According to deployment -
- Public cloud
- Private cloud
- Hybrid cloud
- Community cloud
According to service -
- IAAS - Infrastructure as a service
- PAAS - Platform as a service
- SAAS - Software as a service
What is Public cloud?
A non-proprietory model where computing resources such as storage, network, applications etc are available to general public for use. It generally works on pay per use model. It is self managed solution with shared resources (with other public) with very less control over performance factor.
What is Private cloud?
Private cloud is a model where a set of non-shared computing resource is dedicated to a single organization and is secured enough so that no other client from the same datacenter can access it. Alternatively, it can also be deployed in-house by the organisation. Also, it has more control over the performance of computing resource.
What is Community cloud?
A community cloud is a multiple user cloud where infrastructure is shared amongst multiple participating organisations from a specific community with common concerns (for eg. regulatory compliance etc) . With added layer of privacy, security and policy compliance, Community Cloud has the properties of both Public cloud (Pay as per use) as well as that of Private cloud.
What is Hybrid cloud?
Hybrid cloud is the combination of both Public and Private cloud. Suppose an organisation wants to achieve cost-effectiveness with security then hybrid cloud is the best solution. It can setup private cloud for secured sites and public cloud for sites where security is really not a concern. Since public cloud is relatively cost-effective and is highly scalable as compared to private cloud which is more secure, such a setup achieves both security and cost-effective.
That's all for interview questions on cloud computing.
That's all for interview questions on cloud computing.
Puppet Interview Questions
What is Puppet?
Puppet is the configuration management tool for unix based and windows systems.
JSF Interview Questions
What is JSF?
JavaServer Faces is a specification for building web based UI (User Interface) for Java Web Applications. It has been made as a standard for Java Community Process. JSF provides widgets like buttons, hyperlinks, checkboxes, etc. in different ways. It has extensible facilities for validating inputs and converting objects to and from strings for display.What is JavaServer Faces event and listener model?
It provides way to determine the way events emitted by JavaServer Faces UI components are handled.What is JavaServer Faces conversion model?
JSF conversion model provides way to convert string-based markup generated by JavaServer Faces UI components and server-side Java components (objects) and vice-versa.What is JavaServer Faces UI class?
JavaServer Faces UI component class defines the properties and behaviour of a JavaServer Faces UI component.Define JavaServer Faces expression language?
To bind the associated component to a bean property or to bind the associated component's value to a method or an external data source, such as a bean property, simple expression language is being used by a JavaServer Faces UI component tag attributes.What is JSF life cycle and its phases?
(i) Restore view phase(ii) Apply request values phase
(iii) Process validations phase
(iv) Update model values phase
(v) Invoke application phase
(vi) Render response phase.
What are tags in JSF?
To enhance the view of the JSP Pages, JSF tags are generally used. Remember JSP pages represent views. Each tag gives rise to an associated component. JSF provides 43 tags in two standard JSF tag libraries: 1. JSF Core Tags Library 2. JSF Html Tags Library.Java Queue with code example
What is Queue:
Queue is one of an important data structure which typically (but not necessarily) abide by rule of FIFO (First In First Out) i.e. the element which will be inserted first will be removed from the queue in that insertion order. The time complexity of queue in best case scenario should be O(1) both in case of element insertion or element removal.Queue in Java:
In Java, Queue (java.util.Queue) is defined as an interface. It means that any java class that can be called as Queue will need to abide by contract defined in java.util.Queue interface by either implementing Queue interface or its sub-interface (BlockingQueue, BlockingDeque, Deque, TransferQueue). If you need skeleton class on top of which you can write up your own queue implementation, then there is AbstractQueue class that will come handy (as name indicates its an abstract class).Queue Sub-interface:
There are four interface which extends Queue. These are:
- BlockingQueue - Provide additional feature of thread blocked (go to wait state) while fetching from empty queue and while trying to insert element when the queue is full.
- BlockingDeque - Provide additional feature of thread blocked (go to wait state) while fetching from empty queue and while trying to insert element when the deque is full.
- Deque - Deque is double ended queue, which means the insertion and deletion of element is allowed from both end.
- TransferQueue - The thread inserting element to TransferQueue may wait for any consuming thread to retreive the element. Useful in message passing applications.
Implementation in Java:
There are already ready-to-use Queue (Java Classes) provided in Java library. These are:- LinkedList - Similar to Double Linked list i.e. each element has reference to previous and next element. That is why it is preferred over ArrayList when the insertion and deletion operation is more than just reading the list. This is an important interview question on collection framework for fresher as the main difference between ArrayList and LinkedList.
- PriorityQueue - Inserted elements are ordered as per natural ordering or as per comparator provided. This means in PriorityQueue, the elements is not required to follow FIFO model as there can be comparator which can insert element based on comparator result in between the queue itself.
- ArrayBlockingQueue - A bounded blocking queue. Consider ArrayBlockingQueue as a fixed size array acting on FIFO model with additional feature of thread gets blocked when queue is full / empty.
- LinkedBlockingQueue - An optionally bounded blocking queue (Blocking queue feature can be applicable only to bounded collections). Consider LinkedBlockingQueue as Linkedlist following FIFO model with its size can be limited (bounded) or unlimited (Integer.MAX_VALUE). Threads cannot be blocked in unbounded LinkedBlockingQueue during insertion, so blockingqueue feature will not be fully applicable to unbounded LinkedBlockingQueue (only in case of retrieval).
- PriorityBlockingQueue - An unbounded Priority Queue with feature of Blocking Queue is limited to the retreival of its element (as this queue is unbounded).
- ConcurrentLinkedQueue - An unbounded LinkedBlockingQueue with thread-safety features. This means multiple threads can insert / delete / retreive elements on ConcurrentLinkedQueue parallely. Since it is unbounded, blocking queue feature is limited to the retreival of element only (i.e. thread attempting to retreive element from empty queue will get blocked only waiting till the insertion of element).
- ConcurrentLinkedDeque - An unbounded thread safe "double ended queue" based on linked nodes.
- ArrayDeque - A deque with resizeable array. Since it has array implementation, its performance is better than Stack and Linkedlist. However it is not thread-safe.
- DelayQueue - An unbounded Blocking queue (no limit on size) to which an element can only be retreived after its delay has expired.
- LinkedBlockingDeque - An optionally bounded blocking "double ended queue". If size is specified when creating LinkedBlockingDeque object it will belcome bounded otherwise unbounded. Thread will get blocked in LinkedBlockingDeque while retreiving an empty queue and will get blocked while adding an element to full bounded LinkedBlockingDeque. It is based on linked nodes.
- LinkedTransferQueue - An unbounded TransferQueue based on linked nodes. The size method is not a constant time operation and may vary.
- SynchronousQueue - It works by putting the insert operation thread to wait for remove operation by another thread. In other words, the thread inserting element to Synchronous Queue gets blocked till another thread takes the element out and vice-versa.
Queue Behaviour / Usage :
Queue provides additional way to insert, delete and examine object. For each insert, delete and examine operation, there are corresponding 2 methods, one throws exception and other return special value in case of failure.Besides this, any Queue will also have all the properties of Collection as Queue interface extends Collection interface
Methods of Queue Interface:
As discussed above, the queue provides 2 methods for each insert, delete and examine operation.These are:
Insert Operation:
add(e) -> returns true when success and throws exception in case of failure.offer(e) -> returns true when success and false in case of failure.
Remove Operation:
remove() -> removes the head element. Returns head element when success and throws exception in case of failure.poll() -> removes the head element. Returns head element when success and returns null in case of failure.
Examine Operation:
element() -> retrieves (but do not remove) the head element. Returns element when true and throws NoSuchElementException in case of failure (i.e. when the queue is empty).peak() -> retrieves (but do not remove) the head element. Returns element when true and null in case of failure (i.e. when the queue is empty)
Code Example:
import java.util.LinkedList;
import java.util.Queue;
public class QueueExample {
public static void main (String[] args) {
Queue que = new LinkedList();
que.add("first");
que.offer("second");
que.offer("third");
System.out.println("Queue Print:: " + que);
String head = que.element();
System.out.println("Head element:: " + head);
String element1 = que.poll();
System.out.println("Removed Element:: " + element1);
System.out.println("Queue Print after poll:: " + que);
String element2 = que.remove();
System.out.println("Removed Element:: " + element2);
System.out.println("Queue Print after remove:: " + que);
}
}
Output:
Queue Print:: [first, second, third]
Head element:: first
Removed Element:: first
Queue Print after poll:: [second, third]
Removed Element:: second
Queue Print after remove:: [third]
Conclusion:
That's all for example of Queue in Java. I will provide details of each implementing class of Queue Interface in separate post. It is important to mention that all queue methods which throws exceptions needs to be handled wisely.JMS Interview Questions and Answers
Java Message Service is an interface for point-to-point queuing and Topic (Publish/Subscribe). For interview purpose, here are some questions along with its answers.
What is JMS?
Java Message Service is an interface implemented by most JAVAEE containers to provide point-to-point queuing and topic (publish/subscribe) behavior. JMS is frequently used by EJB's that need to start another process asynchronously.For example, instead of sending an email directly from an Enterprise JavaBean, the bean may choose to put the message onto a JMS queue to be handled by a Message-Driven Bean (another type of EJB) or another system in the enterprise. This technique allows the EJB to return to handling requests immediately instead of waiting for a potentially lengthy process to complete.
What type messaging is provided by JMS?
JMS provides both synchronous and asynchronous messaging.How many messaging models does JMS provide?
JMS provides two messaging models, publish-and-subscribe (Topic) and point-to-point queuing.What is point-to-point model in JMS?
A point-to-point model is based on the concept of a message queue i.e. Senders send messages into the queue, and the receiver reads messages from this queue. In the point-to-point model, several receivers can exist, attached to the same queue but the message will be delivered to one of them. Its a one-to-one communication.What are the advantages of JMS?
One of the main advantages of JMS is that it is asynchronous. Thus not all the components need to be up all the time for the application to function as a whole.What is the publish-and-subscribe model in JMS?
A publish-subscribe model is based on the message topic concept. In other words, publishers send messages to a topic, and all subscribers of the given topic receive these messages. Its a one-to-many communicationWhat is JMS administered object?
A preconfigured JMS object (a resource manager connection factory or a destination) created by an administrator for the use of JMS clients and placed in a JNDI namespaceWhat is publish/subscribe messaging?
With publish/subscribe message passing the sending application/client establishes a named topic in the JMS broker/server and publishes messages to this queue. The receiving clients register (specifically, subscribe) via the broker to messages by topic; every subscriber to a topic receives each message published to that topic. There is a one-to-many relationship between the publishing client and the subscribing clients.Which models are supported by JMS?
Publish/subscribe (pub/sub). This model allows a client (publisher) to send messages to a JMS topic. These messages are retrieved by other clients (subscribers) (it may happen so that a topic has no subscribers) asynchronously. Pub/sub model requires a broker distributing messages to different consumers.
What are the different parts of a JMS message?
A JMS message contains three parts:- Header
- Optional properties
- Optional body
What is the main parts of JMS applications?
The main parts of JMS applications are:- ConnectionFactory and Destination
- Connection
- Session
- MessageProducer
- MessageConsumer
- Message
What is the role of the JMS Provider?
The JMS provider handles security of the messages, data conversion and the client triggering. The JMS provider specifies the level of encryption and the security level of the message, the best data type for the non-JMS client.What is the difference between Java Mail and JMS Queue?
JMS is the ideal high-performance messaging platform for intrabusiness messaging, with full programmatic control over quality of service and delivery options.JavaMail provides lowest common denominator, slow, but human-readable messaging using infrastructure already available on virtually every computing platform.
Does JMS specification define transactions?
JMS specification defines a transaction mechanisms allowing clients to send and receive groups of logically bounded messages as a single unit of information. A Session may be marked as transacted. It means that all messages sent in a session are considered as parts of a transaction. A set of messages can be committed (commit() method) or rolled back (rollback() method). If a provider supports distributed transactions, it's recommended to use XAResource API.What is synchronous messaging?
Synchronous messaging involves a client that waits for the server to respond to a message. So if one end is down the entire communication will fail.What is asynchronous messaging?
Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server. So even if the client is down , the messaging will complete successfully.How does a typical client perform the communication?
- Use JNDI to locate administrative objects.
- Locate a single ConnectionFactory object.
- Locate one or more Destination objects.
- Use the ConnectionFactory to create a JMS Connection.
- Use the Connection to create one or more Session(s).
- Use a Session and the Destinations to create the MessageProducers and MessageConsumers needed.
- Perform your communication.
What is JMS session?
A single-threaded context for sending and receiving JMS messages. A JMS session can be nontransacted, locally transacted, or participating in a distributed transaction.Where should we use JMS?
JMS is the ideal high-performance messaging platform for intrabusiness messaging, with full programmatic control over quality of service and delivery options.What is the difference between durable and non-durable subscriptions?
A durable subscription gives a subscriber the freedom of receiving all messages from a topic, whereas a non-durable subscription doesn't make any guarantees about messages sent by others when a client was disconnected from a topic.What is the difference between Message producer and Message consumer?
Messaging systems provide a host of powerful advantages over other conventional distributed computing models. Primarily, they encourage "loose coupling" between message consumers and message producers. There is a high degree of anonymity between producer and consumer: to the message consumer, it doesn't matter who produced the message, where the producer lives on the network, or when the message was produced.
Subscribe to:
Posts (Atom)