Home
MCQS
C/C MCQ Quiz Hub
C programming language MCQ Questions Set 3
Choose a topic to test your knowledge and improve your C/C skills
1. Which of the following statements are false?
bool can have two values and can be used to express logical expressions
bool cannot be used as the type of the result of the function
bool can be converted into integers implicitly
a bool value can be used in arithmetic expressions
2. For what values of the expression is an if-statement block not executed?
0 and all negative values
0 and -1
0
0, all negative values, all positive values except 1
3. Which of the two operators ++ and — work for the bool data type in C++?
None
++
—
++ & —
4. How many characters are specified in the ASCII scheme?
64
128
256
24
5. Which of the following belongs to the set of character types?
char
wchar_t
only a
both wchar_t and char
6. How do we represent a wide character of the form wchar_t?
L’a’
l’a’
L[a]
la
7. In C++, what is the sign of character data type by default?
Signed
Unsigned
Implementation dependent
Unsigned Implementation
8. Is the size of character literals different in C and C++?
Implementation defined
Can’t say
Yes, they are different
No, they are not different
9. Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?
4
1
Implementation dependent
Machine dependent
10. What constant defined in <climits> header returns the number of bits in a char?
CHAR_SIZE
SIZE_CHAR
BIT_CHAR
CHAR_BIT
11. The size_t integer type in C++ is?
Unsigned integer of at least 64 bits
Signed integer of at least 16 bits
Unsigned integer of at least 16 bits
Signed integer of at least 64 bits
12. Which of these expressions will return true if the input integer v is a power of two?
(v | (v + 1)) == 0;
(~v &amp; (v – 1)) == 0;
(v | (v – 1)) == 0;
(v &amp; (v – 1)) == 0;
13. Which of these expressions will make the rightmost set bit zero in an input integer x?
x = x | (x-1)
x = x &amp; (x-1)
x = x | (x+1)
x = x &amp; (x+2)
14. Which of these expressions will isolate the rightmost set bit?
x = x &amp; (~x)
x = x ^ (~x)
x = x &amp; (-x)
x = x ^ (-x)
15. 0946, 786427373824, ‘x’ and 0X2f are _____ _____ ____ and _____ literals respectively.
decimal, character, octal, hexadecimal
octal, hexadecimal, character, decimal
hexadecimal, octal, decimal, character
octal, decimal, character, hexadecimal
16. Which of the following is not one of the sizes of the floating point types?
short float
float
long double
double
17. What is the range of the floating point numbers?
-3.4E+38 to +3.4E+38
-3.4E+38 to +3.4E+34
-3.4E+38 to +3.4E+36
-3.4E+38 to +3.4E+32
18. Which of three sizes of floating point types should be used when extended precision is required?
float
double
long double
extended float
19. Which is used to indicate single precision value?
F or f
L or l
Either F or for L or l
Neither F or for L or l
20. Which is correct with respect to the size of the data types?
char &gt; int &lt; float
int &lt; char &gt; float
char &lt; int &lt; float
char &lt; int &lt; double
21. The size of an object or a type can be determined using which operator?
malloc
sizeof
malloc
calloc
22. It is guaranteed that a ____ has at least 8 bits and a ____ has at least 16 bits.
int, float
char, int
bool, char
char, short
23. Implementation dependent aspects about an implementation can be found in ____
&lt;implementation&gt;
&lt;limits&gt;
&lt;limit&gt;
&lt;numeric&gt;
24. Size of C++ objects are expressed in terms of multiples of the size of a ____ and the size of a char is ______
char, 1
int, 1
float, 8
char, 4
25. Identify the incorrect option.
1 &lt;= sizeof(bool) &lt;= sizeof(long)
sizeof(float) &lt;= sizeof(double) &lt;= sizeof(long double)
sizeof(char) &lt;= sizeof(long) &lt;=sizeof(wchar_t)
sizeof(N) = sizeof(signed N) = sizeof(unsigned N)
26. Which of the following will not return a value?
null
void
empty
free
27. __________ have the return type void.
all functions
constructors
destructors
none of the mentioned
28. What does the following statement mean? void a;
variable a is of type void
a is an object of type void
declares a variable with value a
flags an error
29. Choose the incorrect option.
void is used when the function does not return a value
void is also used when the value of a pointer is null
void is used as the base type for pointers to objects of unknown type
void is a special fundamental type
30. Identify the incorrect option.
enumerators are constants
enumerators are user-defined types
enumerators are same as macros
enumerator values start from 0 by default
31. In which type do the enumerators are stored by the compiler?
string
integer
float
string &amp; float
32. To which of these enumerators can be assigned?
integer
negative
enumerator
all of the mentioned
33. What will happen when defining the enumerated type?
it will not allocate memory
it will allocate memory
it will not allocate memory to its variables
allocate memory to objects
34. Which variable does equals in size with enum variable?
int variable
float variable
string variable
float &amp; string variable
35. What does the following statement mean? int (*fp)(char*)
pointer to a pointer
pointer to an array of chars
pointer to function taking a char* argument and returns an int
function taking a char* argument and returning a pointer to int
36. Choose the right option. string* x, y;
x is a pointer to a string, y is a string
y is a pointer to a string, x is a string
both x and y are pointers to string types
y is a pointer to a string
37. Which one of the following is not a possible state for a pointer.
hold the address of the specific object
point one past the end of an object
zero
point to a type
38. Which of the following is illegal?
int *ip;
string s, *sp = 0;
int i; double* dp = &amp;i;
int *pi = 0;
39. The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is _______
int **fun(float**, char**)
int *fun(float*, char*)
int **fun(float*, char**)
int ***fun(*float, **char)
40. Which of the following correctly declares an array?
int array[10];
int array;
array{10};
array array[10];
41. What is the index number of the last element of an array with 9 elements?
9
8
0
Programmer-defined
42. What is the correct definition of an array?
An array is a series of elements of the same type in contiguous memory locations
An array is a series of element
An array is a series of elements of the same type placed in non-contiguous memory locations
An array is an element of the different type
43. Which of the following accesses the seventh element stored in array?
array[6];
array[7];
array(7);
array;
44. Which of the following gives the memory address of the first element in array?
array[0];
array[1];
array(2);
array;
45. What is the meaning of the following declaration? int(*p[5])();
p is pointer to function
p is array of pointer to function
p is pointer to such function which return type is the array
p is pointer to array of function
46. What is size of generic pointer in C++ (in 32-bit platform)?
2
4
8
0
47. The constants are also called as ________
const
preprocessor
literals
variables
48. What are the parts of the literal constants?
integer numerals
floating-point numerals
strings and boolean values
all of the mentioned
49. How are the constants declared?
const keyword
#define preprocessor
both const keyword and #define preprocessor
$define
Submit