Programs in C

C Programming Fundamentals covering data types, operators, pointers, arrays, structures, unions, enums, and control structures

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

<stdio.h>void main() { printf("%d"t, sizeof(7.5)); printf("%d"t, sizeof(80000)); printf("%d"t, sizeof('B')); }.
</stdio.h>
Which of the following is the output of the program?

  1. 8, 2, 2
  2. 4, 4, 2
  3. 8, 4, 2
  4. Compilation error
  5. Runtime error
Question 2 Multiple Choice (Single Answer)

void main() { signed x; unsigned y; x= 10 + - 10u + 10u + -10; y=x; if(x==y) printf("%d %d", x, y); else if(x!=y) printf("%u %u", x, y); }.

Which of the following is the output of the program?

  1. Compilation error
  2. 0, 0
  3. 65536, 0
  4. Runtime error
  5. 65536, - 10
Question 3 Multiple Choice (Single Answer)

The most common use of one dimensional array in C is which of the following?

  1. Int
  2. Char
  3. Function
  4. String
  5. Void
Question 4 Multiple Choice (Single Answer)

<stdio.h>void main() { int i=3; int *j, **k; j=&i; k=&j; printf("%u%u%d", k, *k, **k);}</stdio.h>

  1. Address, address, 3
  2. Address, address, address
  3. 3, address, address
  4. Syntax error
  5. Runtime error
Question 5 Multiple Choice (Single Answer)

<stdio.h>void main() { print("%d%d%d", sizeof(4.14), sizeof(4.14f), sizeof(4.14L)); }</stdio.h>

  1. 10, 4, 10
  2. Lexical error
  3. Compile error
  4. 8, 4, 4
  5. 8, 4,10
Question 6 Multiple Choice (Single Answer)

Which of the following is an integral data type?

  1. Float
  2. Char
  3. Double
  4. Return
  5. Void
Question 7 Multiple Choice (Single Answer)

<stdio.h>void main() { volatile int a=12; printf("%d", a); }</stdio.h>

  1. Can not predict
  2. 12
  3. Garbage value
  4. Compiler error
  5. Semantics error
Question 8 Multiple Choice (Single Answer)

<stdio.h>Const enum Beta{x, y=4, z}p=11; void main() { enum Beta a, b; a=x; b=z; printf("%d", a+b-2p); }</stdio.h>

  1. 10
  2. 15
  3. - 15
  4. Runtime error
  5. Syntax error
Question 9 Multiple Choice (Single Answer)

<stdio.h>void main() { char x=260; int i; i=x + !x + ~x + ++x; printf("%d", i); }</stdio.h>

  1. - 5
  2. 4
  3. Lexical error
  4. - 6
  5. Syntax error
Question 10 Multiple Choice (Single Answer)

<stdio.h>void main() { int x; x=sizeof(!7.8); printf("%d",x); }</stdio.h>

  1. 4
  2. 2
  3. 8
  4. 1
  5. 10
Question 11 Multiple Choice (Single Answer)

<stdio.h>void main() { int a= 100; void *j= &a; int *k= j; printf("%u", *k); } </stdio.h>

  1. Runtime error
  2. Compiler error
  3. Garbage value
  4. Address
  5. 100
Question 12 Multiple Choice (Single Answer)

<stdio.h>void main() { int x; x=10, 20, 30; printf("%d", x); } </stdio.h>

  1. 30
  2. 20
  3. 10
  4. Garbage value
  5. Lexical error
Question 13 Multiple Choice (Single Answer)

Which of the following creates a memory overlay area, with each union member using same memory storage locations?

  1. Array
  2. Union
  3. Structure
  4. Function
  5. Void
Question 14 Multiple Choice (Single Answer)

<stdio.h>void main() { int x; x=1; x= 2 + 2 * x++; printf("%d", x); }</stdio.h>

  1. 5
  2. 6
  3. 4
  4. Syntax error
  5. Runtime error
Question 15 Multiple Choice (Single Answer)

Which of the following loops is called exit controlled loop?

  1. Do while
  2. While
  3. For
  4. Break
  5. Goto