Pages

Thursday, 5 May 2011

interview questions



C Interview Questions


Comment lines are
a compiled in the object code
b ignored by the compiler
c included in the executable code
d ignored by the linker.
A syntax error is signalled by the
a compiler
b linker
c editor
d run time system.
Typically a variable defined in a function/procedure/module has
a scope for the whole file
b global scope
c local scope
d retains its value between calls.
A program construct used for selection is
a if…else

b for loop
c while loop
d a sequence.
What is the result of the following expression?
6+12*3-4/2
a 22
b 25
c 40
d 52
What is the result of the following expression?
5+((2*(9+5))-4)/2
a 12.5
b 14.5
c 15
d 17
A run-time error is ALWAYS caused by
a division by zero

b incorrect logic
c error in syntax
d incorrect linkage
When a program is running the value of a constant
a can be changed
b cannot be used
c is always hidden
d cannot be changed.
The type of a function/procedure/module is determined by
a its arguments
b the value returned
c its name
d the address returned.
Which type of code is editable?
a object
b executable
c library
d source.
Test results are proved by a comparison of
a logical to syntax errors
b expected to actual input
c expected to actual output
d run time to logical errors
An argument passed by reference passes
a a global variable
b a constant
c a value
d an address
Every call to a function is checked by the compiler against the
a parameter list
b variable description
c function prototype
d program prototype
The function atoi() returns the type
a char
b float
c integer
d double
How many characters can a string hold when declared as follows?
char name[20];
a 18
b 19
c 20
d 21
Directives are translated by the
a pre-processor
b compiler
c linker
d editor
How many bytes does “D” use?
a 0.
b 1.
c 2.
d 3.
A standalone executable file requires
a no run time system
b a run time system
c a development environment
d compilation.
The switch construct is used for
a sequence
b selection
c iteration
d flags.
How many times will the following loop execute?
for(j=1; j<=10; j=j-1);

a 1.
b 10.
c Never.
d Forever.
Which one of the following is a loop construct that will always be executed once?a for
b switch
c while
d do…while
What result is in the variable num after execution of the following statements?
int num = 58;
num % = 11;
a 3
b 5
c 8
d 11
What is the result after execution of the following code if a is 10, b is 5 and c is 10?
if((a>b) && (a<=c))
a = a + 1;
else
c = c + 1;
a a = 10, c = 10
b a = 11, c = 10
c a = 10, c = 11
d a = 11, c = 11
What is the return type of the following function prototype?
float calc(int, float, char, char);
a int
b char
c float
d void
What is the maximum number of characters that can be held in the string variable char
AddressLine[40];
a 38
b 39
c 40
d 41
What result is in the variable num1 after execution of the following statements?
int j = 1, num1 = 4;

while (++j <= 10)
{
num1++;
}
a 11
b 12
c 13
d 14
What is the result in the variable len after execution of the following statements?
int len;
char str1[ ] = {“39 March Road”};
len=strlen(str1);
a 11
b 12
c 13
d 14
What is the result in the variable str3 after execution of the following statements?
char str2[] = {“Books”};
char str3[20] = {“Fair”};
strcat(str3,str2);
a “Books Fair”
b “BooksFair”
c “Fair Books”
d “FairBooks”

Each instance of a class has a different set of
a class interfaces
b methods
c return types

d attribute values.
Methods in a class define the
a operations to be performed

b actions to be performed by its attributes
c actions to be performed on another class’s objects
d operations to be performed on another class’s attributes.
How many instances of a class can be declared?
a None.
b One.
c Ten.

d As many as required.
Typically a class is made up of
a attributes only
b methods only

c attributes and methods
d interfaces
A method declared as private can be accessed by
a its class methods only

b superclasses only
c subclass methods only
d all classes.
A constructor for a class MUST have
a no parameters
b a different na me to the class

c the same name as the class
d a return value.
One method will overload another method if they have
a different names but the same parameters
b different names with no parameters
c the same name with no parameters
d the same name but different parameters

Monday, 25 April 2011

some applitude questions




1. You are given two candles of equal size, which can burn 1hour each. You have to measure 90 minutes with these candles.(There is no scale or clock). Also u r given a lighter.

Ans: 1. First light up the two ends of the 1st candle. When it will burn out light up one end of the second candle. (30+60=90)

