C Programming MCQ Questions | c interview questions

C Programming MCQ Questions | c interview questions

Introduction

In this article, you will find basic to most puzzled interview queries questions. This article is very useful for those who are preparing for an interview in IT company. Whether you are experienced or

techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999


21) What is the output of the following C code?

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int i=0, j=1, k=2, m;
  5. m = i++ || j++ || k++;
  6. printf("%d %d %d %d", m, i, j, k);
  7. }
  8.  
  1. 0 1 2 3
  2. 0 1 2 2
  3. 1 1 2 2
  4. 1 1 2 3

⇒ Answer: (C) 1 1 2 2

22) Which of the following operator takes only integer operands?
  1. +
  2. %
  3. /
  4. *

⇒ Answer: (B) %

23) In an expression involving || operator, evaluation

  1. Takes place from left to right
  2. Takes place from right to left
  3. Will be stopped if one of its components evaluates to true
  4. Will be stopped if one of its components evaluates to false
  1. I and III
  2. II and III
  3. III and IV
  4. IV and I

⇒ Answer: (A) I and III

24) What will be the output of the following C code?

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int num = - -2;
  5. printf("num = %d", num);
  6. }
  7.  
  1. -2
  2. 2
  3. 1
  4. Runtime Error

⇒ Answer: (B) 2

25) What will be the output of the following C code?
  1. #include <stdio.h>
  2. void main()
  3. {
  4. int num = 20;
  5. num = !num>24;
  6. printf("num = %d", num);
  7. }
  8.  
  1. 20
  2. 0
  3. 24
  4. Runtime error

⇒ Answer: (B) 0

     

26) Which operator from the following has the lowest priority in C language?
  1. Unary-operator
  2. Assignment operator
  3. Conditional operator
  4. Comma operator

⇒ Answer: (D) Comma operator

27) What will be the output of the following C code?

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int num1=20, num2=5, num3=3, num4=3;
  5. if( (num1 < num2 ) && (num3 = num4++) )
  6. printf("%d %d %d %d", num1,num2, num3, num4);
  7. else
  8. printf("%d %d %d %d", num1, num2, num3, num4);
  9. }
  10.  
  1. 20 5 5 5
  2. 20 5 4 4
  3. 20 5 3 3
  4. 20 5 3 4

⇒ Answer: (C) 20 5 3 3

28) num2 = 110 & num3 = 20, what is the value of 'num1' after execution of the expression num1=num2-=num3*=5?
  1. 450
  2. 110
  3. 10
  4. none of the mentioned

⇒ Answer: (C) 10.

29) What will be the output of the following C code on a 32-bit machine?

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int num1=10, num2;
  5. num2 = num1++ + ++num1;
  6. printf("%d %d %d %d", num2, num1++, num1, ++num1);
  7. }
  8.  
  1. 22 14 12 13
  2. 22 12 12 13
  3. 12 10 11 13
  4. 22 13 14 14

⇒ Answer: (D) 22 13 14 14

30) What will be the output of the following C code?

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int num1=10;
  5. if(num1++>9 && num1++!=10 && num1++>11)
  6. printf("%d", num1);
  7. else
  8. printf("%d", num1);
  9. }
  10.  
  1. 11
  2. 12
  3. 13
  4. run time error

⇒ Answer: (C) 13

« 1 2 3 4 5

Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer & technology lovers. http://www.techstudy.org/.