Saturday, 28 May 2016

PL/SQL Interview Questions

PL/SQL Interview Questions
PL/SQL is an advance version of SQL. There are given top list of PL/SQL interview questions with answer.

1) What is PL/SQL?
PL/SQL stands for procedural language extension to SQL. It supports procedural features of programming language and SQL both. It was developed by Oracle Corporation in early of 90's to enhance the capabilities of SQL.

2) What is PL/SQL table? Why it is used?
Objects of type tables are called PL/SQL tables that are modeled as database table. We can also say that PL/SQL tables are a way to providing arrays. Arrays are like temporary tables in memory that are processed very quickly. PL/SQL tables are used to move bulk data. They simplifies moving collections of data.

3) What are the datatypes available in PL/SQL?
There are two types of datatypes in PL/SQL:
1.     Scalar datatypes Example are NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN etc.
2.     Composite datatypes Example are RECORD, TABLE etc.

4) What is the basic structure of PL/SQL?
PL/SQL uses BLOCK structure as its basic structure. Each PL/SQL program consists of SQL and PL/SQL statement which form a PL/SQL block.
PL/SQL block contains 3 sections.
1.     The Declaration Section (optional)
2.     The Execution Section (mandatory)
3.     The Exception handling Section (optional)

5) What is the difference between FUNCTION, PROCEDURE AND PACKAGE in PL/SQL?
Function: The main purpose of a PL/SQL function is generally to compute and return a single value. A function has a return type in its specification and must return a value specified in that type.
Procedure: A procedure does not have a return type and should not return any value but it can have a return statement that simply stops its execution and returns to the caller. A procedure is used to return multiple values otherwise it is generally similar to a function.
Package: A package is schema object which groups logically related PL/SQL types , items and subprograms. You can also say that it is a group of functions, procedure, variables and record type statement. It provides modularity, due to this facility it aids application development. It is used to hide information from unauthorized users.

6) What is exception? What are the types of exceptions?
Exception is an error handling part of PL/SQL. There are two type of exceptions: pre_defined exception and user_defined exception.

7) How exception is different from error?
Whenever an Error occurs Exception arises. Error is a bug whereas exception is a warning or error condition.

8) What is the main reason behind using an index?
Faster access of data blocks in the table.

9) What are PL/SQL exceptions? Tell me any three.
1.     Too_many_rows
2.     No_Data_Found
3.     Value_error
4.     Zero_error etc.

10) What is the maximum number of triggers, you can apply on a single table?
12 triggers.

11) How many types of triggers exist in PL/SQL?
There are 12 types of triggers in PL/SQL that contains the combination of BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and ALL keywords.
  • BEFORE ALL ROW INSERT
  • AFTER ALL ROW INSERT
  • BEFORE INSERT
  • AFTER INSERT etc.

12) What is stored Procedure?
A stored procedure is a sequence of statement or a named PL/SQL block which performs one or more specific functions. It is similar to a procedure in other programming languages. It is stored in the database and can be repeatedly executed. It is stored as schema object. It can be nested, invoked and parameterized.

13) How to execute a stored procedure?
There are two way to execute a stored procedure.
From the SQL prompt, write EXECUTE or EXEC followed by procedure_name.
1.     EXECUTE or [EXEC] procedure_name;  
Simply use the procedure name
1.     procedure_name;  

14) What are the advantages of stored procedure?
Modularity, extensibility, reusability, Maintainability and one time compilation.

15) What are the cursor attributes used in PL/SQL?
%ISOPEN: it checks whether the cursor is open or not.
%ROWCOUNT: returns the number of rows affected by DML operations: INSERT,DELETE,UPDATE,SELECT.
%FOUND: it checks whether cursor has fetched any row. If yes - TRUE.
%NOTFOUND: it checks whether cursor has fetched any row. If no - TRUE.

