MCQ PORTAL

Back to All Topics

Basics of C

Showing 30 of 30 questions in this topic

Start Practice Mode

Answer Green MarksON

Correct answers are highlighted in green

C001Basics of C • Program structure
Most ImportantEasy

Q1.From which function does the execution of every C program begin?

A
start()
B
main()
Correct answer
C
begin()
D
program()
C002Basics of C • Identifiers
Most ImportantEasy

Q2.Which of the following is a VALID identifier in C?

A
2sum
B
sum_2
Correct answer
C
sum-2
D
float
C004Basics of C • Header files
Most ImportantEasy

Q3.Which header file must be included to use printf() and scanf()?

A
<conio.h>
B
<stdlib.h>
C
<stdio.h>
Correct answer
D
<string.h>
C005Basics of C • Data types
Most ImportantEasy

Q4.Which format specifier is used to print an integer with printf()?

A
%c
B
%d
Correct answer
C
%f
D
%s
C008Basics of C • Constants
Most ImportantEasy

Q5.A single character constant in C is enclosed within:

A
double quotes " "
B
single quotes ' '
Correct answer
C
parentheses ( )
D
curly braces { }
C009Basics of C • Syntax
Most ImportantEasy

Q6.Which symbol is used to terminate a statement in C?

A
colon :
B
full stop .
C
semicolon ;
Correct answer
D
comma ,
C012Basics of C • Variables
Most ImportantEasy

Q7.Which is the correct way to declare two integer variables a and b?

A
int a, b;
Correct answer
B
int a; b;
C
integer a, b;
D
int: a, b;
C088Basics of C • Format specifier
Most ImportantEasy

Q8.Which format specifier is used to read or print a single character?

A
%d
B
%c
Correct answer
C
%s
D
%f
C089Basics of C • Format specifier
Most ImportantEasy

Q9.Which format specifier is used for a string in printf() and scanf()?

A
%c
B
%d
C
%s
Correct answer
D
%f
C092Basics of C • Identifiers
Most ImportantEasy

Q10.Which of the following is an INVALID identifier in C?

A
int_1
B
_count
C
roll no
Correct answer
D
sum1
C093Basics of C • Variables
Most ImportantEasy

Q11.A variable in C must be ______ before it is used.

A
printed
B
declared
Correct answer
C
deleted
D
returned
C003Basics of C • Keywords
ImportantEasy

Q12.How many keywords are there in standard (ANSI/C89) C?

A
30
B
32
Correct answer
C
40
D
64
C006Basics of C • Data types
ImportantMedium

Q13.On most modern compilers (such as GCC), what is the size of an int variable?

A
1 byte
B
2 bytes
C
4 bytes
Correct answer
D
8 bytes
C007Basics of C • Data types
ImportantEasy

Q14.Which of the following is NOT a valid data type in C?

A
float
B
double
C
real
Correct answer
D
char
C010Basics of C • Preprocessor
ImportantEasy

Q15.Which preprocessor directive is used to include a header file?

A
#define
B
#include
Correct answer
C
#import
D
#header
C011Basics of C • Preprocessor
ImportantMedium

Q16.The line #define MAX 100 is an example of a:

A
variable declaration
B
symbolic constant (macro)
Correct answer
C
function definition
D
keyword
C090Basics of C • sizeof
ImportantEasy

Q17.What is the size of a char variable in C?

A
1 byte
Correct answer
B
2 bytes
C
4 bytes
D
8 bytes
C091Basics of C • sizeof
ImportantMedium

Q18.The sizeof operator in C returns the:

A
value of a variable
B
number of bytes occupied by a type or variable
Correct answer
C
address of a variable
D
number of digits
C094Basics of C • Data types
ImportantMedium

Q19.A char variable in C actually stores the:

A
shape of the character
B
ASCII value of the character
Correct answer
C
font of the character
D
colour of the character
C095Basics of C • Constants
ImportantEasy

Q20.Which of the following is a valid floating-point (float) constant?

A
3.14
Correct answer
B
"3.14"
C
'3'
D
3,14
C096Basics of C • Escape sequence
ImportantMedium

Q21.Which escape sequence is used to print a single backslash?

A
\n
B
\t
C
\\
Correct answer
D
\b
C098Basics of C • Escape sequence
ImportantEasy

Q22.The escape sequence \0 represents the:

A
newline character
B
tab character
C
null character
Correct answer
D
backspace
C099Basics of C • Variables
ImportantMedium

Q23.The initial value of an uninitialised local variable in C is:

A
0
B
1
C
a garbage (unpredictable) value
Correct answer
D
NULL
C013Basics of C • Comments
OtherEasy

Q24.Comments written with /* ... */ in a C program are:

A
executed at runtime
B
ignored by the compiler
Correct answer
C
printed on the screen
D
treated as errors
C014Basics of C • Character set
OtherEasy

Q25.Which of the following is a token in C?

A
keyword
B
identifier
C
operator
D
all of these
Correct answer
C097Basics of C • Escape sequence
OtherMedium

Q26.To print a double quote inside a printed string, you use:

A
\'
B
\"
Correct answer
C
\d
D
\q
C100Basics of C • Console I/O
OtherMedium

Q27.Which function reads a single character from the keyboard?

A
getchar()
Correct answer
B
printf()
C
puts()
D
strlen()
C101Basics of C • Console I/O
OtherEasy

Q28.The puts() function is used to:

A
read a number
B
display a string on the screen
Correct answer
C
compare strings
D
find string length
C102Basics of C • Data types
OtherHard

Q29.The range of an unsigned char (1 byte) is:

A
-128 to 127
B
0 to 255
Correct answer
C
0 to 127
D
-255 to 255
C103Basics of C • Constants
OtherHard

Q30.Which of the following is NOT a valid constant in C?

A
3.14
B
0x1F
C
3.14.15
Correct answer
D
100