computer MCQs

10th • Chapter 02

49 Questions TextBook
1

Which function is used to display formatted output on the screen?

A
scanf
B
getch
C
printf
D
main
2

What is the correct format specifier for an integer data type?

A
%f
B
%c
C
%s
D
%d
3

The scanf() function is used to perform which operation?

A
Display output
B
Get input from the user
C
Hold the screen
D
Terminate the program
4

Which header file is required to use the getch() function?

A
stdio.h
B
math.h
C
conio.h
D
string.h
5

What symbol is used as a statement terminator in C language?

A
:
B
.
C
,
D
;
6

Which of the following is an escape sequence for a new line?

A
\t
B
\n
C
\b
D
\\
7

The escape sequence \t is used to insert a what?

A
New Line
B
Backspace
C
Tab
D
Single Quote
8

Which operator is used to assign a value to a variable?

A
0
B
0
C
!=
D
<=
9

Which of the the following is an arithmetic operator?

A
&&
B
||
C
0
D
%
10

The modulus operator (%) works on which type of data?

A
float
B
char
C
double
D
int
11

Which operator compares two values for equality?

A
0
B
!=
C
0
D
>=
12

What is the purpose of relational operators?

A
To perform arithmetic calculations
B
To assign values
C
To compare two values
D
To perform logical operations
13

A true value in a Boolean expression is represented by what number in C?

A
0
B
1
C
-1
D
10
14

Which of the following is a logical operator?

A
<
B
>
C
&&
D
+
15

The AND (&&) operator returns true only if...

A
one operand is true
B
both operands are true
C
both operands are false
D
one operand is false
16

The NOT (!) operator is what type of operator?

A
Binary
B
Ternary
C
Unary
D
Relational
17

Which operator has the highest precedence?

A
+
B
*
C
()
D
0
18

In an expression with multiple operators of equal precedence, which operator is evaluated first?

A
The rightmost operator
B
The leftmost operator
C
The middle operator
D
The last operator
19

What does the getch() function do with the character entered by the user?

A
Displays it on screen
B
Does not display it on screen
C
Stores it in a file
D
Ignores it
20

A single scanf() function can be used to take how many inputs?

A
Only one
B
Only two
C
Multiple inputs
D
No inputs
21

What is the escape sequence for displaying a backslash (\) character?

A
//
B
\b
C
\\
D
\s
22

What value does the expression 5 != 7 evaluate to?

A
True
B
False
C
0
D
Error
23

The OR (||) operator returns false only if...

A
one operand is true
B
both operands are true
C
both operands are false
D
one operand is false
24

What is the result of the expression 7 % 3?

A
1
B
2
C
3
D
2.33
25

If both operands of a division are integers, the result will be a(n)...

A
float
B
char
C
integer
D
double
26

What does short-circuit evaluation mean for an AND operation?

A
If the left expression is false, the whole expression is false
B
The right expression is always evaluated
C
If the left expression is true, the whole expression is false
D
Both expressions are always evaluated
27

Binary operators require how many operands?

A
One
B
Two
C
Three
D
Zero
28

What is the format specifier for the float data type?

A
%d
B
%c
C
%f
D
%i
29

To display a float value with exactly two digits after the decimal point, you would use?

A
%.nf
B
%.2f
C
%2.f
D
%f.2
30

The address of a variable in scanf() is specified using which symbol?

A
*
B
&
C
%
D
#
31

What is the purpose of the expression a++?

A
Add 2 to a
B
Multiply a by 1
C
Increase the value of a by 1
D
No change
32

Which operator is an example of a unary operator?

A
+
B
*
C
!
D
/
33

Which of the following correctly converts the algebraic expression x = 6y + z into a C expression?

A
x = 6(y) + z;
B
x = 6y + z;
C
x = 6*y + z;
D
x = (6*y) + z
34

A tab stop is a collection of how many spaces?

A
4
B
6
C
8
D
10
35

Which operator returns the remainder of a division?

A
Division (/)
B
Multiply (*)
C
Modulus (%)
D
Subtract (-)
36

What is the result of the expression !(True)?

A
True
B
False
C
1
D
Error
37

What is the format specifier for the char data type?

A
%d
B
%c
C
%f
D
%s
38

What happens if you forget the '&' sign in a scanf() function?

A
The program works as expected
B
A compiler error occurs
C
The program executes but does not behave as expected
D
The computer shuts down
39

Which of these is NOT a relational operator?

A
!=
B
>=
C
<
D
&&
40

What is the name given to the backslash (\) character in an escape sequence?

A
Forward slash
B
Escape character
C
Control character
D
Sequence starter
41

The expression a-- is equivalent to which statement?

A
a = a - 2;
B
a = a * -1;
C
a = a - 1;
D
a = 1 - a;
42

What value is represented by a 'false' relational expression?

A
1
B
-1
C
0
D
any non-zero value
43

What will printf("%d", 5 > 7); display?

A
1
B
0
C
True
D
False
44

C language performs short-circuit evaluation for which operators?

A
Arithmetic operators
B
Relational operators
C
Assignment operators
D
Logical operators
45

What is the primary role of the printf() function?

A
To read data from the keyboard
B
To show output on the screen
C
To perform mathematical calculations
D
To declare variables
46

The values inside the double quotes of a simple printf() statement are...

A
processed as variables
B
displayed on screen as they are
C
evaluated as expressions
D
ignored by the compiler
47

When does the getch() function allow the program to continue execution?

A
After pressing the Enter key
B
Immediately after the user types any key
C
After a 5-second delay
D
After the program finishes
48

Which of the following is a binary operator?

A
!
B
++
C
- (sign operator)
D
||
49

What is the purpose of the main() function in a C program?

A
It is the entry point for program execution
B
It handles all input/output operations
C
It defines all variables
D
It includes header files