Back to Tutorials
Practice TestsICSEClass 9Computer Applications

ICSE class ix computer practice test 3

1.Convert the following code from if….else to switch …case if(val==50) System.out.println(“Fifty”); else if(val==20) System.out.println(“twenty”); else System.out.println(“Enter a valid number”);

Trushna Tejwani31 May 2020
Practice Tests

ICSE class ix computer practice test

Oops concepts

1.Convert the following code from if….else to switch …case
if(val==50)
System.out.println(“Fifty”);
else if(val==20)
System.out.println(“twenty”);
else
System.out.println(“Enter a valid number”);

2. Convert the following code from ternary to if…else.
String result= (marks>35)? “pass”: “fail”;

3. Write a program to ask user to enter any number from 1 to 3.

  • display a message “Hello” if a particular value is equal to 1.
  • display a message “Hi” if a particular value is equal to 2.  
  • display a message “Good” if a particular value is equal to 3. 
  • display a message “No Match Found”  if none of the above conditions are matching. (Use switch-case only)

4. Write a program to print the following series
a. 1 3 5 7 9
b. 5 10 15 20 25

Watch Java videos