Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C++ - QUESTIONS : PART 11

Which of the following can be overloaded?

Object

Functions

Operators

Both B and C
SHOW ANSWER

Which of the following means "The use of an object of one class in definition of another class"?

Encapsulation

Inheritance

Composition

Abstraction
SHOW ANSWER

 Which of the following is the only technical difference between structures and classes in C++?

Member function and data are by default protected in structures but private in classes.

Member function and data are by default private in structures but public in classes.

Member function and data are by default public in structures but private in classes.

Member function and data are by default public in structures but protected in classes.
SHOW ANSWER

Which of the following statements is correct about the program given below?
class Bix
{
    public:
    static void MyFunction();
};
int main()
{
    void(*ptr)() = &Bix::MyFunction;
    return 0; 

The program reports an error as pointer to member function cannot be defined outside the definition of class.

The program reports an error as pointer to static member function cannot be defined.

The program reports an error as pointer to member function cannot be defined without object.

The program reports linker error.
SHOW ANSWER

Which of the following statements are correct for a static member function?
It can access only other static members of its class.
It can be called using the class name, instead of objects.

Only 1 is correct.

Only 2 is correct.

Both 1 and 2 are correct.

Both 1 and 2 are incorrect.
SHOW ANSWER

Default value of static variable is_____ .


 1

Garbage value 

 Compiler dependent
SHOW ANSWER

By default, members of the class are ____________ in nature.

protected 

 private 

 public 

 static
SHOW ANSWER

class TEST
{
private: 
int roll_no;
public:
int age;
char name[20];
private:
int grade;
protected:
char gender[20];
private: 
private:
int m1, m2, m3; 
};
In general view, is this class definition valid?

Yes

 No
SHOW ANSWER

If a program uses Inline Function, then the function is expanded inline at ___________.

Compile time 

 Run time 

Both a and b 

None of these
SHOW ANSWER

Static variable in a class is initialized when _____ .

every object of the class is created. 

 last object of the class is created. 

 first object of the class is created. 

No need to initialize static variable.
SHOW ANSWER

C structure differs from CPP class in regards that by default all the members of the structure are __________ in nature.

 private

protected 

 public 

 None of these
SHOW ANSWER

State True or False.
i) A satic function can have access to only other static members (functions or variables) declared in the same class.
ii) A static member function can be called using the class name (instead of its objects)

True, True

 True, False

 False, True

False, False
SHOW ANSWER

Which of the following is/ are the characteristics of friend function.

It is not in the scope of the class to which it has been declared as friend.

It can invoke like a normal function without the help of any object.

 Usually, it has the objects as arguments.

All of the above.
SHOW ANSWER

What does your class can hold?

data

functions

both data & functions

 none of the mentioned
SHOW ANSWER

How many specifiers are present in access specifiers in class?

1

2

3

4

SHOW ANSWER

Which is used to define the member of a class externally?

:

 ::

 #

 none of the mentioned
SHOW ANSWER

Which other keywords are also used to declare the class other than class?

struct

 union

object

 both struct & union
SHOW ANSWER

What is the output of this program?
  #include <iostream>
    using namespace std;
    class rect
    {
        int x, y;
        public:
        void val (int, int);
        int area ()
        {
            return (x * y);
        }
    };
    void rect::val (int a, int b)
    {
        x = a;
        y = b;
    }
    int main ()
    {
        rect rect;
        rect.val (3, 4);
        cout << "rect area: " << rect.area();
        return 0;
    }

rect area:12

 rect area: 12

 rect area:24

 none of the mentioned
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in