C_Programming_Quiz_Answers
C_Programming_Quiz_Answers
• a) Control structures
• b) Modularization
• c) Data declaration
• d) All of the above
2. The loop and process selection are
• a) Control functions
• b) Control structures
• c) Decision makers
• d) Built-in functions
3. The S.E.E is
• a) A structured environment
• b) A traditional language
• c) A structured programming method
• d) A control structure
4. When an algorithm is written in the form of a program, it is called
• a) Structured coding
• b) Code translation
• c) Implementation
• d) Instruction
5. When a reserved word is misused, it causes a
• a) Logical error
• b) Runtime error
• c) Syntax error
• d) Compilation error
6. In C programming, semicolon (;)
int func(int x) {
int sum = 0;
while (x != 0) {
sum += x % 10;
x = x / 10;
}
return sum;
}
For func(123);
• a) 3
• b) 5
• c) 6
• d) 9
int main() {
int i = 3;
printf("%d", ++i);
return 0;
}
• a) 3
• b) 4
• c) 5
• d) 6
9. The valid expression in C evaluates to true:
• a) x + y > z
• b) x & y < z
• c) x > y && y > z
• d) x < y > z
int a = 10;
int b = 20;
int c;
c = a;
a = b;
b = c;
printf("%d %d", a, b);
• a) 10 10
• b) 10 20
• c) 20 10
• d) 20 20
11. The structure of a C program consists of:
• a. header file
• b. main function
• c. statement and return
• d. all of the above
12. Array and pointers are:
• a. arithmetic operators
• b. Relational Operators
• c. Logical Operator
• d. Assignment Operators
• a. variable definition
• b. variable initialization
• c. variable announce
• d. global variable
#include <stdio.h>
int main() {
int n;
Scanf(n);
printf("%od", n);
return 0;
}
• a. "%d"
• b. %d
• c. sn
• d. a & e
18. The missing part in the following program is:
#include <stdio.h>
int main() {
int i = 10;
if (i > 15)
printf("10 is greater than 15");
printf("I am Not in if");
}
• a. {}
• b. scanf statement
• c. return 0
• d. a & c
19. The switch expression should evaluate to:
int main() {
int i = 15;
if (i = 30) {
if (i < 15)
printf("i is smaller than 15\n");
if (i < 12)
printf("i is smaller than 12 too\n");
else
printf("i is greater than 15");
} else {
if (i = 20) {
if (i < 22)
printf("i is smaller than 22 too\n");
else
printf("i is greater than 25");
}
printf("welcome i");
}
• a. welcome i
• b. i is smaller than 15
• c. i is smaller than 12 too
• d. a & c
Turk <3”