MCQ Bank
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;
________ character is used to terminate a string.
- A)
- B)
- C)
- D)
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
which of the following is an example of repetition structure?
- A)
- B)
- C)
- D)
What term describes creating variables from a class?
- A) Object creation
- B) Declaration
- C) Initialization
- D) Implementation
Function declaration is a one-line statement in which we write the return type, ________ of the function and the ________ of arguments
- A)
- B)
- C)
- D)
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
Which of the following option gives the value stored at the address pointed to by the pointer "ptr"?
- A)
- B)
- C)
- D)
The ____________ is called automatically when an object destroys
- A) destructor
- B) main program
- C) default constructor
- D) constructor
in C++, cout is known as ________
- A)
- B)
- C)
- D)
To access the data members of structure, _______ is used.
- A) Logical operator
- B) Dereference operator
- C) Dot operator
- D) Address operator