computer MCQs
10th • Chapter 03
49 Questions TextBook
1
Which statements help decide the next statements to be executed based on a condition?
2
What is the default control structure in the C language?
3
In an 'if' statement, the code gets executed only if the condition is what?
4
The condition inside an 'if' statement is enclosed in which symbols?
5
A condition in an 'if' statement can be which type of expression?
6
In C, any expression that evaluates to a non-zero value is considered what?
7
An expression that evaluates to zero is considered what?
8
Which of the following expressions evaluates to 'true'?
9
For associating multiple statements with an 'if', they must be enclosed in what?
10
What happens if the condition 'a > b' is false in the code: if (a > b) printf("A"); printf("B");?
C
Both A and B are printed 11
Which statement is used to execute a block of code if a condition is true and another block if it is false?
12
An 'else' statement must be associated with which statement?
13
A set of multiple instructions enclosed in braces is called a?
D
Block or Compound Statement 14
The 'if-else-if' statement is also known as what?
15
Conditional statements within other conditional statements are called what?
C
Nested selection structures 16
In the expression 'if (condition)', what is 'if'?
17
Which operator is used for logical AND in C?
18
Which operator is used to check for equality?
19
What is the purpose of conditional logic in programming?
20
If percentage is 65, what grade is assigned by the code: if (p>=80) G='A'; else if (p>=70) G='B'; else if (p>=60) G='C';?
21
A flow chart uses a diamond shape to represent what?
22
In C, what does the expression '5 % 2 == 0' evaluate to?
23
An 'if' statement inside another 'if' statement is an example of a _____ structure.
24
The code associated with an 'if' statement is executed when the condition is true. Otherwise...
B
the associated code does not get executedC
the compiler skips the entire program 25
Which header file is typically required for 'printf' and 'scanf' functions?
26
What does the '!' operator do in a logical expression?
27
In an 'if-else-if' ladder, when is the final 'else' block executed?
B
When the first 'if' is trueC
When all preceding conditions are falseD
When all preceding conditions are true 28
For a home user consuming 300 units of electricity, what is the unit price according to the PDF?
29
For a commercial user consuming 500 units of electricity, what is the unit price according to the PDF?
30
What is a 'compound statement'?
A
A statement with a conditionB
A statement that calls a functionC
Multiple statements enclosed in braces {}D
A statement that declares a variable 31
If 'int a=15;', the condition 'a % 2 == 0' evaluates to what?
32
Which statement is NOT a type of control statement in C?
33
What is the primary function of a selection statement?
A
To repeat a set of instructionsB
To execute statements in sequenceC
To decide which statements to execute next 34
If you want to check if a character 'ch' is a digit, which condition can be used?
35
What is the potential issue if you have multiple statements under an 'if' but do not use braces {} before an 'else'?
36
In the problem to find the largest of three numbers (n1, n2, n3), which condition checks if n1 is the largest?
37
A condition can be any valid expression EXCEPT?
38
Which of the following is a relational expression?
39
In a flow chart, a rectangle is used to represent what?
40
To get a bonus of Rs. 10000, what conditions must be met according to 'Programming Time 3.2'?
C
items_sold > 100 && items_broken == 0D
items_sold > 100 || items_broken == 0 41
The structure where the program flow is a straight line, executing one statement after another, is called?
42
What does 'a % c == 0' check?
D
If a multiplied by c is 0 43
If a student's percentage is 49.9, what grade will they receive based on the logic in the PDF?
44
In C, 'if' is a...
45
The statements that control the flow of execution of a program are called?
46
In 'if (a > b)', 'a > b' is the?
47
What is the correct syntax for an 'if' statement in C?
48
The 'else' part of an 'if-else' statement is?
C
Required for compilationD
Used to start a program 49
What is the output of: int x=5; if (x==5) printf("A"); else printf("B");?