Basic C Programming MCQ Questions and Answers

Practice Mode
Showing 10 of 198 questions
Q1
Choose the correct statement.
  • A Use off goto enhence the logical clarity of a code
  • B Use of goto makes the debugging task easier
  • C Use goto when you want to jump out of a nested loop
  • D Never use goto
Answer: Option C
Q2
Which is true of conditional compilation ?
  • A It is taken care of by the compiler
  • B It is setting the compiler option conditionally
  • C It is compling a program based on a condition.
  • D It is taken care of by the pre-processor
Answer: Option
Q3
C was primarily developed as a
  • A systems programming language
  • B general purpose language
  • C data processing language
  • D none of the above
Answer: Option A
Q4
C is a
  • A high level language
  • B low level language
  • C high level language with some low level features
  • D low level language with some high level features
Answer: Option C
Q5
Even if a particular implementation doesn't limit the number of characters in an identifier, it is advisable to be concise because
  • A chance of typographic errors are less
  • B it may be processed by assembler, loaders, etc., which may have their own rules thalt may contradict the language rule
  • C by being concise, one can be mnemonoc
  • D none of the above
Answer: Option
Q6
The minimum number of temporary variables needed to swap the contents of two variables is
  • A 1
  • B 2
  • C 3
  • D 0
Answer: Option D
Q7
The purpose of the following program fragment b = s + b; s = b - s; b = b - s; where s,b are two integers is to
  • A transfer the contents of s to b
  • B transfer the contents of b to s
  • C exchange (swap) the contents of s and b
  • D negate the contents of s and b
Answer: Option C
Q8
Consider the function find (int x, into y) {return (( x < y 7 0 : ( x - y));} Let a, b be two non-negative integers. the call find ( a, find (a, b) can be used to find the
  • A mximum of a, b
  • B positive difference of a, b
  • C sum of a, b
  • D minimum of a, b
Answer: Option D
Q9
Let a, b be two non-negative integers. Which of the following calls, finds the positive difference of a and b?
  • A find (a,b) + find (b,a)
  • B find (a,find(a,b))
  • C a + find (a,b)
  • D b + find(a,b)
Answer: Option A
Q10
If abc is the input, then the following program fragment char x, y, z; print f("%d", scanf ("%c%c", &x, &y, &z)); results in
  • A a syntax error
  • B a fatal error
  • C segmentation violation
  • D printing of 3
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test