MCQ Bank
Shifting the binary numbers is similar to shifting the _____ numbers.
- A) Base 7
- B) Decimal
- C) Octal
- D) Hexadecimal
a = a|b; ca be written as________________.
- A) a |=b;
- B) a=b;
- C) a =|b;
- D) a ==b;
What is the storage space of double data type?
- A) 64 bytes
- B) 32 bytes
- C) 16 bytes
- D) 8 bytes
For casting, we normally declare a pointer of type _____________.
- A) integer
- B) NULL
- C) void
- D) we are going to use
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
Which one of the following is used to perform bit-wise OR operation?
- 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
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
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
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()
a = a + 1; can be written as _______________.
- A) 1 + a = a;
- B) a + = 1;
- C) a + a + 1;
- D) a + 1;
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;
malloc function returns ___________to the __________________ from the available memory.
- A) integer pointer, middle of the chunk of memory allocated from the heap
- B) NULL pointer, end of the chunk of memory allocated from the stack
- C) void pointer , starting of the chunk of memory allocated from the heap
- D) void pointer, starting of the chunk of memory allocated from the array
What term describes creating variables from a class?
- A) Object creation
- B) Declaration
- C) Initialization
- D) Implementation
The exclusive OR operator returns 1 if ______________.
- A) Both inputs are 1
- B) One input is 1 and other is zero
- C) Both inputs are 0
- D) None of the given
The ____________ is called automatically when an object destroys
- A) destructor
- B) main program
- C) default constructor
- D) constructor
To access the data members of structure, _______ is used.
- A) Logical operator
- B) Dereference operator
- C) Dot operator
- D) Address operator
Initializing the data member within the class is _____________.
- A) a syntax error
- B) a logical error
- C) not an error
- D) a run time error
Which of the following code segment represents a left shift operator?
- A) result = number >> 1 ;
- B) cin >> number ;
- C) cout<<1;
- D) result = number << 1 ;
Which one of the following is mandatory preprocessor directive for c++?
- A) #undef <iostream>
- B) #include <iostream>
- C) #undef <iostream>
- D) All of the given