Showing posts with label INTERVIEW QUESTIONS.. Show all posts
Showing posts with label INTERVIEW QUESTIONS.. Show all posts

Tuesday, 15 July 2014

What is Memory Allocation ? A Simple Answer.



MEMORY ALLOCATION ( DYNAMIC OR STATIC)


It all starts from a data that is stored in the memory , that data is given some memory .This Process of Giving memory is Called a memory allocation . The memory can be allocated in two manners : DYNAMICALLY AND STATICALLY .

STATIC MEMORY ALLOCATION 

-This memory allocation process reserves fixed mount of memory before actual processing takes place , and because of that , the number of elements to be stored must be predetermined . 
Such memory allocation process is  basically called as static memory allocation .

-The Arrays are allocated memory by this process only.


DYNAMIC MEMORY ALLOCATION

-This Type of memory allocation process gives allocation of memry during the program execution itself, as and when it is needed.This process of allocating memory is called  dynamic memory allocation .
-It also provides technique to release the memory , when memory is not required anymore.

-Data structures like Linked Lists and Tress use this very technique for their memory allocation.

Basics of Linked Lists , Stacks And Queues In C++


Linked Lists , Stacks And Queues


The very basic definitions that a person should know who is learning C++ are :

Linked ListsIT IS A  LINEAR COLLECTION OF DATA ELEMENTS , CALLED AS NODES POINTING TO THE NEXT NODES BY MEANS OF POINTER.

Stacks :  A STACK IS A LINEAR  STRUCTURE IMPLEMENTED IN LIFO (LAST IN FIRST OUT )MANNER WHERE INSERTION AND DELETIONS ARE  RESTRICTED TO OCCUR ONLY AT ONE END - THAT END IS SATCK'S TOP.

Queues: A QUEUE IS  ALSO A LINEAR DYNAMIC STRUCTURE IMPLEMENTED IN FIFO( FIRST IN FIRST OUT) MANNER WHERE INSERTIONS CAN OCCUR AT THE " REAR ' END  , AND THE BASIC DELETIONS OCCUR ONLY AT " FRONT" END.


IMPORTANT POINTS 

LIFO

-Means Element last inserted would be the first one to be deleted.

