Programming Languages: C, C++, and Java

Test your knowledge of C, C++, and Java programming languages including history, syntax, features, and key concepts.

14 Questions Published

Questions

Question 1 True/False

1.Set s = new TreeSet(); 2.s.add("JAVA"); 3.s.add(new Integer(5)); Line 3 will give ClassCast Exception because Two different types of object are getting added.

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

What is the value of variable z when the following program segment ends? int z; for(z=0; z<50; z++) {}

  1. 51
  2. 49
  3. 0
  4. 50
Question 3 Multiple Choice (Single Answer)

Which of the following operators cannot be overloaded?

  1. sizeof
  2. ::
  3. :?
  4. All the Above
Question 4 Multiple Choice (Single Answer)

The vtable entry for a pure virtual function in C++ is

  1. zero
  2. NULL
  3. one
  4. No Entry in vtable
Question 5 Multiple Choice (Single Answer)

For the class exforsys defined as below: class exforsys() { }; int main() { exforsys a; } Which of the following is TRUE?

  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
Question 6 Multiple Choice (Single Answer)

The friend function of a class in C++ can access

  1. Private members of the class
  2. protected members of the class
  3. Both A and B
  4. None of the Above
Question 7 Multiple Choice (Single Answer)

Which programming language was invented by Dennis Ritchie in 1972?

  1. C++
  2. C
  3. JAVA
  4. COBOL
Question 8 Multiple Choice (Single Answer)

Which was the first object oriented programming language?

  1. JAVA
  2. C++
  3. C
  4. SIMULA
Question 9 Multiple Choice (Single Answer)

Which programming language resembles its name to coffee?

  1. JAVA
  2. SIMULA
  3. C++
  4. B
Question 10 Multiple Choice (Single Answer)

JAVA promised which one of these?

  1. Write Once, Run Anywhere
  2. Read Once, Write Anywhere
  3. Read Once, Run Anywhere
  4. Write Twice, Run Once
Question 11 Multiple Choice (Single Answer)

Which programming language was invented by Dennis Ritchie in 1972?

  1. C++
  2. C
  3. JAVA
  4. COBOL
Question 12 Multiple Choice (Single Answer)

C++ programming language was invented by _______.

  1. Dennis Ritchie
  2. James Gosling
  3. Bjarne Stroustrup
  4. Ken Thompson
Question 13 Multiple Choice (Single Answer)

int ThatsMyFunction() { return 5; } void main() { printf("%u",ThatsMyFunction); }

  1. Compilation Error
  2. Some Unknown Random Number
  3. 5
  4. I Dont Know
Question 14 Multiple Choice (Single Answer)

void main() { int i; char *item; for(i=0;i<512;i++,item++) printf("%c",item); }

  1. ASCII Table - twice
  2. Segmentation fault
  3. I hate this Quiz and I dont know it
  4. Compilation Error