NEW
Font size
S
M
L
XL
WorksheetsC Programming Basics – Decision Making, Loops, Arrays & Strings
Total questions: 74
Worksheet time: 37mins
Name
Class
Date
1.
Which keyword is used for simple decision making?
a)
if
b)
else
c)
switch
d)
goto
2.
Which block executes when condition is false?
a)
if
b)
else
c)
for
d)
while
3.
Which statement tests multiple conditions?
a)
if
b)
for
c)
switch
d)
goto
4.
Which keyword starts a switch statement?
a)
case
b)
default
c)
switch
d)
break
5.
Which keyword ends a case block?
a)
goto
b)
continue
c)
break
d)
return
6.
Which loop checks condition at the start?
a)
do-while
b)
while
c)
goto
d)
switch
7.
Which loop executes at least once?
a)
for
b)
while
c)
do-while
d)
if
8.
Which loop is best when count is known?
a)
while
b)
do-while
c)
for
d)
goto
9.
Which loop is exit controlled?
a)
while
b)
for
c)
do-while
d)
switch
10.
Which causes loop termination?
a)
continue
b)
break
c)
goto
d)
case
11.
continue statement does what?
a)
Stops program
b)
Skips iteration
c)
Ends loop
d)
Repeats loop
12.
goto uses which identifier?
a)
function
b)
label
c)
loop
d)
array
13.
Nested loop means
a)
loop in if
b)
loop in loop
c)
if in loop
d)
goto in loop
14.
Which loop is used for matrices?
a)
single loop
b)
nested loop
c)
switch
d)
if
15.
Infinite loop example
a)
while(0)
b)
for(;;)
c)
do{}while(0)
d)
break
16.
Array is a group of
a)
various types
b)
same type
c)
functions
d)
constants
17.
First index value of array
a)
1
b)
0
c)
-1
d)
depends
18.
Correct syntax for 1D array
a)
int a;
b)
int a[5];
c)
a{5};
d)
array a;
19.
Loop best for arrays
a)
while
b)
switch
c)
for
d)
goto
20.
How many elements in int a[5]?
a)
4
b)
5
c)
6
d)
depends
21.
2D array mainly used for
a)
strings
b)
matrix
c)
stack
d)
queue
22.
Total elements in a[2][3]
a)
5
b)
6
c)
2
d)
3
23.
Array name stores
a)
value
b)
address
c)
size
d)
index
24.
Which operator accesses array element?
a)
()
b)
{}
c)
[]
d)
<>
25.
Array memory allocation is
a)
random
b)
linked
c)
contiguous
d)
separate
26.
String is a sequence of
a)
integers
b)
characters
c)
floats
d)
double
27.
String ending character is
a)
\n
b)
\t
c)
\0
d)
space
28.
Correct string declaration
a)
string s
b)
char s[10];
c)
int s
d)
float s
29.
Which header supports strings?
a)
stdio.h
b)
conio.h
c)
string.h
d)
math.h
30.
Function to read string safely
a)
gets
b)
scanf
c)
fgets
d)
puts
31.
Function to display string
a)
puts
b)
gets
c)
fgets
d)
scanf
32.
strlen() gives
a)
memory
b)
length
c)
address
d)
ASCII
33.
strcpy() does
a)
compare
b)
copy
c)
join
d)
reverse
34.
strcmp() returns 0 when
a)
strings differ
b)
first bigger
c)
equal
d)
error
35.
strcat() does
a)
copy
b)
compare
c)
join
d)
find length
36.
scanf %s stops at
a)
newline
b)
space
c)
tab
d)
null
37.
puts adds
a)
newline
b)
space
c)
null
d)
tab
38.
Size of 'A' string is
a)
1
b)
2
c)
depends
d)
error
39.
String stored as
a)
char array
b)
int array
c)
double
d)
float
40.
Which is logical AND
a)
&
b)
&&
c)
||
d)
!
41.
Which is equality operator
a)
=
b)
==
c)
!=
d)
<=
42.
Relational operators give
a)
int result
b)
floating
c)
char
d)
string
43.
Which is not loop
a)
for
b)
while
c)
switch
d)
do-while
44.
Which jumps to label
a)
break
b)
continue
c)
goto
d)
return
45.
Default case executes when
a)
always
b)
no case matches
c)
first case
d)
break used
46.
break in switch does
a)
continue
b)
exit switch
c)
repeat
d)
skip
47.
Without break switch leads to
a)
error
b)
fall through
c)
stop
d)
skip
48.
Nested if means
a)
if in if
b)
if in loop
c)
loop in if
d)
goto in if
49.
Which conditional operator
a)
? :
b)
&&
c)
||
d)
==
50.
Array index increment uses
a)
++
b)
--
c)
+
d)
*
51.
Matrix addition requires
a)
any size
b)
same order
c)
row only
d)
column only
52.
Valid 2D declaration
a)
int a[2][3]
b)
int a[][]
c)
a(2,3)
d)
array a
53.
Matrix looping uses
a)
single loop
b)
nested loop
c)
if
d)
goto
54.
Which is not string function
a)
strlen
b)
strcpy
c)
stradd
d)
strcmp
55.
tolower() converts
a)
lower to upper
b)
upper to lower
c)
digit
d)
symbol
56.
toupper() converts
a)
upper to lower
b)
lower to upper
c)
number
d)
special
57.
strlen excludes
a)
null
b)
space
c)
character
d)
tab
58.
Char input function
a)
getchar
b)
gets
c)
scanf
d)
puts
59.
Char output function
a)
putchar
b)
puts
c)
printf
d)
scanf
60.
Array size fixed at
a)
compile time
b)
run time
c)
any time
d)
never
61.
String comparison is
a)
arithmetic
b)
logical
c)
lexicographical
d)
relational
62.
Multiple conditions handled by
a)
if
b)
switch
c)
for
d)
while
63.
Which loop preferred infinite
a)
for
b)
while
c)
do-while
d)
if
64.
Null character ASCII
a)
0
b)
10
c)
32
d)
48
65.
Each case in switch needs
a)
colon
b)
semicolon
c)
comma
d)
dot
66.
Switch expression cannot be
a)
int
b)
char
c)
float
d)
enum
67.
Which is not decision statement
a)
if
b)
switch
c)
for
d)
goto
68.
Logical OR is
a)
|
b)
||
c)
&&
d)
!
69.
Not relational operator
a)
<
b)
>
c)
==
d)
&&
70.
Array element access is
a)
direct
b)
sequential
c)
random
d)
binary
71.
String length of "Hi"
a)
1
b)
2
c)
3
d)
0
72.
Return statement exits
a)
loop
b)
function
c)
program
d)
switch
73.
Main function returns
a)
void
b)
int
c)
char
d)
float
74.
Program execution begins at
a)
start
b)
init
c)
main
d)
first line
Reset
