C Programming Fundamentals
Test your knowledge of C programming concepts including operators, functions, recursion, data types, and output prediction.
Questions
Determine Output: main(){ unsigned int y = 12; int x = -2; if(x>y) printf(" x is greater"); else printf (" y is greater"); return 0;}
- x is greater
- y is greater
- compile error
- none
Determine output : main(){ int i=012; int j=046; int k=056; printf("i=%d",i); printf("j=%d",j); printf("k=%d",k);}
- 012046056
- 124656
- 103846
- 010038046
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);}
- 7,49
- 7,42
- 7,36
- 7,25
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; }
- 5
- 4
- 10
- 15
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; }
- 4
- 5
- 3
- Compile error
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; }
- 2,1
- 2,5
- compile error
- 2,2
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; }
- 5,5
- 3,3
- 3,5
- Error
Determine Output: main() { printf("%x",-1<<4); }
- -16
- fff0
- 0
- 0010
The symbol "?" belongs to which operator?
- Conditional Operator
- Bitwise Operators
- Logical operators
- Relational Operator
A class is
- Data Type
- Abstract Type
- User Defined Type
- All of these options
A recursive function would result in infinite recursion, if the following were left out:
- Base case
- Recursive call
- Subtraction
- Local variable declarations
UML stands for
- Unique modeling language.
- Unified modeling language
- Unified modern language
- Unified master laqnguage
This operator returns the size in bytes of that data type or object or structure etc
- Conditional Operator
- Bitwise Operators
- sizeof () operator
- Relational Operator
Exit is a function defined in the cstdlib library.
- True
- False