Basic C Programs Asked in Interview PDF Download

Learn basic c programs asked in interview, c language FAQs for online MCQs based test prep. These frequently asked questions has multiple choice questions (MCQ), c language quiz questions and answers as by evaluating following statement for value of x = -7 <code>if (x < 0)<br>num = 1;<br>if(x > 0)<br>num = 0;<br>if(x == 0)<br>num = 3</code>, value of num is , answer key with choices as 0, 3, 1 and -7 for competitive exam preparation. Free frequently asked questions are to learn basic c programs asked in interview quiz online with MCQs to practice test questions with answers.

FAQs Basic C Programs Asked in Interview PDF Download

MCQ. By evaluating following statement for value of x = -7 <code>if (x < 0)<br>num = 1;<br>if(x > 0)<br>num = 0;<br>if(x == 0)<br>num = 3</code>, value of num is

  1. 0
  2. 3
  3. 1
  4. -7

B

MCQ. Output of statement in_range=(n > -15 || n < 15 || n == 150); where n = 15 is

  1. -15
  2. 15
  3. 150
  4. 1

D

MCQ. By evaluating following statement <code> if crsr_or_frgt == 'C'<br>{<br>printf("Hello/n");<br>printf("Hello to you too ")};</cpde> , error is

  1. Missing parenthesis around IF condition
  2. Missing Semicolon around IF condition
  3. Double equality sign in IF condition
  4. No else defined in statement

A

MCQ. By evaluating following statement where MAX_SAL=800000 and price=700000 <code> if (price <= MAX_SAL) <br> printf("Car can be purchased/n");<br>else<br>printf("Car can not be purchased ")};</code> , output is

  1. Car can be purchased
  2. Car cannot be purchased
  3. Runtime error
  4. Compiler error

A

MCQ. Value assigned to ans in ans = (p > 95) + (q < 95); where p = 100 and q = 50 is

  1. 95
  2. 190
  3. 2
  4. 150

C