Unit 1 - Practice Quiz
CSE101
1 Which of the following is NOT a valid identifier in C?
_myVar
my_Var
1stVar
Var1
2 Which of the following is a reserved keyword in C?
main
include
volatile
integer
3
What is the memory size typically allocated for a char data type in C?
4 Which escape sequence is used to represent a newline character?
\t
\n
\a
\r
5
What is the correct format specifier to print a double variable?
%d
%f
%lf
%c
6 How is a hexadecimal constant represented in C?
0x
0
H
#
7 What is the result of the expression in C?
8 Which of the following operators has the highest precedence?
+
==
*
=
9
What is the output of the following code snippet?
int a = 10; printf("%d", a++);
10
The expression a = 5 returns which value?
11 Which of the following is a valid string constant?
"Hello"
{Hello}
[Hello]
12
What is the range of a signed int if it occupies 2 bytes?
13 Which operator is used to determine the size of a data type or variable in bytes?
length()
size()
sizeof
malloc
14
What is the result of 3 << 2?
15 The Bitwise AND operator is represented by:
&&
&
|
!
16
What is the output of int x = 5.9; printf("%d", x);?
17 Which of the following is a ternary operator?
if-else
?:
switch
&&
18
If a = 10 and b = 20, what is the result of (a > b) && (b++)?
19
Which header file is required for printf and scanf?
conio.h
stdlib.h
stdio.h
math.h
20
What is the result of ~0 (Bitwise NOT of 0) on a standard system using 2's complement?
21 Which variable declaration is invalid?
int _count;
float rate2;
double break;
char c;
22
What logic does the Bitwise XOR (^) operator follow?
23
The associativity of the assignment operator (=) is:
24
What is the value of x after: int x = 4 + 2 * 3;?
25 Which of the following is NOT a derived data type?
26 What defines a constant variable in C?
static
volatile
const
fixed
27
What is the output of 5 | 2?
28
What happens if you use the modulus operator % on float variables?
29 Which of the following correctly represents logical OR?
&
||
|
or
30
What is the result of !5?
31
In the expression c = a > b ? a : b;, what does c store?
a
b
a and b
a and b
32 Which operator is used to access the address of a variable?
*
&
->
@
33
What is the value of x? int x = (1, 2, 3);
34 Which format specifier is used for a string?
%c
%d
%s
%f
35
What is the result of right shifting (-1 >> 1) generally on signed integers?
36
Which of the following is an l-value?
10
x + y
var
a++
37 What is the implicit type conversion hierarchy (Arithmetic conversion) from low to high?
int -> char -> float -> double
char -> int -> float -> double
float -> double -> int -> char
double -> float -> int -> char
38 Which of the following is correct regarding variable names?
39
What is the output of int x = 10; x += x *= 2; printf("%d", x);?
40 Which logical operator has the highest precedence?
&&
||
!
==
41
What is the binary representation of 10?
42 Which of the following is a Unary operator?
*
++
%
^
43
What does the expression (float)9/2 evaluate to?
44 Which of the following is NOT a fundamental data type in C?
float
string
int
char
45
What is the value of z? int x=5, y=10; int z = (x < y) ? x++ : y++;
46 A variable declared inside a function without a storage class is implicitly:
extern
static
auto
global
47 Which statement about comments in C is true?
// starts a multi-line comment
/* and */ are for single line only
/* ... /* ... */ ... */ are allowed
/* ... */ handles multi-line comments
48
What is the ASCII value of character '0' (zero)?
49
What is the result of 1 ^ 1?
50 Which operator performs a 'One's Complement'?
-
!
~
^