computer MCQs

10th • Chapter 04

50 Questions TextBook
1

A data structure is a container used to store a collection of data items in a ___.

A
random order
B
specific layout
C
scattered way
D
different file
2

An array is a data structure that can hold multiple values of the ___ data type.

A
same
B
different
C
integer
D
character
3

An important property of an array is that it stores all values at ___ locations in computer memory.

A
random
B
non-consecutive
C
consecutive
D
separate
4

In the C array declaration 'int marks[20];', what does 'int' represent?

A
Array Name
B
Array Size
C
Data Type
D
Index
5

What is the unique identifier used to refer to an array called?

A
Data Type
B
Array Name
C
Array Size
D
Index
6

The maximum number of elements an array can hold is defined by its ___.

A
Index
B
Name
C
Data Type
D
Size
7

Assigning values to an array for the first time is called ___.

A
Array Declaration
B
Array Initialization
C
Array Accessing
D
Array Repetition
8

The index of the first element in any C array is always ___?

A
1
B
-1
C
0
D
N
9

If an array is declared as 'float data[50];', what is the index of the last element?

A
50
B
49
C
1
D
0
10

To access a specific element in an array, you use the array name followed by the ___ in square brackets.

A
value
B
size
C
data type
D
index
11

What structure is used to repeat a set of statements multiple times in C?

A
Conditional
B
Array
C
Loop
D
Data
12

Which of the following is NOT a loop structure mentioned in the chapter?

A
For loop
B
While loop
C
If-else loop
D
Do-While loop
13

The general syntax of a for loop is 'for(initialization; condition; ___ )'.

A
body
B
statement
C
increment/decrement
D
break
14

Which part of the 'for' loop is executed only once, at the very beginning?

A
Condition
B
Body of the loop
C
Increment/decrement
D
Initialization
15

If the condition in a 'for' loop is initially false, the loop body will be executed ___ times.

A
at least once
B
zero
C
infinitely
D
one
16

A loop inside another loop is called a ___ loop.

A
Complex
B
Nested
C
Double
D
Sequential
17

What is each single run or execution of a loop's body called?

A
A round
B
A cycle
C
An iteration
D
A process
18

In the code 'for(int i = 0; i < 10; i++)', the loop will run for how many iterations?

A
9
B
10
C
11
D
1
19

To initialize all elements of an array in a single statement, it must be done at the time of ___?

A
declaration
B
execution
C
compilation
D
accessing
20

What will happen if you try to initialize a whole array with '{}' after it has been declared?

A
It works fine
B
It initializes only the first element
C
The compiler generates an error
D
It fills the array with zeros
21

In C, 'scanf' is a predefined function used for ___?

A
displaying output
B
mathematical calculation
C
taking input from the user
D
closing the program
22

Variables can be used as array ___ to access elements dynamically.

A
names
B
sizes
C
types
D
indexes
23

What data type would be most appropriate for an array storing the heights of students, like 5.7, 6.2?

A
int
B
char
C
string
D
float
24

The 'Code to repeat' inside a loop's curly braces is known as the ___ of the loop.

A
header
B
condition
C
body
D
footer
25

After the body of a 'for' loop executes, which part is typically executed next?

A
Initialization
B
Condition Check
C
Increment/Decrement
D
Stop
26

Nested loops are particularly useful for repeating a ___ multiple times.

A
single value
B
condition
C
pattern
D
declaration
27

To read or write values in an entire array efficiently, you should use a ___?

A
single printf statement
B
switch case
C
loop
D
goto statement
28

What is the result of 'fact = fact * i;' inside a loop designed to calculate a factorial?

A
It adds the numbers
B
It finds the average
C
It multiplies to get the factorial
D
It subtracts the numbers
29

If an array is declared as 'char vowels[5]', how many character values can it store?

A
4
B
5
C
6
D
0
30

In Programming Time 4.9, the 'flag' variable is used to determine if a number is ___?

A
even
B
odd
C
prime
D
negative
31

In the statement 'printf("%d", marks[i]);', 'i' is a ___ used as an index.

A
constant
B
keyword
C
variable
D
data type
32

An 'int' array can hold multiple ___ values.

A
real
B
character
C
string
D
integer
33

What is the purpose of the statement 'i++' in a for loop?

A
To decrease the counter
B
To initialize the counter
C
To test the counter
D
To increase the counter
34

According to the flowchart, if the loop condition is true, what happens next?

A
Initialization
B
Increment/Decrement
C
Execute Associated Code
D
Stop
35

Which of the following correctly declares and initializes an array of 3 integers?

A
int a[]; a = {1,2,3};
B
int a[3] = (1,2,3);
C
int a[3] = {1,2,3};
D
int a = {1,2,3};
36

The expression 'i % n == 0' checks if 'i' is ___ by 'n'.

A
a multiple of
B
greater than
C
less than
D
equal to
37

A loop that never terminates is called an ___ loop.

A
empty
B
nested
C
infinite
D
invalid
38

To print numbers from 1 to 10, the loop condition could be ___?

A
i > 10
B
i < 10
C
i <= 10
D
i == 10
39

Which part of the 'for' loop is checked before every iteration?

A
Initialization
B
Body
C
Increment/Decrement
D
Condition
40

In a nested loop structure, the ___ loop completes all its iterations for every single iteration of the ___ loop.

A
outer, inner
B
inner, outer
C
first, second
D
second, first
41

The statement 'for(int i = 1; i <= 5; i++)' will cause the loop to iterate how many times?

A
4
B
5
C
6
D
1
42

Which keyword is associated with the 'for' loop structure?

A
repeat
B
loop
C
for
D
while
43

The structure that allows repetition of a set of instructions is known as a ___ structure.

A
data
B
file
C
conditional
D
loop
44

Contiguous memory allocation means the memory blocks are ___ one another.

A
far from
B
inside
C
next to
D
opposite to
45

What is the output of 'printf("%d", array[2]);' if 'array' is '{10, 20, 30, 40}'?

A
10
B
20
C
30
D
40
46

What is the primary focus of Chapter 4: Data and Repetition?

A
Functions and Pointers
B
File Handling
C
Arrays and For Loops
D
Object-Oriented Programming
47

A 'for' loop combines initialization, condition, and increment/decrement in a ___ line.

A
single
B
double
C
multi-line
D
separate file
48

The 'break' statement is used to ___ a loop.

A
enter
B
continue
C
exit
D
repeat
49

The unique identifier for an array is its ___?

A
Type
B
Name
C
Size
D
First element
50

Using loops makes it easier to ___ and ___ values in arrays.

A
declare, define
B
read, write
C
delete, create
D
move, copy