C Programming 15

COEP
Lets Crack Online Exam

IT Interview Exam Questions: C Programming 15 (IT Interview Exam Question, IT Campus Placement)

Subject: C Programming 15

Part 15: List for questions and answers of C Language

 

Q1. In a for loop, if the condition is missing,then?

a) it is assumed to be present and taken to be false

b) it is assumed to be present and taken to be true

c) it result in the syntax error

d) execution will be terminated abruptly

 

Q2. In a for loop, if the condition is missing, then infinite looping can not be avoided by a

a) Continue statement

b) goto statement

c) return statement

d) break statement

 

Q3. Choose the correct statement

a) 0 represent a false condition

b) Non zero value represent a false condition

c) 1 represent a false condition

d) Anything that is not 1, represents a false condition

 

Q4. Which of the following comments about for loop are not correct?

a) Index value is retained outside the loop

b) Index value can be changed from within the loop

c) goto can be used to jump,out of loop

d) Body of the loop can not be empty

 

Q5. Which of the following comment about for loop are correct?

a) Using break is equivalent to using a goto that jumps to the statement immediately following the loop

b) Continue is used to by pass the remainder of the current pass of the loop

c) if comma operator is used,then the value returned is the value of the right operand

d) All of above

 

Q6. Break statement can be simulated by using ?

a) goto

b) return

c) exit

d) any of the above statement 

 

Q7. What will the function rewind() do?

a) Reposition the file pointer to a character reverse

b) Reposition the file pointer stream to end of file

c) Reposition the file pointer to begining of that line

d) Reposition the file pointer to begining of file

 

Q8. Input/output function prototypes and macros are defined in which header file?

a) conio.h

b) stdlib.h

c) stdio.h

d) dos.h

 

Q9. Which standard library function will you use to find the last occurance of a character in

a string in C?

a) strnchar()

b) strchar()

c) strrchar()

d) strrchr()

 

Q10. What is stderr ?

a) standard error

b) standard error types

c) standard error streams

d) standard error definitions

 

Q11. What will the function randomize() do in Turbo C under DOS?

a) returns a random number

b) returns a random number generator in the specified range

c) returns a random number generator with a random value based on time

d) return a random number with a given seed value

 

Q12. 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 

 

Q13. Which keyword can be used for coming out of recursion?

a) break

b) return

c) exit

d) Both (a) and (b)

 

Q14. What is the output of this C code? int main()

{ int a = 0, i = 0, b; for (i = 0;i is less than 5; i++) { a++; continue;} }

a) 2

b) 3

c) 4

d) 5

 

Q15. The keyword ‘break’ cannot be simply used within:

a) do-while

b) if-else

c) for

d) while

 

Q16. Which keyword is used to come out of a loop only for that iteration?

a) break

b) continue

c) return

d) None of the mentioned

 

Q17. What is the output of this C code?

#include <stdio.h>

void main() 

  { 

      int i = 0;

      if (i == 0)

      { printf(“Hello”); 

      continue; 

      } 

}

a) Hello is printed infinite times

b) Hello

c) varies

d) Compile time error

 

Q18. What is the output of this C code? 

#include <stdio.h>

   void main()

   int i = 0;

   for (i = 0;i is less than 5;

   i++) if (i is less than 4) 

   { printf(“Hello”); break; 

   } 

}

a) Hello is printed 5 times

b) Hello is printed 4 times

c) Hello

d) Hello is printed 3 times 

 

Q19. What is the output of this C code?

#include <stdio.h>

   int main() 

   int a = 0, i = 0, b; 

   for (i = 0;

   i is less than 5; 

   i++) 

   { 

   a++; 

   if (i == 3) break;

   }

}

a) Hi is printed 5 times

b) Hi is printed 9 times

c) Hi is printed 7 times

d) Hi is printed 4 times

 

Q20. What is the output of this C code?

#include <stdio.h>

    int main() 

    int a = 0,

    i = 0, b; for (i = 0;

    i is less than 5;

    i++) 

    {

    a++; 

    if (i == 3) break; 

    }

}

a) 1

b) 2

c) 3

d) 4 

 

Part 15: List for questions and answers of C Language

 

Q1. Answer: b

 

Q2. Answer: a

 

Q3. Answer: a

 

Q4. Answer: d

 

Q5. Answer: d

 

Q6. Answer: a

 

Q7. Answer: d

 

Q8. Answer: c

 

Q9. Answer: d

 

Q10. Answer: c

 

Q11. Answer: c

 

Q12. Answer: a

 

Q13. Answer: b

 

Q14. Answer: d

 

Q15. Answer: b

 

Q16. Answer: b

 

Q17. Answer: d

 

Q18. Answer: d

 

Q19. Answer: a

 

Q20. Answer: d