16) What is consistency?
Consistency simply means that each user sees the consistent view of the data.
Consider an example: there are two users A and B. A transfers money to B's account. Here the changes are updated in A's account (debit) but until it will be updated to B's account (credit), till then other users can't see the debit of A's account. After the debit of A and credit of B, one can see the updates. That?s consistency.

17) What is cursor and why it is required?
A cursor is a temporary work area created in a system memory when an SQL statement is executed.
A cursor contains information on a select statement and the row of data accessed by it. This temporary work area stores the data retrieved from the database and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. Cursor are required to process rows individually for queries.

18) How many types of cursors are available in PL/SQL?
There are two types of cursors in PL/SQL.
1.     Implicit cursor, and
2.     explicit cursor



Cloud Computing Interview Questions

Cloud Computing Interview Questions
There is given Cloud Computing interview questions and answers that has been asked in many companies. Let's see the list of top Cloud Computing interview questions.

1) What is cloud computing?
Cloud computing is an internet based new age computer technology. It is the next stage technology that uses the clouds to provide the services whenever and wherever the user need it.It provides a method to access several servers world wide.

2) What are the benefits of cloud computing?
The main benefits of cloud computing are:
  • Data backup and storage of data.
  • Powerful server capabilities.
  • Incremented productivity.
  • Very cost effective and time saving.
  • Software as Service known as SaaS.

3) What is a cloud?
A cloud is a combination of networks ,hardware, services, storage, and interfaces that helps in delivering computing as a service. It has three users :
  1. End users
  2. Business management users
  3. cloud service provider

4) What are the different data types used in cloud computing?
There are different data types in cloud computing like emails, contracts, images , blogs etc. As we know that data is increasing day by day so it is needed to new data types to store these new data. For an example, if you want to store video then you need a new data type.

5) What are the different layers in cloud computing? Explain working of them.
There are 3 layers in the hierarchy of cloud computing.
Infrastructure as a service (IaaS):It provides cloud infrastructure in terms of hardware as like memory, processor, speed etc.
Platform as a service (PaaS):It provides cloud application platform for the developer.
Software as a service (SaaS)::It provides the cloud applications to users directly without installing anything on the system. These applications remains on cloud.
6) What do you mean by software as a service?
Software As a Service (SaaS) is an important layer of cloud computing. It provides cloud applications like Google is doing. It facilitate users to save their document on the cloud and create as well.

7) What is the platform as a service?
It is also a layer in cloud architecture. This model is built on the infrastructure model and provide resources like computers, storage and network. It is responsible to provide complete virtualization of the infrastructure layer, make it look like a single server and invisible for outside world.

8) What is on-demand functionality? How is it provided in cloud computing?
Cloud computing provides a on-demand access to the virtualized IT resources. It can be used by the subscriber. It uses shared pool to provide configurable resources. Shared pool contains networks, servers, storage, applications and services.

9) What are the platforms used for large scale cloud computing?
Apache Hadoop and MapReduce are the platforms use for large scale cloud computing.

10) What are the different models for deployment in cloud computing?
These are the different deployment model in cloud computing:
Private cloud
Public cloud
Hybrid cloud
Community cloud

11) What is the difference between cloud computing and mobile computing?
Mobile computing and cloud computing are slightly same in concept. Mobile computing uses the concept of cloud computing . Cloud computing provides users the data which they required while in mobile computing, applications run on the remote server and gives user the access for storage and manage.

12) What are the security benefits of cloud computing?
Cloud computing authorizes the application service, so it is used in identity management.
It provides permissions to the users so that they can control the access of another user who is entering into the cloud environment.

13) What is "EUCALYPTUS" in cloud computing? Why is it used?
. It is an acronym stands for Elastic Utility Computing Architecture For Linking Your Program To Useful Systems. It is an open source software infrastructure in cloud computing and used to implement clusters in cloud computing platform. It creates public, private and hybrid cloud. It facilitate a user to create his own data center into a private cloud and use its functionalities to many other organizations.

