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
Select an option to see the answer and solution.
What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int x[100];
int main()
{
cout << x[99] << endl;
}A. Garbage value
B. 0
C. 99
D. Error
Select an option to see the answer and solution.
Which of the following is accessed by a member function of a class?
A. The object of that class
B. All members of a class
C. The public part of a class
D. The private part of a class
Select an option to see the answer and solution.
Which of the following type is provided by C++ but not C?
A. int
B. bool
C. float
D. double
Select an option to see the answer and solution.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class A
{
private:
int x;
public:
A(int _x) { x = _x; }
int get() { return x; }
};
class B
{
static A a;
public:
static int get()
{ return a.get(); }
};
int main(void)
{
B b;
cout << b.get();
return 0;
}A. Garbage value
B. Compile-time Error
C. Run-time Error
D. Nothing is printed
Select an option to see the answer and solution.
What is the other name of compile-time polymorphism?
A. Static polymorphism
B. Dynamic polymorphism
C. Executing polymorphism
D. Non-executing polymorphism
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Which of the following is not a type of inheritance?
A. Multiple
B. Multilevel
C. Distributive
D. Hierarchical
Select an option to see the answer and solution.
Which of the following is used for comments in C++?
A. // comment
B. /* comment */
C. both // comment or /* comment */
D. // comment */
Select an option to see the answer and solution.
Which of the following operator(s) can be used with pointers?
i. – only
ii. +, *
iii. +, –
iv. +, -, *
v. /
vi. + only
A. i only
B. vi only
C. ii and v
D. iv
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
What happens if the following program is executed in C and C++?
#include <stdio.h>
void func()
{
printf("Hello");
}
void main()
{
func();
func(2);
}A. Error in both C and C++
B. Outputs Hello twice in both C and C++
C. Error in C and Outputs Hello twice in C++
D. Error in C++ and Outputs Hello twice in C
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Which of the following is correct in C++?
A. Classes cannot have protected data members
B. Structures can have member functions
C. Class members are public by default
D. Structure members are private by default
Select an option to see the answer and solution.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Point
{
int x, y;
public:
Point(int i = 0, int j =0)
{ x = i; y = j; }
int getX() const { return x; }
int getY() {return y;}
};
int main()
{
const Point t;
cout << t.getX() << " ";
cout << t.gety();
return 0;
}A. 0 0
B. Garbage values
C. Compile error
D. Segmentation fault
Select an option to see the answer and solution.
Which of the following escape sequence represents tab?
Select an option to see the answer and solution.
What is the other name of run-time polymorphism?
A. Static polymorphism
B. Dynamic polymorphism
C. Executing polymorphism
D. Non-executing polymorphism
Select an option to see the answer and solution.
Which function is used to write a single character to console in C++?
A. cout.put(ch)
B. cout.putline(ch)
C. write(ch)
D. printf(ch)
Select an option to see the answer and solution.