(a) Which of the following are valid comments ?

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

11 Mark · 2014 · Section A · 2014 Paper

(a) Which of the following are valid comments ?

Show SolutionHide Solution↓

The valid comments are:

Option 1 — /*comment*/
Option 3 — //comment

(b) What is meant by a package ? Name any two java Application Programming Interface packages.

A package is a named collection of Java classes that are grouped on the basis of their functionality. Two java Application Programming Interface packages are:

  1. java.util
  2. java.io

(c) Name the primitive data type in Java that is:

  1. a 64-bit integer and is used when you need a range of values wider than those provided by int.
  2. a single 16-bit Unicode character whose default value is '\u0000'.
  1. long
  2. char

(d) State one difference between the floating point literals float and double.

float literalsdouble literals
float literals have a size of 32 bits so they can store a fractional number with around 6-7 total digits of precision.double literals have a size of 64 bits so they can store a fractional number with 15-16 total digits of precision.

(e) Find the errors in the given program segment and re-write the statements correctly to assign values to an integer array.

int a = new int (5);
for (int i=0; i<=5; i++) a[i]=i;

Corrected Code:

int a[] = new int[5];
for (int i = 0; i < 5; i++)
    a[i] = i;
Next question →

Browse the free Computer Applications sample bank