14) Explain System integrators in cloud computing.
System integrator provides a strategy of a complicated process used to design a cloud platform. It creates more accurate hybrid and private cloud network because integrator have all the knowledge about the data center creation.

15) What are the open source cloud computing platform databases?
MongoDB, CouchDB, LucidDB are the example of open source cloud computing platform database.

16) Give some example of large cloud provider and databases?
Google bigtable
Amazon simpleDB
Cloud based SQL

17) What is the difference between cloud and traditional datacenters?
The cost of the traditional datacenter is higher than cloud because in traditional databases, there is overheating problems and some software and hardware issue.

18) What are the different in Software as a Service (SaaS)?
Simple Multi-tenancy:In this mode, Every user has independent resources and are uniquely different from other users. This is an efficient mode.
Fine grain multi-tenancy:: In this mode, the resources can be shared by many users but the functionality remains the same.

19) Why API's is used in cloud services?
API's (Application Programming Interfaces) is used in cloud platform because:
It provide an alternative way that you don't need to write the fully fledged program.
It makes communication between one or more applications.
It creates applications and link the cloud services with other systems.

20) What are the different datacenters in cloud computing?
1. Containerized datacenter
2. Low density datacenter

21) What do you mean by CaaS?
CaaS is a terminology used in telecom industry as Communication As a Service. CaaS offers the enterprise user features such as desktop call control, unified messaging and desktop faxing.

22) What do you mean by VPN? What does it contain?
VPN stands for Virtual Private Network. VPN is a private cloud that manage the security of the data during the communication in the cloud environment. With VPN, you can make a public network as private network.

23) What are the basic clouds in cloud computing?
There are three basic clouds in cloud computing:
1. Professional cloud
2. Personal cloud
3. Performance cloud


Virtualization in Cloud Computing:-

Virtualization in Cloud Computing:-
Virtualization is the "creation of a virtual (rather than actual) version of something, such as a server, a desktop, a storage device, an operating system or network resources".

In other words, Virtualization is a technique, which allows to share a single physical instance of a resource or an application among multiple customers and organizations. It does by assigning a logical name to a physical storage and providing a pointer to that physical resource when demanded.
OR

In a nutshell, virtualization is software that separates physical infrastructures to create various dedicated resources. It is the fundamental technology that powers cloud computing.

Virtualization software makes it possible to run multiple operating systems and multiple applications on the same server at the same time," said Mike Adams, director of product marketing at VMware, a pioneer in virtualization and cloud software and services. "It enables businesses to reduce IT costs while increasing the efficiency, utilization and flexibility of their existing computer hardware."

The technology behind virtualization is known as a virtual machine monitor (VMM) or virtual manager, which separates compute environments from the actual physical infrastructure.
 
What is the concept behind the Virtualization?
 Creation of a virtual machine over existing operating system and hardware is known as Hardware Virtualization. A Virtual machine provides an environment that is logically separated from the underlying hardware. The machine on which the virtual machine is going to create is known as Host Machine and that virtual machine is referred as a Guest Machine
Types of Virtualization: There are many types of Virtualization, which are following:-
  1. Hardware virtualization
  2. Operating system Virtualization
  3. Server Virtualization
  4. Storage Virtualization

1. Hardware Virtualization:- When the virtual machine software or virtual machine manager (VMM) is directly installed on the hardware system is known as hardware virtualization.

The main job of hypervisor is to control and monitoring the processor, memory and other hardware resources.

After virtualization of hardware system we can install different operating system on it and run different applications on those OS.

Where Usage of Hardware virtualization:
Hardware virtualization is mainly done for the server platforms, because controlling virtual machines is much easier than controlling a physical server.

2. Operating system Virtualization: When the virtual machine software or virtual machine manager (VMM) is installed on the Host operating system instead of directly on the hardware system is known as operating system virtualization. 

Where Usage of Operating system Virtualization: 
Operating System Virtualization is mainly used for testing the applications on different platforms of OS.

