
Q1
Q1 Why is learning programming important in today's world?
For academic purposes only
To automate and solve complex problems
Only for software development
For entertainment purposes only
Q2
Q2 Which of the following is true about interpreters?
They execute programs faster than compilers
They translate the entire program at once
They translate and execute code line by line
They are not used in modern programming
Q3
Q3 What is the primary purpose of writing a "Hello World" program when learning a new programming language?
To test if the language supports string operations
To learn complex programming concepts
To demonstrate basic syntax and output
To introduce advanced programming features
Q4
Q4 Identify the error in this C program:
#include <stdio.h>
int main() {
print("Hello, World!");
return 0;
}
Missing #include statement
Incorrect function name
Syntax error in return statement
No error
Q5
Q5 What data type would you use to store a character in C?
int
float
char
double
Q6
Q6 What is the size of 'int' data type in C?
Depends on the system
4 bytes
8 bytes
2 bytes
Q7
Q7 What will be the output of the following C code?
int main() {
char c = 'A';
printf("%d", c);
return 0;
}
65
A
Syntax Error
None of these
Q8
Q8 Spot the error in this code snippet:
#include <stdio.h>
int main() {
const int age; age = 30;
printf("%d", age);
return 0;
}
Uninitialized constant
Missing return statement
Syntax error in printf statement
No error
Q9
Q9 What is the purpose of the printf function in C?
To read input
To print output
To perform calculations
To control program flow
Q10
Q10 What will the following C code output?
int main() {
int num;
scanf("%d", &num);
printf("%d", num);
return 0;
}
The inputted number
%d
Syntax Error
Nothing
Q11
Q11 Identify the error in this C code:
int main() {
int x;
scanf("%d", x);
printf("%d", x);
return 0;
}
Missing & in scanf
Wrong format specifier
No error
Syntax error
Q12
Q12 Which operator is used for division in C?
-
*
/
=+
Q13
Q13 What does the '!' operator do in C?
Negation
Addition
Multiplication
None
Q14
Q14 What will be the output of the following C code?
int main() {
int a = 10, b = 5;
printf("%d", a / b);
return 0;
}
2
5
0
10
Q15
Q15 What is the output of the following C code snippet?
int main() {
int x
= 10;
printf("%d", x++ + ++x);
return 0;
}
20
21
22
23
Q16
Q16 What is the result of the following expression?
int a = 1; int b = a++ + ++a;
2
3
4
5
Q17
Q17 Pseudocode:
SET x TO 5, y TO 10 IF x LESS THAN y THEN PRINT "x is less than y" ELSE PRINT "x is not less than y"
Prints "x is less than y"
Prints "x is not less than y"
Prints nothing
Syntax error
Q18
Q18 Pseudocode:
SET num TO 5 IF num EQUALS 5 THEN PRINT "Five" ELSE PRINT "Not Five"
Prints "Five"
Prints "Not Five"
Prints nothing
Syntax error
Q19
Q19 Pseudocode:
SET a TO 10, b TO 20 IF a GREATER THAN b THEN PRINT "a is greater" ELSE PRINT "b is greater or equal"
Prints "a is greater"
Prints "b is greater or equal"
Prints nothing
Syntax error
Q20
Q20 Pseudocode:
SET c TO 15 IF c MOD 2 EQUALS 0 THEN PRINT "Even" ELSE PRINT "Odd"
Prints "Even"
Prints "Odd"
Prints nothing
Syntax error
Q21
Q21 Spot the error:
int main() {
int a = 10, b = 0;
printf("%d", a / b);
return 0;
}
Division by zero
Syntax error
No error
Wrong format specifier
Q22
Q22 What does the break statement do in a loop?
Exits the loop
Skips the current iteration
Repeats the loop
Does nothing
Q23
Q23 In a switch statement, what happens if a break statement is omitted from a case?
The program exits
The case is skipped
Fall-through to the next case
Syntax error
Q24
Q24 What is the purpose of the continue statement in loops?
Terminates the loop
Skips to the next iteration
Does nothing
Exits the program
Q25
Q25 When is a do-while loop preferred over a while loop?
When the condition is complex
When the loop must execute at least once
When the loop should not execute
When the loop is infinite
Q26
Q26 What will the following C code print?
int main() {
for(int i = 0; i < 3; i++)
{ printf("%d ", i); }
return 0;
}
0 1 2
1 2 3
0 1 2 3
1 2 3 4
Q27
Q27 What does this C code do?
int main()
{ int i = 0;
while(i < 5) { if(i == 2) break;
printf("%d ", i); i++; }
return 0;
}
Prints 0 1 2
Prints 0 1
Prints all numbers less than 5
Prints nothing
Q28
Q28 Pseudocode:
SET num TO 10 IF num EQUALS 10 THEN PRINT "Ten" ELSE PRINT "Not Ten"
Prints "Ten"
Prints "Not Ten"
Prints nothing
Syntax error
Q29
Q29 Pseudocode:
SET x TO 5 WHILE x GREATER THAN 0 DO PRINT x DECREMENT x
Prints numbers from 5 to 1 in descending order
Prints 5
Prints 0
Syntax error
Q30
Q30 Pseudocode:
FOR i FROM 1 TO 5 PRINT i
Prints numbers from 1 to 5
Prints numbers from 1 to 4
Prints 5
Syntax error


