Company: HCL Technologies

1)two variables cannot have the same name if they are
a] in the same function b] in the same file c] in the same block
d] across two files

2)a static function,say s(), in a file f.c can be invoked from
a] all functions in f.c after the definition of s
b] all functions in f.c after the declaration of s
c] all functions in f.c
d] all of the above

3)the values printed by the following program when executed are
int a;
main()
{ a=6;
f();
}
f()
{ int a=5;
printf(“%dn”,a++);
{ int a=8;
printf(“%dn”,a++);
}
}
a] 6and9 b] 5and9 c] 6and8 d] 7and8

4)the values printed by the following’c’program
#define VALUE 1+2
main()
{ printf(“%d and %dn”, VALUE/VALUE, VALUE*3);
}
a] 1and9 b] 5and7 c] 1and7 d] 5and9

5) Macros and functions do not differ in the following respects
a] type checking b] vqariable number of arguments c] recursion
d]declaration of local variables

6]what is the value assigned to a and b when the following piece of ‘C’
code is executed
a=(10,15);
b= 10,15;
a] 10and10 b] 10and15 c] 15and10 d] 15and15

7)which of the following is not a bit operator
a] ! b] | c] ~ d] ^

8)which is the value assigned to the variable a if b is 7.
a=b>8?<<2:4?b>>1:b;
a] 7 b] 28 c] 3 d] 14

9)the value of the following expression(2^3)+(a^a) when evaluated is
a] 1 b] 2 c] 3 d] insufficient data

10) which one of the following operators has the highest precedence?
a] << b] || c] ++ d] % 11)if a is 10 and b is 5,then the value of the expression a++ + --b is a] 15 b] 16 c] 14 d] 13. 12)which of the following is not a basic data type? a]char b] char * c] double d] float. 13)consider the following c program main() { int x=5,y=7,z=6; if(x>y)
if(yx)
printf(“3”);
}
what is printed when this program is executed
a] 1 3 b] 2 3 c] 3 d] 2

14)the declaration of a variable does not result in one of the following
a] knowing the type of the variable
b] knowing the size of the variable
c] knowing the scope of the variable
d] allocation of storage space for the variable

15)a goto statement can reference a label
a] in another function within the same file
b] in another function in a different file
c] within the same function
d] none of the above

16)the body of the loop of which of the following loop constructs
executes
at least once
a] for construct b] while do construct c] do while construct d] none of
the above

17) which of the following can change the flow of execution of a program
a] break b] continue c] return d] all of the above

18)the type of the controlling expression of a switch statement
cannot be of the type
a] int b] char c] short d] float

19)in c parameters are passed by
a] value only b] reference only c] name only d] value and reference.

20)assuming a pointer takes up 4 bytes what is the size of the following
structure
struct x {
char a[8];
struct x *forw;
struct x *back;
};
a] 8 b] 10 c] 24 d]16