MCQ Bank
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
What will be the output of following C++ program? #include <iostream> using namespace std; int main() { int num1 = 10; int num2 = 20/3; int sum; sum = num1 + num2; cout << "The sum is: " << sum << endl; return 0; }
- A) The sum is: 19
- B) The sum is: 16
- C) The sum is: 18
- D) The sum is: 20
In C/C++, which of the following data type is used to store real numbers?
- A) int
- B) float
- C) char
- D) boolean
Which of the following is an example of logical operator?
- A) &&,||
- B) <,>
- C) +,*
- D) /,%