MCQ Bank
Memory allocated at run time is a system resource, and it is the responsibility of the _____ to deallocate this memory.
- A) Compiler
- B) Destructor
- C) Garbage collector
- D) Programmer
The data members that are visible only from inside the class and hidden from the outside known as.
- A) Friend
- B) Private and Public
- C) Public
- D) Private
In C/C++ language, memory at runtime is allocated from _______.
- A) Free store(heap)
- B) ROM
- C) Stack
- D) Hard disk
An entry in an online encyclopedia that refers to another entry whose title has been changed is an example of _________.
- A) Dangling pointer
- B) Reference pointer
- C) NULL pointer
- D) This pointer
In C++, which operator is used for memory allocation?
- A) Calloc
- B) Allocate
- C) New
- D) Allocate_memory
Where can we declare a friend function in the class?
- A) Anywhere
- B) Main()
- C) Void
- D) Nowhere
Which one is correct syntax for declaration of a function which can return a reference?
- A) datatype& function_name (parameter list)
- B) &datatype function_name (parameter list)
- C) datatype (parameter list) &function_name
- D) &function_name datatype (parameter list)
In the following code, what will be the output of i? #include<iostream> using namespace std; main() { int i; int &j = i; i = 123; cout<< "\n The value of i =" << i; }
- A) 321
- B) 012345x
- C) 123
- D) X012345
In C++, sizeof operator is used to determine ____________.
- A) Number of words
- B) Size of data type
- C) Length of string
- D) Length of words
calloc() functions allocates multiple blocks of memory and each block have _______?
- A) Same size
- B) Different length
- C) Same length
- D) Different size
Which one is the correct syntax to declare the friend function?
- A) FRIEND return_type friend_function_name(int, char);
- B) friend return_type friend_function_name(int, char);
- C) Friend return_type (int, char);
- D) FRIEND friend_function_name(int, char);
If the memory in the free store is not sufficient enough to fulfill the request, malloc () function returns ________.
- A) NULL
- B) 1
- C) 0
- D) -1
Data encapsulation can be achieved through ________.
- A) Structures
- B) Arrays
- C) Pointers
- D) Classes
The return type of malloc () function is ________.
- A) float pointer
- B) void pointer
- C) NULL pointer
- D) int pointer
C/C++ has many libraries which contain variables and function names normally starting with ____.
- A) Hash
- B) Hyphen
- C) Underscore
- D) Semi-Colon
Short data type store ______ bytes of memory.
- A) 3
- B) 2
- C) 4
- D) 1
Which data type from the following will take lesser space in memory?
- A) int
- B) char
- C) float
- D) short
In C++, which of the following option has the correct meaning of the expression “a <= b” ?
- A) a is less than b
- B) a is greater than b
- C) a is less than or equal to b
- D) a is greater than or equal to b
Normally, the float data type is half of the size of ___________.
- A) double
- B) short
- C) char
- D) int
In C++, cout is known as ______.
- A) input stream
- B) output stream
- C) file stream
- D) error stream