MCQ Bank
Which of the following two array are copy-able?
- A)
- B)
- C)
- D)
What is the storage space of double data type?
- A) 64 bytes
- B) 32 bytes
- C) 16 bytes
- D) 8 bytes
A variable declared inside a code block becomes the ________ variable for that block.
- A)
- B)
- C)
- D)
For casting, we normally declare a pointer of type _____________.
- A) integer
- B) NULL
- C) void
- D) we are going to use
Which type of arrays are used while dealing with sentences?
- A)
- B)
- C)
- D)
What is the primary purpose of a class in C++?
- A) To define a user-defined data type with data members and methods
- B) To execute standalone functions
- C) To store only data without any functions
- D) To replace all global variables in a program
In the call by reference method, which operator is used to get the address of a variable?
- A)
- B)
- C)
- D)
Which one of the following is used to perform bit-wise OR operation?
- A) |
- B) ||
- C) ~
- D) ^
Which of the following is the correct method to declare an array?
- A)
- B)
- C)
- D)
Programmer should be very careful about the memory management because it can _____________.
- A) create problems of NULL pointers
- B) cause problems of memory leakage and dangling pointers
- C) return void pointers
- D) affect the logic of the program
char name[] = "Hello World"; In the above statement, a memory of ________ characters will be allocated to the array name.
- A)
- B)
- C)
- D)
What is the main advantage of using macros instead of functions for simple tasks?
- A) Macros are more secure
- B) Macros reduce memory usage
- C) Macros compile faster
- D) Macros avoid function call overhead
In C++, what is the correct syntax for accessing the fifth element of an array?
- A)
- B)
- C)
- D)
Which of the following permits function overloading in C++.
- A) Both type and arguments
- B) Number of function names
- C) Type only
- D) Number of arguments only
Which of the following shows the memory address of the first element in an array?
- A)
- B)
- C)
- D)
A pointer with value NULL is defined in the header files _____________and ___________.
- A) stdlib.h ,stddef.h
- B) process.h, stdi.h
- C) conio.h ,iostream.h
- D) conio.c ,getche()
In C++, the precise way to declare a pointer is,
- A)
- B)
- C)
- D)
a = a + 1; can be written as _______________.
- A) 1 + a = a;
- B) a + = 1;
- C) a + a + 1;
- D) a + 1;
Identify the invalid option.
- A)
- B)
- C)
- D)
student s[100]; means that ‘s’ is an array of hundred students of type ‘student’ structure. What will be the correct statement to access the ‘name’ data element of the fifty sixth student from the array?
- A) s.name[56];
- B) s[56].name;
- C) s.name[55];
- D) s[55].name;