Quiz Space

Programming Concepts using Java · Quiz 1 · 7 Jul 2024 · May 2024 term

Question 10: Consider the Java code given below.

Question 10

+7 marksOne correct option

Consider the Java code given below.

java
class Screen {
void showContent() {
System.out.println("Display on screen");
}
}
class TV extends Screen {
void showContent() {
super.showContent();
System.out.println("Display on TV");
}
void showContent(String s) {
System.out.println("Display on TV: " + s);
}
}
class Monitor extends TV {
void showContent() {
super.showContent();
System.out.println("Display on monitor");
}
void showContent(String s) {
System.out.println("Display on monitor: " + s);
}
}
class Test {
public static void main(String[] args) {
TV obj = new Monitor(); // LINE 1
obj.showContent();
obj.showContent("News"); // LINE 2
}
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 10 of 15 in the IIT Madras BS Programming Concepts using Java (Java) Quiz 1 paper sat on 7 Jul 2024, in the May 2024 term (IIT M DIPLOMA AN EXAM QDD2 7 July 2024). It carries 7 marks.

More questions from this paper

  1. Q1Which of the following statements is/are correct about activation records?
  2. Q2Match the following terms with their descriptions/properties.
  3. Q3Consider the Java code given below. What will the output be?
  4. Q4Consider the Java code given below. Choose the correct option.
  5. Q5Consider the Java code given below. Choose the correct option.
  6. Q6Consider the Java code given below. Choose the correct option to fill in the CODE SEGMENT so that the output is:\ Parro…
  7. Q7Consider the Java code given below. Identify the correct statement to fill in the blank at LINE 1, such that the output…
  8. Q8Consider the code given below that checks whether two phones are the same. Method equals is overridden to compare two P…
  9. Q9Consider the Java code given below. What will the output be?
  10. Q11Consider the Java code given below. Choose the correct option regarding the above code.
  11. Q12Consider the Java code given below. Choose the correct option.
  12. Q13Consider the Java code given below. Choose the correct option to fill in place of CODE BLOCK to instantiate instance va…
  13. Q14Consider the Java code given below. Identify the appropriate statement to fill in the blank at LINE 1, such that the ou…
  14. Q15Consider the Java code given below. Which of the following statements is FALSE?