2. Try the similar problem to measure 45 minutes.

Ans: First light-up the two ends of the 1st candle and one end of the 2nd candle. When the 1st candle will burn out ,then light up the both ends of the 2nd candle (15+30=45)

3. You r given a thermometer. What can u do by this without measuring the temperature?

Ans: if u put thermometer into a tree it won't grow anymore,will just die off

4. How it is possible to place four points that are equidistance from each other? OR U r a landscape designer and your boss asked u to design a landscape such that you should place 4 trees equidistance from each other. (Distance from each tree to the other must be same)

Ans: Only 3 points can be equidistant from each other. But if u place points in the shape of a pyramid then its possible

5. You are given a cake; one of its corner is broken. How will u cut the rest into Two equal parts?

Ans: Slice the cake

6. How will you recognize the magnet & magnetic material & non-magnetic material?

Ans: Drag one piece of material over another. There is no attractive force in the middle portion of the magnet. OR Get a piece of thread and tie up with the one bar and check for poles. If it iron bar then it moves freely and if it is magnetic bar then it fix in one direction according to poles.

7. If one tyre of a car suddenly gets stolen.... and after sometime u find the tyre without the screws how will u make ur journey complete

Ans: Open 3 screws, 1 from each tyre and fix the tyre.

8. How can u measure a room height using a thermometer?

Ans: temp varies with height. but its dependent on various other factors like humidity, wind etc.

9 What is the height of room if after entering the room with a watch ur head strikes a hanging bulb?

Ans: Oscillate the hanging bulb. Calculate the time period for one complete oscillation by Simple Harmonic Motion (SHM) of the handing bulb. Put it in the formula T=2 * 3.14 * (L/G)^1/2 L will be the length of the hanging thread. Add the L with ur height to get the height of the room.

10. Color of bear.... if it falls from 1m height in 1s.

Ans: We get 'g' perfect 10 which is only in poles...hence polar bear...color White

Latest / recent puzzles put / asked in Technical or HR interviews of IT companies placement question papers for freshers and on campus drives

11. How will you measure height of building when you are at the top of the building? And if you have stone with you.

Ans: Drop the stone and find the time taken for the stone to reach the ground. find height using the formula s = gt*t/2 ( s = height, a= initial velocity=0, g=9.8m/s, t = time taken)

12. How wud u catch and receive a ball in same direction? (Dropping is from north and receiving from bottom not accepted, as it is 2 directions)

13. 25 statements given. Some tell truth, some false and some alternators. Find out the true statements.

14. Can u make 120 with 5 zeros?

Ans: Factorial (factorial (0)+factorial (0)+factorial (0)+factorial (0)+factorial (0)) = 120

15.There are three people A, B, C. Liars are of same type and Truth speaking people are of same type. Find out who is speaking truth and who is speaking false from the following statements:

a) A says: B is a liar.

b) B says: A and C are of same type.

Ans: lets assume A is speaking truth. It means B is a liar then it means A and C are not of same type.

16.5 swimmers A, B, C, E, F and many conditions of their positions like there are Two b/w A & F, B doesn't win etc the question was to find who was b/w like E & D?

17. in a race u drove 1st lap with 40kmph and in the second lap at what speed u must drive so that ur average speed must be 80kmph.

18. You have to draw 3 concentric circles with a line passing thru their center without lifting hand.

Ans: Start the line complete one circle move inside circles along the line and then draw second circle. Like wise rest.

19. A rectangular paper is there. At a corner a rectangular size paper is taken from it. Now you have to cut the remaining paper into two equal halves.

Ans: try it on the paper. You must fold the part that has complete paper and select Half of it and then fold the part that cut and selects half of it and then cut along the folding.

20. Value of (x-a)(x-b)………..(x-z)

21. There are 9 coins. 8 are of 1 gm and 1 is of 2 grams. How will you find out the heavier coin in minimum number of weighing and how many weighing it will need?

Ans: 2 weighing ( Divide the number of coins into 3 parts at each weighing)

verizon c-paper


Instructions: ? This is a 40 minutes paper containing 75 questions. ? There is no negative marking.
1.------- is associated with webservices.
a) WSDL b) WML c) web sphere d) web logic
2.any large single block of data stored in a database, such as a picture or sound file, which does not include record fields, and cannot be directly searched by the database?s search engine.
a) TABLE b) BLOB c) VIEW d) SCHEME
3.Areserved area of the immediate access memeory used to increase the running speed of the computer program.
a) session memory b) bubble memory c) cache memory d) shared memory

