NEW
Font size
WorksheetsC Programming Quiz
Total questions: 15
Worksheet time: 8mins
Which of the following is a valid identifier in C?
2data
data_1
char
int-value
Which of the following is not a keyword in C?
auto
register
typedef
function
Which data type is used to represent a single character in C?
int
char
float
double
What is the size of int on a typical 32-bit system?
2 bytes
4 bytes
8 bytes
1 byte
What is the purpose of keywords in C?
They define user-defined variables
They are used to perform operations
They have special meaning and cannot be used as identifiers
They define memory locations
Which of the following is a valid character constant in C?
'abc'
"a"
'a'
a
What is the output data type of sizeof(char) in C?
int
char
float
size_t
Which of the following characters is used to indicate a preprocessor directive?
@
%
#
$
Which of these is not a valid data type in standard C?
float
bool
double
long
Which keyword is used to define a constant value in C?
final
const
static
define
int x = 10;
if (x > 10)
printf("A");
else
printf("B");
A
B
Error
AB
Which of the following is TRUE about else if ladder?
Multiple else if statements can be used ✅
Only one else if is allowed
else if must always end with else
else if works only inside switch
int x = 5;
if (x < 10)
if (x > 0)
printf("Positive");
else
printf("Negative");
Positive
Negative
Error
No output
Which of the following statements about nested if is correct?
Nested if is not allowed in C
Nested if means an if inside another if
Nested if must always have else
Nested if is same as switch
int x = 2;
switch(x) {
case 1: printf("One"); break;
case 2: printf("Two"); break;
case 3: printf("Three"); break;
default: printf("Other");
}
One
Two
Three
Other
