Java and C++ Programming Concepts

Test your knowledge of Java and C++ programming concepts including OOP, operators, functions, and language-specific features.

18 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

int *p(char *a)

  1. p is a function that returns a pointer to an integer quantity
  2. p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity
  3. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity
  4. None of the above
Question 2 Multiple Choice (Single Answer)

int (*p(char *a))[10]

  1. p is a function that accepts an argument which is a pointer to a character and returns a pointer to a 10 element integer array
  2. p is a function that accepts an argument which is a pointer to a character array and returns an integer quantity
  3. p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity
  4. None of the above
Question 3 Multiple Choice (Single Answer)

The compiler uses it to internally reference the data members of a particular object

  1. vtable entry
  2. this pointer
  3. Constructors
  4. default value
Question 4 True/False

Different Return type is sufficient to overload two C++ functions

  1. True
  2. False
Question 5 True/False

An operator overloading member function requires no arguments for a unary operator

  1. True
  2. False
Question 6 Multiple Choice (Single Answer)

Which of the operators can be overloaded

  1. ::
  2. :?
  3. [ ]
  4. .
Question 7 True/False

The precedence of the operators can be changed by operator overloading

  1. True
  2. False
Question 8 Multiple Choice (Single Answer)

Which one does not have a valueOf(String) method ?

  1. )Integer
  2. Boolean
  3. Character
  4. Long
Question 9 Multiple Choice (Single Answer)

The initial value of an instance variable of type String which is not explicitly initialized in the program is --.

  1. null
  2. ""
  3. NULL
  4. 0
Question 10 Multiple Choice (Single Answer)

What is the output (Assuming written inside main) ? String s1 = new String("gopal"); String s2 = s1.replace('m','i'); s1.concat("Poddar"); System.out.println(s1); System.out.println((s1+s2).charAt(5));

  1. Compile error
  2. gopalPoddar o
  3. gopalPoddar i
  4. gopal i
Question 11 Multiple Choice (Single Answer)

Is the statement true"interface contains variables that must be static and final; abstract class may contain non-final and final variables."

  1. True
  2. False
  3. Neither true nor false
  4. No idea
Question 12 Multiple Choice (Single Answer)

Which of them is false about a Static data member within a class

  1. A single copy of the data member exists
  2. The data member is initialised to zero before the first object is created
  3. Requires a global definition
  4. Storage is allocated to the static data member on declaration
Question 13 True/False

An array of references can be created

  1. True
  2. False
Question 14 True/False

Is HTML page a web component?

  1. True
  2. False
Question 15 True/False

Throwable is the base class for Error and Exception?

  1. True
  2. False
Question 16 True/False

"This" keyword in java refer to current object?

  1. True
  2. False
Question 17 True/False

is JVM a interpreter?

  1. True
  2. False
Question 18 True/False

Final class can be overridden. This statement is…

  1. True
  2. False