NEW
Font size
WorksheetsC-Volution (Easy 1)
Total questions: 30
Worksheet time: 15mins
Which of the following is the correct extension for a C program file?
.js
.c
.java
.py
What is the correct syntax to print "Hello, World!" in C?
print("Hello, World!");
printf("Hello, World!");
cout << "Hello, World!";
System.out.println("Hello, World!");
Which of the following is NOT a valid C variable name?
my_var
2nd_variable
_count
name123
What symbol is used to end a statement in C?
.
,
;
:
What is the keyword used to declare a function in C?
def
function
void
func
Which function is used to read input from the user in C?
scanf()
input()
get_input()
read()
What is the correct way to declare a constant in C?
constant int x = 10;
int x = const 10;
#define x 10
final int x = 10;
Which keyword is used to return a value from a function?
stop
return
end
break
What is the size of an int in C (usually)?
2 bytes
4 bytes
8 bytes
16 bytes
What will be the output of printf("%d", 'A');?
A
65
Error
a
Which of the following is NOT a valid data type in C?
float
double
real
char
What is the result of 5 % 2 in C?
2
2.5
1
0
What is the relational operator for "not equal to" in C?
<>
=!
!=
^=
What will int x = 5; printf("%d", x++); print?
5
6
Error
4
What is the logical AND operator in C?
&
&&
|
||
How do you declare an array of size 5 in C?
int arr[5];
array int arr[5];
arr[5] int;
int[5] arr;
Which loop will execute at least once in C?
for
while
do-while
None
Which of the following is a pointer declaration?
int *p;
int p;
int &p;
pointer p;
Which of the following statements about C is false?
C is case-sensitive.
C is an object-oriented language.
C supports pointers.
C is a structured language.
Which library function is used to find the length of a string?
len()
strlen()
strlength()
size()
What will printf("%c", 97); print?
97
'a'
Error
A
How is a null character represented in C?
'\n'
'\0'
'\t'
' '
Which function is used to allocate memory dynamically?
malloc()
alloc()
memory()
memalloc()
What will be the output of printf("%d", sizeof(char));?
1
2
4
8
What is the return type of the main() function in C?
int
void
depends on the compiler
None
Which header file is required for printf()?
stdlib.h
stdio.h
conio.h
string.h
What will be the output of printf("%d", 5 & 3);?
1
3
5
2
What is the purpose of the break statement?
Stop the program
Exit from a loop
Restart the program
Ignore an error
Which of the following is a comment in C?
--
//
**
%%
What does return 0; indicate in the main() function?
Program executed successfully
Program has errors
Loop terminated
Memory fr
