(a) (i) int res = 'A'; What is the value of res?

ICSE Class 10 Computer Applications PYQ · 2018 Paper · Section A

21 Mark · 2018 · Section A · 2018 Paper

(a) (i) int res = 'A';
What is the value of res?

Show SolutionHide Solution↓

Value of res is 65 which is the ASCII code of A. As res is an int variable and we are trying to assign it the character A so through implicit type conversion the ASCII code of A is assigned to res.

(ii) Name the package that contains wrapper classes.

java.lang

(b) State the difference between while and do while loop.

whiledo-while
It is an entry-controlled loop.It is an exit-controlled loop.
It is helpful in situations where numbers of iterations are not known.It is suitable when we need to display a menu to the user.

(c) System.out.print("BEST ");
     System.out.println("OF LUCK");

Choose the correct option for the output of the above statements

  1. BEST OF LUCK
  2. BEST
    OF LUCK

Option 1 — BEST OF LUCK is the correct option.
System.out.print does not print a newline at the end of its output so the println statement begins printing on the same line. So the output is BEST OF LUCK printed on a single line.

(d) Write the prototype of a function check which takes an integer as an argument and returns a character.

char check(int a)

(e) Write the return data type of the following function.

  1. endsWith()
  2. log()
  1. boolean
  2. double
← Previous questionNext question →

Browse the free Computer Applications sample bank