3. Server Virtualization:- When the virtual machine software or virtual machine manager (VMM) is directly installed on the Server system is known as server virtualization.

Where Usage of Server Virtualization:-
 Server virtualization is done because a single physical server can be divided into multiple servers on the demand basis and for balancing the load.
4. Storage Virtualization:- Storage virtualization is the process of grouping the physical storage from multiple network storage devices so that it looks like a single storage device. Storage virtualization is also implemented by using software applications. Where Usage of Storage Virtualization:
Storage virtualization is mainly done for back-up and recovery purposes.

How does virtualization work in cloud computing?


Virtualization plays a very important role in the cloud computing technology, normally in the cloud computing, users share the data present in the clouds like application etc, but actually with the help of virtualization users shares the Infrastructure.

The main usage of Virtualization Technology is to provide the applications with the standard versions to their cloud users, suppose if the next version of that application is released, then cloud provider has to provide the latest version to their cloud users and practically it is possible because it is more expensive.

To overcome this problem we use basically virtualization technology, By using virtualization, all severs and the software application which are required by other cloud providers are maintained by the third party people, and the cloud providers has to pay the money on monthly or annual basis.



Tuesday, 12 April 2016

Reference type and value type:-



Reference type and value type:-


Before going to decision value type and reference type we should know about Data type
What is Data type?
                       
Data type means difference type of data such as integer, string, char, float etc.
But we can also say data type is in the form of structure or class or reference.
As we know that there are two type of memory in for storing values at runtime of program in C#.
1.      Stack
2.      Heap
The data types which are value type it will store on stack memory.
The data types which are reference or class type it will store on heap memory.
Difference between a Value Type and a Reference Type
The Types in .NET Framework are either treated by Value Type or by Reference Type. A Value Type holds the data within its own memory allocation and a Reference Type contains a pointer to another memory location that holds the real data. Reference Type variables are stored in the heap while Value Type variables are stored in the stack.

Value Type:
A Value Type stores its contents in memory allocated on the stack. When you created a Value Type, a single space in memory is allocated to store the value and that variable directly holds a value. If you assign it to another variable, the value is copied directly and both variables work independently. Predefined datatypes, structures, enums are also value types, and work in the same way. Value types can be created at compile time and Stored in stack memory, because of this, Garbage collector can't access the stack.
e.g.

               int x = 3033;

Here the value 3033 is stored in an area of memory called the stack.
Reference Type:
Reference Types are used by a reference which holds a reference (address) to the object but not the object itself. Because reference types represent the address of the variable rather than the data itself, assigning a reference variable to another doesn't copy the data. Instead it creates a second copy of the reference, which refers to the same location of the heap as the original value. Reference Type variables are stored in a different area of memory called the heap. This means that when a reference type variable is no longer used, it can be marked for garbage collection. Examples of reference types are Classes, Objects, Arrays, Indexers, Interfaces etc.
e.g.

               int[] iArray = new int[33];

In the above code the space required for the 30 integers that make up the array is allocated on the heap.
Stack and Heap
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM.



Differences between Stack and Heap
Stack and a Heap ?
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM .
Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and it's allocation is dealt with when the program is compiled. When a function or a method calls another function which in turns calls another function etc., the execution of all those functions remains suspended until the very last function returns its value. The stack is always reserved in a LIFO order, the most recently reserved block is always the next block to be freed. This makes it really simple to keep track of the stack, freeing a block from the stack is nothing more than adjusting one pointer.
Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory . Element of the heap have no dependencies with each other and can always be accessed randomly at any time. You can allocate a block at any time and free it at any time. This makes it much more complex to keep track of which parts of the heap are allocated or free at any given time.

You can use the stack if you know exactly how much data you need to allocate before compile time and it is not too big. You can use heap if you don't know exactly how much data you will need at runtime or if you need to allocate a lot of data.
In a multi-threaded situation each thread will have its own completely independent stack but they will share the heap. Stack is thread specific and Heap is application specific. The stack is important to consider in exception handling and thread executions.