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 12

The fields in the class in c++ program are by default

protected

private

 public

 none of the mentioned
SHOW ANSWER

Constructors are used to

initialize the objects

construct the data members

both initialize the objects & construct the data members

 none of the mentioned
SHOW ANSWER

 When struct is used instead of the keyword class means, what will happen in the program?

access is public by default

access is private by default

access is protected by default

 none of the mentioned
SHOW ANSWER

Which is private member functions access scope?

Member functions which can only be used within the class

 Member functions which can used outside the class

Member functions which are accessible in derived class

 Member functions which can’t be accessed inside the class
SHOW ANSWER

Which among the following is true?

The private members can’t be accessed by public members of the class

The private members can be accessed by public members of the class

 The private members can be accessed only by the private members of the class

 The private members can’t be accessed by the protected members of the class
SHOW ANSWER

Which member can never be accessed by inherited classes?

Private member function

 Public member function

 Protected member function

 All can be accessed
SHOW ANSWER

 Which syntax among the following shows that a member is private in a class?

private: functionName(parameters)

 private(functionName(parameters))

 private functionName(parameters)

 private::functionName(parameters)
SHOW ANSWER

If private member functions are to be declared in C++ then _____________

private: 


 private(private member list)

 private :- <private members>
SHOW ANSWER

In java, which rule must be followed?

Keyword private preceding list of private member’s

 Keyword private with a colon before list of private member’s

 Keyword private with arrow before each private member

Keyword private preceding each private member
SHOW ANSWER

How many private member functions are allowed in a class ?

Only 1

 Only 7

Only 255

 As many as required
SHOW ANSWER

 How to access a private member function of a class?

Using object of class

 Using object pointer

Using address of member function

 Using class address
SHOW ANSWER

Private member functions ____________

Can’t be called from enclosing class

 Can be accessed from enclosing class

 Can be accessed only if nested class is private

Can be accessed only if nested class is public
SHOW ANSWER

Which function among the following can’t be accessed outside the class in java in same package?

public void show()

void show()

 protected show()

static void show()
SHOW ANSWER

If private members are to be called outside the class, which is a good alternative?

 Call a public member function which calls private function

 Call a private member function which calls private function

 Call a protected member function which calls private function

 Not possible
SHOW ANSWER

 A private function of a derived class can be accessed by the parent class.

True

False
SHOW ANSWER

 Which error will be produced if private members are accessed?

Can’t access private message

 Code unreachable

Core dumped

 Bad code
SHOW ANSWER

Can main() function be made private?

Yes, always

 Yes, if program doesn’t contain any classes

 No, because main function is user defined

No, never
SHOW ANSWER

If a function in java is declared private then it __________________

Can’t access the standard output

 Can access the standard output

 Can’t access any output stream

 Can access only the output streams
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