Que- Which of the following is correct?
a. A class is an instance of its objects
b. An object is an instance of its class
c. A class is an instance of the data type that the class have
d. An object is an instance of the data type of the class
Answer- An object is an instance of its class
Que- Which of the following is correct about new and malloc?
a. Both are available in C
b. Pointer object initialization of a class with both new and malloc calls the constructor of that class
c. Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call
d. Pointer object initialization of a class using malloc involves constructor call whereas using new does not involve constructor call
Answer- Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call
Que- What is virtual inheritance?
a. C++ technique to avoid multiple copies of the base class into children/derived class
b. C++ technique to avoid multiple inheritances of classes
c. C++ technique to enhance multiple inheritance
d. C++ technique to ensure that a private member of the base class can be accessed somehow
Answer- C++ technique to avoid multiple copies of the base class into children/derived class
Que- What is the difference between delete and delete[] in C++?
a. delete is used to delete normal objects whereas delete[] is used to pointer objects
b. delete is a keyword whereas delete[] is an identifier
c. delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
d. delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case
Answer- delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
Que- What is the correct syntax of declaring array of pointers of integers of size 10 in C++?
a. int arr = new int[10];
b. int **arr = new int*[10];
c. int *arr = new int[10];
d. int *arr = new int*[10];
Answer- int **arr = new int*[10];
Que- Which of the following is correct about new and malloc?i) new is an operator whereas malloc is a functionii) new calls constructor malloc does notiii) new returns required pointer whereas malloc returns void pointer and needs to be typecast
a. i and ii
b. ii and iii
c. i and iii
d. i, ii and iii
Answer- i, ii and iii
Que- What happens if the following line is executed in C and C++?int *p = malloc(10);
a. Error in both C and C++
b. Warning in both C and C++
c. Error in C++ and successful execution in C
d. Error in C and successful execution in C++
Answer- Error in C++ and successful execution in C
Que- What happens if the following line is executed in C and C++?const int a;
a. Error in both C and C++
b. Warning in both C and C++
c. Error in C and successful execution in C++
d. Error in C++ and successful execution in C
Answer- Error in C++ and successful execution in C
Que- Which of the following type is provided by C++ but not C?
a. int
b. bool
c. float
d. double
Answer- bool
Que- Which of the following feature is not provided by C?
a. Pointers
b. Structures
c. References
d. Functions
Answer- References
Que- Which of the following is not a fundamental type is not present in C but present in C++?
a. int
b. float
c. bool
d. void
Answer- bool
Que- What is the size of a boolean variable in C++?
a. 1 bit
b. 1 byte
c. 4 bytes
d. 2 bytes
Answer- 1 bit
Que- Which of the following is C++ equivalent for scanf()?
a. cin
b. cout
c. print
d. input
Answer- cin
Que- Which of the following is C++ equivalent for printf()?
a. cin
b. cout
c. print
d. input
Answer- cout
Que- Which of the following is the correct difference between cin and scanf()?
a. both are the same
b. cin is a stream object whereas scanf() is a function
c. scanf() is a stream object whereas cin is a function
d. cin is used for printing whereas scanf() is used for reading input
Answer- cin is a stream object whereas scanf() is a function
Que- Which of the following is an exit-controlled loop?
a. for
b. while
c. do-while
d. all of the mentioned
Answer- do-while
Que- Which of the following is an entry-controlled loop?
a. for
b. while
c. do-while
d. both while and for
Answer- both while and for
Que- In which part of the for loop termination condition is checked?for(I;II;III){IV}
a. I
b. II
c. III
d. IV
Answer- II
Que- What is dynamic binding?
a. The process of linking the actual code with a procedural call during run-time
b. The process of linking the actual code with a procedural call during compile-time
c. The process of linking the actual code with a procedural call at any-time
d. All of the mentioned
Answer- The process of linking the actual code with a procedural call during run-time
Que- What is static binding?
a. The process of linking the actual code with a procedural call during run-time
b. The process of linking the actual code with a procedural call during compile-time
c. The process of linking the actual code with a procedural call at any-time
d. All of the mentioned
Answer- The process of linking the actual code with a procedural call during compile-time
Que- What is name mangling in C++?
a. The process of adding more information to a function name so that it can be distinguished from other functions by the compiler
b. The process of making common names for all the function of C++ program for better use
c. The process of changing the names of variable
d. The process of declaring variables of different types
Answer- The process of adding more information to a function name so that it can be distinguished from other functions by the compiler
Que- Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?
a. struct STRUCT S;
b. STRUCT S;
c. Both struct STRUCT S; and STRUCT S;
d. Both C and C++ have different syntax
Answer- struct STRUCT S;
Que- What if we define the below structure in C and C++?
a. Error in C but not in C++
b. Error in C++ but not in C
c. No error in both C and C++
d. Error in both C and C++
Answer- Error in C but not in C++
Que- Which of the following is the scope resolution operator?
a. .
b. *
c. ::
d. ~
Answer- ::
Que- What is the size of a character literal in C and C++?
a. 4 and 1
b. 1 and 4
c. 1 and 1
d. 4 and 4
Answer- 4 and 1
Que- What is the size of a character type in C and C++?
a. 4 and 1
b. 1 and 4
c. 1 and 1
d. 4 and 4
Answer- 1 and 1
Que- Which of the following is correct?
a. struct tag is required in both C and C++ while declaring an object of the structure
b. struct is not required in C but required in C++ while declaring an object of the structure
c. struct is not required in C++ but required in C while declaring an object of the structure
d. struct tag is not required in both C and C++ while declaring an object of the structure
Answer- struct is not required in C++ but required in C while declaring an object of the structure
Que- Which of the following is correct?
a. struct cannot have member function in C but it can in C++
b. struct cannot have member function in C++ but it can in C
c. struct cannot have member function in both C and C++
d. struct can have member function in both C and C++
Answer- struct cannot have member function in C but it can in C++
Que- Which of the following statement is correct?
a. Structure in C allows Constructor definition
b. Structure in C++ allows Constructor definition
c. Both allow Constructor definition
d. C allows constructor definition while C++ does not
Answer- Structure in C++ allows Constructor definition
Que- Which of the following is correct about this pointer in C++?
a. this pointer is passed as a hidden argument in all the functions of a class
b. this pointer is passed as a hidden argument in all non-static functions of a class
c. this pointer is passed as a hidden argument in all static functions of a class
d. this pointer is passed as a hidden argument in all static variables of a class
Answer- this pointer is passed as a hidden argument in all non-static functions of a class
Que- Which of the following operator is used with this pointer to access members of a class?
a. .
b. !
c. ->
d. ~
Answer- ->
Que- Why this pointer is used?
a. To access the members of a class which have the same name as local variables in that scope
b. To access all the data stored under that class
c. To access objects of other class
d. To access objects of other variables
Answer- To access the members of a class which have the same name as local variables in that scope
Que- How many types of polymorphism are there?
a. 1
b. 2
c. 3
d. 4
Answer- 2
Que- What is the other name of compile-time polymorphism?
a. Static polymorphism
b. Dynamic polymorphism
c. Executing polymorphism
d. Non-executing polymorphism
Answer- Static polymorphism
Que- What is the other name of run-time polymorphism?
a. Static polymorphism
b. Dynamic polymorphism
c. Executing polymorphism
d. Non-executing polymorphism
Answer- Dynamic polymorphism
Que- Which of the following is correct about static polymorphism?
a. In static polymorphism, the conflict between the function call is resolved during the compile time
b. In static polymorphism, the conflict between the function call is resolved during the run time
c. In static polymorphism, the conflict between the function call is never resolved during the execution of a program
d. In static polymorphism, the conflict between the function call is resolved only if it required
Answer- In static polymorphism, the conflict between the function call is resolved during the compile time
Que- Which of the following is correct about dynamic polymorphism?
a. In dynamic polymorphism, the conflict between the function call is resolved during the compile time
b. In dynamic polymorphism, the conflict between the function call is resolved during the run time
c. In dynamic polymorphism, the conflict between the function call is never resolved during the execution of the program
d. In dynamic polymorphism, the conflict between the function call is resolved at the beginning of the program
Answer- In dynamic polymorphism, the conflict between the function call is resolved during the run time
Que- Which of the following operator(s) can be used with pointers?i) – onlyii) +, *iii) +, –iv) +, -, *v) /vi) + only
a. i only
b. vi only
c. ii and v
d. iv
Answer- i only