What is the output of this C code include stdioh int main int a 2 b a 1

What is the output of this c code include stdioh int

This preview shows page 8 - 16 out of 61 pages.

2.What is the output of this C code? #include <stdio.h> int main() { int a = 2; b= a >> 1; printf("%d\n", b); } a) 0 b) 1 c) 2 d) No Output. Ans b 3 Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____. 4 What will be the output of the
Background image
following program code? void main() { int a=3, b=4; switch(b%a) { case 1 : printf(“A”); break; case 3 : printf(“B”); break; default: printf(“Wrong choice”); } } A B 5 What will be the output of the following program code? void main() { int a=3, b=4; switch(a!=b) { case 1 : printf(“A”); break; case 0 : printf(“B”); break; default: printf(“Wrong choice”); } } A B
Background image
6 What will be the value of d in the following program? #include <stdio.h> int main() { int a = 10, b = 5, c = 5; int d; d = b + c == a; printf("%d", d); } a) Syntax error b) 1 c) 5 d) 10 ans-b 7 What is the output of this C code?
Background image
printf("%d\n", k); } 8 What is the output of this C code? #include <stdio.h> void main() { int y = 3; int x = 5 % 2 * 3 / 2; printf("Value of x is %d", x); } 9 What is the output of this C code? #include <stdio.h> int main() { int x = 1, y = 0, z = 3; x >y ?printf("%d", z) :printf("hello"); } a) 3 b) 1 c) Compile time error d) Run time error
Background image
ans=a 10 What is the output of this C code? #include <stdio.h> void main() { int x = 1, z = 3; int y = x << 3; printf(" %d\n", y); } 11 What is the output of this C code? #include <stdio.h> void main() { int x = 97; int y = sizeof(x); printf("y is %d", y); }
Background image
12 What is the output of this C code? #include <stdio.h> int main() { int x = 2, y = 1; x *= x + y; printf("%d\n", x); return 0; } 13. Which of the following is not a logical operator? a.if b.and c. not d. or Ans: A 14 Which of the following statements about the logical
Background image
AND operator is true? 15 Which of the following statements about bitwise operators is true? 16 The bitwise ____ operator that sets a bit to 1 only if both operands are 1. A 17 The bitwise ____ operator reverses bits. a. and b. inclusive or c. exclusive or d. complement
Background image
ans d 18Which of the following is not a relational operator?
Background image
Image of page 16

You've reached the end of your free preview.

Want to read all 61 pages?

  • Fall '19
  • d. scanf

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture