C Programming Fundamentals

Test your knowledge of C programming concepts including operators, functions, recursion, data types, and output prediction.

14 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Determine Output: main(){ unsigned int y = 12; int x = -2; if(x>y) printf(" x is greater"); else printf (" y is greater"); return 0;}

  1. x is greater
  2. y is greater
  3. compile error
  4. none
Question 2 Multiple Choice (Single Answer)

Determine output : main(){ int i=012; int j=046; int k=056; printf("i=%d",i); printf("j=%d",j); printf("k=%d",k);}

  1. 012046056
  2. 124656
  3. 103846
  4. 010038046
Question 3 Multiple Choice (Single Answer)

Determine output: void main(){ int x,y; x = 5; y = ++x * ++x; printf("Value of x = %d and Value of y = %d\n",x,y);}

  1. 7,49
  2. 7,42
  3. 7,36
  4. 7,25
Question 4 Multiple Choice (Single Answer)

Determine Output: int counter (int value) { static int count =0; count = count +value; return count; } main() { int i , j; for (i=0; i <=5; i++) j = counter(i); printf("J = %d", j); return 0; }

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

Determine Output : struct node { int a; int b; int c; }; int main() { struct node s= { 3, 5,6 }; struct node *pt = &s; printf("Ans : %d" , (int)pt); return 0; }

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

Determine Output: int main() { int a[5] = {1,2,3,4,5}; int ptr = (int)(&a+1); printf("%d %d" , *(a+1), *(ptr-1) ); return 0; }

  1. 2,1
  2. 2,5
  3. compile error
  4. 2,2
Question 7 Multiple Choice (Single Answer)

Determin Output: int main() { int a, b,c, d; a=3; b=5; c=a,b; d=(a,b); printf("c = %d" ,c); printf("\n\nd = d" ,d); return 0; }

  1. 5,5
  2. 3,3
  3. 3,5
  4. Error
Question 8 Multiple Choice (Single Answer)

Determine Output: main() { printf("%x",-1<<4); }

  1. -16
  2. fff0
  3. 0
  4. 0010
Question 9 Multiple Choice (Single Answer)

The symbol "?" belongs to which operator?

  1. Conditional Operator
  2. Bitwise Operators
  3. Logical operators
  4. Relational Operator
Question 10 Multiple Choice (Single Answer)

A class is

  1. Data Type
  2. Abstract Type
  3. User Defined Type
  4. All of these options
Question 11 Multiple Choice (Single Answer)

A recursive function would result in infinite recursion, if the following were left out:

  1. Base case
  2. Recursive call
  3. Subtraction
  4. Local variable declarations
Question 12 Multiple Choice (Single Answer)

UML stands for

  1. Unique modeling language.
  2. Unified modeling language
  3. Unified modern language
  4. Unified master laqnguage
Question 13 Multiple Choice (Single Answer)

This operator returns the size in bytes of that data type or object or structure etc

  1. Conditional Operator
  2. Bitwise Operators
  3. sizeof () operator
  4. Relational Operator
Question 14 True/False

Exit is a function defined in the cstdlib library.

  1. True
  2. False