Programs in C
C Programming Fundamentals covering data types, operators, pointers, arrays, structures, unions, enums, and control structures
Questions
<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?
- 8, 2, 2
- 4, 4, 2
- 8, 4, 2
- Compilation error
- Runtime error
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?
- Compilation error
- 0, 0
- 65536, 0
- Runtime error
- 65536, - 10
The most common use of one dimensional array in C is which of the following?
- Int
- Char
- Function
- String
- Void
<stdio.h>void main() { int i=3; int *j, **k; j=&i; k=&j; printf("%u%u%d", k, *k, **k);}</stdio.h>
- Address, address, 3
- Address, address, address
- 3, address, address
- Syntax error
- Runtime error
<stdio.h>void main() { print("%d%d%d", sizeof(4.14), sizeof(4.14f), sizeof(4.14L)); }</stdio.h>
- 10, 4, 10
- Lexical error
- Compile error
- 8, 4, 4
- 8, 4,10
Which of the following is an integral data type?
- Float
- Char
- Double
- Return
- Void
<stdio.h>void main() { volatile int a=12; printf("%d", a); }</stdio.h>
- Can not predict
- 12
- Garbage value
- Compiler error
- Semantics error
<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>
- 10
- 15
- - 15
- Runtime error
- Syntax error
<stdio.h>void main() { char x=260; int i; i=x + !x + ~x + ++x; printf("%d", i); }</stdio.h>
- - 5
- 4
- Lexical error
- - 6
- Syntax error
<stdio.h>void main() { int x; x=sizeof(!7.8); printf("%d",x); }</stdio.h>
- 4
- 2
- 8
- 1
- 10
<stdio.h>void main() { int a= 100; void *j= &a; int *k= j; printf("%u", *k); } </stdio.h>
- Runtime error
- Compiler error
- Garbage value
- Address
- 100
<stdio.h>void main() { int x; x=10, 20, 30; printf("%d", x); } </stdio.h>
- 30
- 20
- 10
- Garbage value
- Lexical error
Which of the following creates a memory overlay area, with each union member using same memory storage locations?
- Array
- Union
- Structure
- Function
- Void
<stdio.h>void main() { int x; x=1; x= 2 + 2 * x++; printf("%d", x); }</stdio.h>
- 5
- 6
- 4
- Syntax error
- Runtime error
Which of the following loops is called exit controlled loop?
- Do while
- While
- For
- Break
- Goto