4.a small subnet that sit between atrusted internal network and an untruster external network, such as the public internet.
a) LAN b) MAN c) WAN d) DMZ
5.technologies that use radio waves to automatically identify people or objects,which is very similar to the barcode identification systems,seen in retail stores everyday.
a)BLUETOOTH b) RADAR c)RSA SECURE ID d)RFID
6.main(){
float fl = 10.5;
double dbl = 10.5
if(fl ==dbl)
printf(?UNITED WE STAND?);
else
printf(?DIVIDE AND RULE?)
}
what is the output?
a)compilation error b)UNITED WE STAND c)DIVIDE AND RULE d)linkage error.
7.main(){
static int ivar = 5;
printf(?%d?,ivar--);
if(ivar)
main();
}
what is the output?
a)1 2 3 4 5 b) 5 4 3 2 1 c)5 d)compiler error:main cannot be recursive function.
8.main()
{
extern int iExtern;
iExtern = 20;
printf(?%d?,iExtern);
}
what is the output?
a)2 b) 20 c)compile error d)linker error
9..#define clrscr() 100
main(){
clrscr();
printf(?%d\n\t?, clrscr());
}
what is the output?
a)100 b)10 c)compiler errord)linkage error
10.main()
{
void vpointer;
char cHar = ?g?, *cHarpointer = ?GOOGLE?;
int j = 40;
vpointer = &cHar;
printf(?%c?,*(char*)vpointer);
vpointer = &j;
printf(?%d?,*(int *)vpointer);
vpointer = cHarpointer;
printf(?%s?,(char*)vpointer +3);
}
what is the output?
a)g40GLE b)g40GOOGLE c)g0GLE d)g4GOO
11.#define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts(?NULL?);
else if(FALSE)
puts(?TRUE?);
else
puts(?FALSE?);
}
what is the output?
a)NULL b)TRUE c)FALSE d)0
12.main() {
int i =5,j= 6, z;
printf(?%d?,i+++j);
}
what is the output?
a)13 b)12 c)11 d)compiler error
13.main() {
int i ;
i = accumulator();
printf(?%d?,i);
}
accumulator(){
_AX =1000;
}
what is output?
a)1 b)10 c)100 d)1000
14.main() {
int i =0;
while(+(+i--)!= 0)
i- = i++;
printf(?%d?,i);
}
what is the output?
a)-1 b)0 c)1 d)will go in an infinite loop
15.main(){
int i =3;
for(; i++=0;)
printf((?%d?,i);
}
what is the output?
a)1b)2c)1 2 3d)compiler error:L value required.
16.main(){
int i = 10, j =20;
j = i ,j?(i,j)?i :j:j;
printf(?%d%d?,i,j);
}what is the output?
a)20 b)20 c)10 d)10
17.main(){
extern i;
printf(?%d\t?,i);{
int i =20;
printf(?%d\t?,i);
}
}
what is output?
a) ?Extern valueof i ? 20 b)Externvalue of i?c)20d)linker Error:unresolved external symbol i
18.
int DIMension(int array[]){
return sizeof(array/sizeof(int);}
main(){
int arr[10];
printf(?Array dimension is %d?,DIMension(arr));
}
what is output?
a)array dimension is 10 b)array dimension is 1
c) array dimension is 2 d)array dimension is 5
19.main()
{
void swap();
int x = 45, y = 15;
swap(&x,&y);
printf(?x = %d y=%d?x,y);
}
void swap(int *a, int *b){
*a^=*b, *b^=*a, *a^ = *b;
what is the output?
a) x = 15, y =45 b)x =15, y =15 c)x =45 ,y =15 d)x =45 y = 45
20.
main(){
int i =257;
int *iptr =&i;
printf(?%d%d?,*((char*)iptr),*((char *)iptr+1));
}
what is output?
a)1, 257 b)257 1c)0 0d)1 1
21.main(){
int i =300;
char *ptr = &i;
*++ptr=2;
printf(?%d?,i);
}
what is output?
a)556 b)300 c)2 d)302
22.
#include
main(){
char *str =?yahoo?;
char *ptr =str;
char least =127;
while(*ptr++)
least = (*ptr
printf(?%d?,least);
}
what is the output?
a)0 b)127 c)yahoo d)y
23.
Declare an array of M pointers to functions returing pointers to functions returing pointers to characters.
a)(*ptr[M]()(char*(*)()); b)(char*(*)())(*ptr[M])()
c)(char*(*)(*ptr[M]())(*ptr[M]() d)(char*(*)(char*()))(*ptr[M])();
24.void main(){
int I =10, j=2;
int *ip = &I ,*jp =&j;
int k = *ip/*jp;
printf(?%d?,k);
}
what is the output?
a)2 b)5 c)10 d)compile error:unexpected end of file in comment started in line 4
25.main()
{
char a[4] =?GOOGLE?;
printf(?%s?,a);
}
what is the output?
a)2 b) GOOGLE c) compile error: yoo mant initializers d) linkage error.
26.For 1MB memory, the number of address lines required
a)12 b)16 c)20 d)32
27.There is a circuit using 3 nand gates with 2 inputes and 1 output,f ind the output.
a) AND b) OR c) XOR d) NAND
28.what is done for push operation
a) SP is incremented and then the value is stored.
b) PC is incremented and then the value is stored.
c) PC is decremented and then the value is stored.
d) SP is decremented and then the value is stored.
29.Memory allocation of variables declared in a program is ------
a) Allocated in RAM
b) Allocated in ROM
c) Allocated in stack
d) Assigned in registers.
30.What action is taken when the processer under execution is interrupted by TRAP in 8085MPU?
a) Processor serves the interrupt request after completing the execution of the current instruction.
b) processer serves the interrupt request after completing the current task.
c) processor serves the interrupt immediately.
d) processor serving the interrupt request depent deprnds upon the priority of the current task under execution.

31.purpose of PC (program counter)in a microprocessor is ----
a) To store address of TOS(top of stack)
b) To store address of next instructions to be executed
c) count the number of instructions
d) to store the base address of the stack.
32.conditional results after execution of an instruction in a microprocess is stored in
a) register b) accumulator c) flag register d) flag register part of PSW (program status word)
33.The OR gate can be converted to the NAND function by adding----gate(s)to the input of the OR gate.
a) NOT b) AND c) NOR d) XOR
34.In 8051microcontroller ,------has a dual function.
a) port 3 b) port 2 c) port 1 d) port 0
35.An 8085 based microprocessor with 2MHz clock frequency,will execute the following chunk of code with how much delay?
MVI B,38H
HAPPY: MVI C, FFH
SADDY: DCR C
JNZ SADDY
DCR B
JNC HAPPY
a) 102.3 b)114.5 c)100.5 d)120
36.In 8085 MPU what will be the status of the flag after the execution of the following chunk of code.
MVI B,FFH
MOV A,B
CMA
HLT
a)S = 1, Z = 0, CY = 1 b)S = 0, Z = 1, CY = 0
c) S = 1, Z = 0, CY = 0 d)S = 1, Z = 1 ,CY = 1
37.A positive going pulse which is always generated when 8085 MPU begins the machine cycle.
a) RD b) ALE c) WR d) HOLD
38.when a ----- instruction of 8085 MPU is fetched , its second and third bytes are placed in the W and Z registers.
a) JMP b) STA c) CALL d) XCHG
39.what is defined as one subdivision of the operation performed in one clock period.
a) T- State b) Instruction Cycle c) Machine Cycle d) All of the above
40.At the end of the following code, what is the status of the flags.
LXI B, AEC4H
MOV A,C
ADD B
HLT
a) S = 1, CY = 0, P = 0 , AC = 1 b) S =0 , CY = 1, P = 0,AC = 1
c) S = 0, CY = 1, P = 0 , AC = 1 d) S = 0, CY = 1, P = 1 , AC = 1

46.The repeated execution of a loop of code while waiting for an event to occur is called ---------.The cpu is not engaged in any real productive activity during this period,and the process doesn?t progress towards completion.
a) dead lock b) busy waiting c) trap door d) none.

47. Transparent DBMS is defined as
a) A DBMS in which there are no program or user access languages. b) A DBMS which has no cross file capabilities but is user friendly and provides user interface management. c) A DBMS which keeps its physical structure hidden from user d) none.

48.Either all actions are carried out or none are.users should not have to worry about the effect of incomplete transctions.DBMS ensures this by undoing the actions of incomplete transctions.this property is known as
a) Aggregation b) atomicity c) association d) data integrity.

49.------ algorithms determines where in available to load a program. common methods are first fit,next fit,best fit.--------- algorithm are used when memory is full , and one process (or part of a process) needs to be swaped out to accommodate a new program.The ------------- algorithm determines which are the partions to be swaped out.
a) placement, placement, replacement
b) replacement, placement, placement
c) replacement, placement, replacement
d) placement, replacement, replacement

50.Trap door is a secret undocumented entry point into a program used to grant access without normal methods of access authentication.A trap is a software interrupt,usually the result of an error condition.
a)true b)false.


52.which one of the following is the recursive travel technique.
a)depth first search b)preorder c)breadth first search d)none.
55.in recursive implementations which of the following is true for saving the state of the steps
a)as full state on the stack
b) as reversible action on the stack
c)both a and b
d)none
56.which of the following involves context switch
a)previliged instruction
b)floating point exception
c)system calls
d)all
e)none
57.piggy backing is a technique for
a)acknowledge
b)sequence
c)flow control
d)retransmission
58. a functional dependency XY is ___________dependency if removal of any attribute A from X means that the dependency does not hold any more
a)full functional
b) multi valued
c)single valued
d)none
59)a relation schema R is in BCNF if it is in ___________and satisfies an additional constraints that for every functional dependency XY,X must be a candidate key
a)1 NF
b)2 NF
c)3 NF
d)5 NF
60) a _________sub query can be easily identified if it contains any references to the parent sub query columns in the _________ clause
A) correlated ,WHERE
b) nested ,SELECT
c) correlated,SELECT
d) none
61) hybrid devise that combines the features of both bridge and router is known as
a)router b)bridge c)hub d)brouter
62) which of the following is the most crucial phase of SDLC
a)testing b)code generation c) analysys and design d)implementation
63)to send a data packet using datagram ,connection will be established
a)no connection is required
b) connection is not established before data transmission
c)before data transmission
d)none
64)a software that allows a personal computer to pretend as as computer terminal is
a) terminal adapter
b)terminal emulation
c)modem
d)none
65) super key is
a) same as primary key
b) primary key and attribute
c) same as foreign key
d) foreign key and attribute
66.In binary search tree which traversal is used for ascending order values
a) Inorder b)preorder c)post order d)none
67.You are creating an index on ROLLNO colume in the STUDENT table.which statement will you use?
a) CREATE INDEX roll_idx ON student, rollno;
b) CREATE INDEX roll_idx FOR student, rollno;
c) CREATE INDEX roll_idx ON student( rollno);
d) CREATE INDEX roll_idx INDEX ON student (rollno);
68.A________class is a class that represents a data structure that stores a number of data objects
a. container b.component c.base d.derived
69.Which one of the following phases belongs to the compiler Back-end.
a. Lexical Analysis b.Syntax Analysis c. Optimization d.Intermediate Representation.
70.Every context _sensitive language is context_free
a. true b.false
71.Input:A is non-empty list of numbers L
X?-infinity
For each item in the list L,do
If the item>x,then
X?the item
Return X
X represents:-
a)largest number
b)smallest number
c)smallest negative number
d) none
72.Let A and B be nodes of a heap,such that B is a child of A. the heap must then satisfy the following conditions
a)key(A)>=key(B)
b)key(A)
c)key(A)=key(B)
d)none
73.String ,List,Stack,queue are examples of___________
a)primitive data type
b)simple data type
c)Abstract data type
d)none
74.which of the following is not true for LinkedLists?
a)The simplest kind of linked list is a single linked list ,which has one link per node .this link points to the next node in the list,or to a null value or emptylist if it is the last node.
b)a more sophisticated kind of linked list is a double linkedlist or two way linkedlist .Each node has two links ,one to the previous node and one to the next node.
c) in a circleLinkedList ,the first and last nodes are linked together.this can be done only for double linked list.
d) to traverse a circular linkedlist ,u begin at any node and follow the list in either direction until u return to the original node.
75.sentinel node at the beginning and /or at the end of the linkedlist is not used to store the data
a) true
b) false