-The Stack is also  a DYNAMIC DATA STRUCTURE as it can grow( //with increase in number of elements //) or it can shrink(//with decrease in number of elements //).

FIFO:

-Means elements are deleted  in the same order as they are inserted into the queue.

Friday, 27 June 2014

Definition of Inheritance in C++ with Example.

 

Inheritance in C++ with Example.




Inheritance in C++ is basically the capability of one class to inherit properties from another class . For example , house is a class wherefrom class chiarhouse inherits as given below:


class house
{
protected:
char name[25];
int rollno;
public:
void  readhouse ();
void showhouse ();
};
class chairhouse: protected house
{
protected :
char tables[50];
public:
 void readchahou();
void showchahou();
};
 

Thursday, 26 June 2014

How can a Class enforce data- hiding, abstraction and encapsulation..

Class enforces data- hiding, abstraction and encapsulation..


What does a class actually do, it binds together data and its associated functions under one unit and because of that enforcing encapsulation as encapsulation means wrapping up of the data and associated functions together into a single unit .

And a Class groups its members into three sections : as private , protected and public.The members like private and protected remains hidden from the outside world.Thus through these private and protected members a  class enforces data hiding.

The Main function of the public member is only to give the important and essential information to the outside world and because of that rest things remain hidden , which is also called as abstraction. As it basically means representation of essentials features without including the background details .

Tuesday, 24 June 2014

What is the difference between Type Casting and Automatic Type Conversion in C++...with Examples.

Difference Between Type Casting and Automatic Type Conversion ...with Examples.



Automatic Type Conversion

IN C++  an automatic type casting  or implicit type conversion is a type of data type conversion which is  performed by the compiler on its own. It basically occurs whenever an expression has different data type .In this type of conversion , the data type which are smaller are converted into larger data type to avoid data loss.  

Example:

int x=3,y=1,c;
float p=11.5,q;
q=p/x;

In the above case the expression p/x, x's type will automatically be promoted to bigger type float  and then the expression will be evaluated .

TYPE CASTING 

The type casting or explicit type conversion  is user - defined forced conversion . It is basically done with the help of operator ( ) called as casting operator . 

Example:

float p=(float) 22/7;

Explanation 

Then 22 will be first converted to float type and this expression will get  evaluated.

Friday, 20 June 2014

TECHNICAL INTERVIEW QUESTIONS ON SQL / PLSQL-- SET 3






INTERVIEW QUESTIONS ON SQL / PLSQL-- SET3




1. Almost all the DATE functions return a value of data type DATE , except

(A)MONTHS_BETWEEN
(B)ROUND
(C)NEXT_DAY
(D) TRUNC




2.The SELECT statement 

SELECT LOWER ('AbCd') , UPPER('AbCd'), INITCAP ('AbCd EFgh') FROM DUAL;

will print

(A)abcd ABCD Abcd Efgh
(B)abcd ABCD ABCD EFGH
(C)abcd ABCD abcd efgh
(D)abcd ABCD aBCD eFGH




3.The sql statement

SELECT SUBSTR('123456879' , INSTR( 'bacabcabc' , 'b', 4)) FROM DUAL;

prints

(A)2345
(B)6789
(C)56789
(D)89


Thursday, 19 June 2014

TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 5





INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 5





1. Automatic conversion from priitive type to an object of the corresponding wrapper class is called

(A)  coercing
(B)  casting
(C) boxing
(D) widening 



2.  The fact that any program can print using system.out.print , implies that 

(A)  system is defined in the package java.lang
 (B) system is a class name
(C) out is an object 
(D) print is a method 



CLICK HERE TO SEE THE ANSWER

ANSWER IS  (A) , (B), (C) AND (D)


3. Which of the following are valid identifers?

(A) $ABC 
(B) _____(5 consecutive underscores)
(C) main
(D) protected



CLICK HERE TO SEE THE ANSWER

ANSWER IS (A) ,(B) AND (C)

TECHNICAL INTERVIEW QUESTIONS ON SQL / PLSQL-- SET 1




  
INTERVIEW QUESTIONS ON SQL / PLSQL-- SET 1


1. The sql statement 

NOT BETWEEN 10 AND 20

(A)  Displays NULL values
(B) Does not display NULL values
(C) May display NULL  values
(D)  None of these



2. The sql statement

SELECT SUBSTR('123456789', INSTR('ABCABCABC', 'B' ), 4) FROM DUAL;

prints

(A) 6789
(B) 2345
(C) 1234
(D) 456789



3.Which of the following group functions ignore NULL values ?

(A)  MAX
(B)COUNT
(C) SUM
(D) COUNT(*)


CLICK HERE TO SEE THE ANSWER

ANSWER IS (A) , (B) AND (C)


TECHNICAL INTERVIEW QUESTIONS ON SQL / PLSQL-- SET 2





 INTERVIEW QUESTIONS ON SQL / PLSQL-- SET 2



1. From the following combinations of wildcard characters , choose those that are equivalent.

(A) %
(B) _%
(C) %_
(D) __


CLICK HERE TO SEE THE ANSWER

ANSWER IS (B) AND (C)


2. The sql statement 

SELECT  ROUND (45.926 , -1)  FROM DUAL ;

(A) is illegal
(B) prints garbage 
(C) prints 045.926
(D) prints 50



3. Which of the following must be enclosed in double qoutes?

(A)Dates
(B)Column Alias
(C)Strings
(D) All of these


TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 3






TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 3




1.The given statements

   double whatIsThis = -1.0/0.0;
    system .out .println(whatIsThis);


(A) -Math .floor(-x)
(B)  -Math .cell(-x)
(c)  prints -Infinity
(D)  prints a garbage value




2.Math .cell(X) has the same value as


(A)  -Math .floor(-x)
(B) -Math .cell(-x)
(C) -Math .floor(-x)
(D) -Math .cell(x)




3. Let m be a variable of datatype byte .The value of m<<4 is same as


(A)  m x 2^4        (B)  4m             (C)   m^4              (D)   4+ m




TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 2


  

TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA 
 SET 2




1. Consider the following statement

    system .out.print ( math .round (math .random()));

This can print


(A)  only 0
(B) only 1
(C) only 0 or 1
(D) Any non-negative integer




2. Is null an object?


(A)  Yes
(B) No
(C) Sometimes yes
(D) None of these




3. Which of the following is used to get the error message for exception that was thrown?


(A) printMessage 
(B) extractMessage
(C) thrownMessage 
(D)  getMessage




4. Subclass is also called as

TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA - SET 1






TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON JAVA
 SET 1




1. Which of the following is not a primitive data type ?


(A)  boolean
(B)  byte
(c)  string
(D)double




2. The given statement 

byte var = ~9
system.out.println(var);


(A)  prints -9
(B)  prints -10
(C) prints -119
(D) prints 118




3. The operators || , && , * , ! , if arranged in the ascending order of precendence, read


(A)  && , || , * , !

(B) || , && , * , !
(C)  || , && , ! , *
(D)  ! , || , && , *



Wednesday, 18 June 2014

TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 5



SET 5  TECHNICAL INTERVIEW QUESTIONS ON C++


1.  Select the correct Statements

(a)  A destructor is not inherited                         (b)  A constructor cannot be called explicitly

(c) A destructor can be called explicitly             (d) A contructor is not  inherited



CLICK HERE TO SEE THE ANSWER

ANSWER IS (a) , (b) and (d)


2.  The compiler identifies a virtual function to be pure

(a)  by the presence of keyword  PURE             (b)  by its location in the program

(c) if it is equated to 0                                       (d) none of the above


3.  A class having no name


(a)  is not allowed

(b) cannot have a contructor

(c)  cannot have a destructor

(d) cannot be passed as argument


CLICK HERE TO SEE THE ANSWER

ANSWER IS (b) , (c) and (d)


TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 4







SET 4 TECHNICAL INTERVIEW QUESTIONS ON C++


1. Consider the following code

void main()
{
int x =10;
int &p=x;
cout<< &p<<&x;
}

(a) prints 10 and the adress of x                                (b)  results in run time error

(c)  prints the address of x twice                                (d)  prints the adress of p twice.


CLICK HERE TO SEE THE ANSWER

ANSWER IS   (C) AND (D)


2. Which of the following is not an storage class in c++

(a)  register               (b)  auto                   (c) mutable                    (d)  dynamic



3. Consider the following program segment

static char x[3] = " 1234";
cout<<x;


These two segments with complete program will print

(a) prints 123                                           (b) prints 12345

(c)  prints 1234 followed by some junk         (d)   will give a compilation error


TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 3






SET 3 QUESTIONS FOR TECHNICAL INTERVIEW  ON C++

1.  Suppose many functions have the same name, which of the following information , if there , will be used by the compiler to invoke  the correct function to be used ?

(a)  The operator ::                                                          (b)  The return value of the function

(c)  Function signature                                                     (d)  None of the above


CLICK HERE TO SEE THE ANSWER

ANSWER IS (a ) and ( c).


2. A constructor  is called  whenever

(a)  a class is used                                                             (b)  an object is used

(c) all of these                                                                    (d) an object is declared


CLICK HERE TO SEE THE ANSWER

ANSWER IS  ( D)


3. Which of the following are correct for constructors and destructors ?

(a)  Constructors can take arguments but destructors cannot.

(b) Constructors can be overloaded but destructors cannot.

(c) All of these

(d)  Destructors can take arguments but constructors cannot.


CLICK HERE TO SEE THE ANSWER

ANSWER IS (A) and (B)


TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 2


 TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++
 -- SET 2 --


 1. The following C++ code results in

#include "iostream.h"
void main(void)
{
cout<<(int i = 5)<<(int j=6);
}

(a)  compilation error                          (b) run time error

(c) link time error                               (d)  none of the above




2.  Reusability is a desirable feature of a language as it

(a)  decrease the testing time                   (b) lowers the maintence cost

(c)  reduces the compilation time             (d) reduces the execution time



3. Choose the correct statements regarding inline functions.

(a)  It speeds up execution                      (b)  It slows down execution

(c)  It increases the code size                  (d)  It decreases the code size



TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 1





TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++

SET - 1




 1. C++ Was Originally developed by

(a) clocksin and mellsih                                      (b)  Donal E.Knuth

(c) Sir Richard Hadlee                                       (d)  Bjarne Stroustrup



2. Cfront

(a) is the front end of a C compiler

(b) is the pre-processor of a C compiler

(c) is  a tool that translate  a C++ code to its equivalent C code

(d) all of these




3. The following program fragment

int i=10;
void main()
{
int i =20;
{
int i =30;
cout<<i<<::i;
}
}

(a) prints 3010                             (b) prints 3020
(c) compiler error                         (d) Run-time error