WorksheetsCODETRONICS WORKSHOP TEST
Total questions: 30
Worksheet time: 15mins
What is the output of this statement "printf("%d", (a++))"?
The value of (a + 1)
The current value of a
Error message
Garbage
How many times will the following loop execute? for(j = 1; j <= 10; j = j-1)
Forever
Never
0
1
Which one of the following is a loop construct that will always be executed once?
for
while
switch
do while
How many bytes does "int D" use?
0
1
2 or 4
10
Find a correct C Keyword below.
work
permanent
constant
case
Which of the following loop types is not supported in C?
for
while
do-while
foreach
Who defines the user-defined function?
Compiler
Computer
Compiler library
Users
What does the 'continue' statement do in a loop in C?
Terminates the loop immediately
Skips the current iteration and proceeds to the next iteration
Pauses the loop temporarily
None of the above
In C, what is the purpose of the break statement in a switch statement?
It terminates the program.
It exits the current loop.
It transfers control to a specific case label.
It continues to the next case label.
Which looping construct is best when the number of iterations is known beforehand?
while loop
do-while loop
for loop
All are equally good
In C, which operator is used for logical AND?
&&
&
and
AND
How is user input read in C using the scanf() function?
scanf("format string", &variable);
scanf(&variable, "format string");
scanf(format string, variable);
scanf(&variable);
Which header file should be included to use the printf() and scanf() functions in C?
stdlib.h
stdio.h
string.h
math.h
Who is known as the founder of the C language?
Ken Thompson
Dennis Ritchie
Martin Richard
Kernighan
Which of the following is not an arithmetic operation?
a * = 10;
a / = 10;
a ! = 10;
a % = 10;
What are the entities whose values can be changed called?
Constants
Variables
Modules
Tokens
Which is correct with respect to size of the datatypes?
char > int > float
int > char > float
char < int < double
double > char > int
What will be the output of the following C code? #include
Nothing
Run time error
Hello
Varies
Which datatype can accept the switch statement?
int
char
long
all of the mentioned
Which of the following statement is TRUE for switch statement?
It is mandatory to include at least one case in the switch block.
It is optional to include a default case.
There is no restriction on the number of cases that can be included in as switch statement.
None of the above
C programming body of a switch statement must consist of:
A case labeled statement
default labeled statement
A statement
A loop
C language is known for its feature of "portability." What does portability refer to in this context?
The ability to run code on any platform without modification
The ability to write code without any bugs
The ability to write code quickly
The ability to create complex graphics
How many keywords are there in C Language?
30
22
32
36
Identify wrong C keyword below
auto, double, int, struct
break, else, long, switch
case, enum, register, typedef
char, extern, intern, return
What is the purpose of the 'return' statement in a function in C?
To exit the program
To return a value to the caller
To pause the execution
To declare a variable
What is the size of a float data type in C?
2 bytes
4 bytes
8 bytes
16 bytes
What does the 'sizeof' operator do in C?
Returns the size of a variable
Returns the size of a data type
Both of the above
None of the above
Which of the following is not a valid data type in C?
float
double
decimal
char
10 11 12 13 14
10 10 10 10 10
0 1 2 3 4
Compilation Error
What will be the output of the following code? #include
8
9
7
6
