Structures Unions Enumeration - FlowControl in C Interview Questions for Engineering Students

1.) What do the 'c' and 'v' in argv stands for?
a.) 'c' means argument control 'v' means argument vector
b.) 'c' means argument count 'v' means argument vertex
c.) 'c' means argument count 'v' means argument vector
d.) 'c' means argument configuration 'v' means argument visibility
ANSWER: c.) 'c' means argument count 'v' means argument vector

2.) What do the following declaration signify?
int (*pf)();

a.) pf is a pointer to function
b.) pf is a function pointer
c.) pf is a pointer to a function which return int
d.) pf is a function of pointer variable
ANSWER: c.) pf is a pointer to a function which return int

C Frequently Asked Questions
C-Job Interview Questions
Interrupt DMA and Watchdog Timer




3.) What do the following declaration signify?
void *cmp();
a.) cmp is a pointer to an void type
b.) cmp is a void type pointer variable
c.) cmp is a function that return a void pointer
d.) cmp function returns nothing
ANSWER: c.) cmp is a function that return a void pointer

4.) In which numbering system can the binary number 1011011111000101 be easily converted to?
a.) Decimal system
b.) Hexadecimal system
c.) Octal system
d.) No need to convert
ANSWER: b.) Hexadecimal system

5.) Which bitwise operator is suitable for turning off a particular bit in a number?
a.) && operator
b.) & operator
c.) || operator
d.) ! operator
ANSWER: b.) & operator

6.) Which header file should be included to use functions like malloc() and calloc()?
a.) memory.h
b.) stdlib.h
c.) string.h
d.) dos.h
ANSWER: b.) stdlib.h

7.) What function should be used to free the memory allocated by calloc() ?
a.) dealloc();
b.) malloc(variable_name, 0)
c.) free();
d.) memalloc(variable_name, 0)
ANSWER: c.) free();

8.) What is the similarity between a structure, union and enumeration?
a.) All of them let you define new values
b.) All of them let you define new data types
c.) All of them let you define new pointers
d.) All of them let you define new structures
ANSWER: b.) All of them let you define new data types

9.) Does there any function exist to convert the int or float to a string?
a.) Yes
b.) No
ANSWER: a.) Yes

10.) What is the purpose of fflush() function.
a.) flushes all streams and specified streams
b.) flushes only specified stream
c.) flushes input/output buffer
d.) flushes file buffer
ANSWER: a.) flushes all streams and specified streams

11. What will be the output of the following code?
main()
{
ch = ‘A’;
while (ch <= ‘F’)
{
switch(ch)
{
case’A’: case’B’:case’C’: case’D’: ch++;continue;
case ‘E’: case ‘F’: ch++;
}
putchar( ch );
}
}
a) ABCDEF
b) EFG
c) FG
d) Error
ANSWER: C

12. What is the output of the following code?
main()
{
int I = 3;
while( I --)
{
int I = 100;
i- -;
printf(“%d. .”, i);
}
}
a) Infinite loop
b) Error
c) 99..99..99..
d) 3..2..1..
ANSWER: C

13.How many times the loop executes?
unsigned char c;
for( c = 0; c != 256; c+2 )
printf(“%d”, c);
a) 127
b) 128
c) 256
d) Infinitely
ANSWER: D

14. What is the value of int variable result if x = 50, y = 75 and z = 100?
result = ( x + 50 ? y >=75 ? z > 100 ? 1 : 2 : 3 : 4);
a) 1
b) 2
c) 3
d) 4
ANSWER: B

15.What will be the output of the program?
main()
{
int a = -4, r, num = 1;
r = a % -3;
r = ( r ? 0 : num * num);
printf( “%d”, r);
}
a) 0
b) 1
c) –ve is not allowed in the mod operands
d) None
ANSWER: A

16.How many times the loop will be executed?
main()
{
unsigned int I = 10;
while( i- - >= 0);
}
a) 10
b) Zero times
c) One time
d) None
ANSWER: D

17.To print only Kamban, what will be the value of s?
switch ( s )
{
case 1 : printf(“Balan”);
case 2:
case 3: printf( “Elango”);
case 4: printf( “Thiruvalluvan”);
default : printf(“Kamban”);
}
a) 2
b) 1 or 3 or 4
c) Any int value other then 1,2,3 and 4
d) 4
ANSWER: C

18. How many x are printed?
for( I = 0, j = 10; I < j; I ++, j --)
printf(“x”);
a) 10
b) 5
c) 4
d) None
ANSWER: B

19. Identify the wrong statement where - - - - represent C code
a) lable : { - - - } - - - - goto lable;
b) goto end; - - -
end : { - - - }
c) goto 50; - - -
50: { - - -}
d) begin: { - - -}
If ( a < 10 ) goto begin;
ANSWER: C

20. What will be the final values of I and j when the following code terminates?
main()
{
static int I , j = 5;
for ( I = 0; I < 3; I ++)
{
printf(“%d%d\n”, I, j);
if( j > 1){ j - -; main ();}
}
}
a) 02
b) 11
c) 21
d) Error, because main cannot be called recursively
ANSWER: C

Related

Unions 8616814105223941339

Post a Comment

SPAMMING will not be Appreciated.

emo-but-icon

Hot in week

Recent

Comments

Our Channel

Contact Us

Name

Email *

Message *

item