Tag: programming languages

Questions Related to programming languages

  1. No default constructor is provided by the compiler

  2. The compiler provides the default constructor

  3. The compiler generates error

  4. None of the Above


Correct Option: B
Explanation:

In the given code, a class named "exforsys" is defined. It does not have any member variables or functions.

Now, let's go through each option and determine which one is true:

A. No default constructor is provided by the compiler: This option is incorrect. By default, if no constructor is defined in a class, the compiler provides a default constructor. So, this option is false.

B. The compiler provides the default constructor: This option is correct. When no constructor is defined in a class, the compiler automatically generates a default constructor. So, this option is true.

C. The compiler generates an error: This option is incorrect. Since the class does not have any member variables or functions, there is no reason for the compiler to generate an error. So, this option is false.

D. None of the above: This option is incorrect. As explained earlier, the correct answer is option B. So, this option is false.

Therefore, the correct answer is:

B. The compiler provides the default constructor.

  1. Private members of the class

  2. protected members of the class

  3. Both A and B

  4. None of the Above


Correct Option: C
  1. Write Once, Run Anywhere

  2. Read Once, Write Anywhere

  3. Read Once, Run Anywhere

  4. Write Twice, Run Once


Correct Option: A
  1. Dennis Ritchie

  2. James Gosling

  3. Bjarne Stroustrup

  4. Ken Thompson


Correct Option: C