ICSE Class 10 Computer Applications Question 10 of 30

Solved Sample Paper 2 — Question 10

Back to all questions
10
Question

Question 1(x)

Give the output of the following

switch (x)
{
case 'M' :
    System.out.print ("Microsoft Teams");
    break; 
case 'G':
    System.out.print ("Google Meet"); 
default:
    System.out.print("Any Software"); 
    break;
case 'W': 
    System.out.print("Web Ex"); 
    break;
}

when x = 'g'

  1. Google Meet
  2. Any Software
  3. Google Meet
    Any Software
  4. Web Ex
Answer

Any Software

Reason — Java is a case sensitive language and thus 'G' and 'g' are treated as two different characters. Since the value of x does not match with any case, the default case will be executed. Thus, "Any Software" will be printed.