Sunday , 20 August 2017
Home » Announcements » ICSE 2014 Computer Applications Paper Solved

ICSE 2014 Computer Applications Paper Solved

Greetings students!

You can now download the ICSE 2014 Computer Applications Question Paper from here : Download [ICSE 2014] Computer Applications Question Paper

We have also solved the theory portion of the question paper and have posted the answers below. The programs of this question paper have been solved separately and appropriate links to the solutions have been posted. [Note: If you find any typing errors in the answers then do report to us by commenting below]

ICSE Question Paper – 2014 (Solved)

Computer Applications
Class X

SECTION A (40 Marks)
Answer all questions from this Section

Question 1.

(a) Which of the following are valid comments?  [2]
       (i)       /* comment */
       (ii)      /*comment
       (iii)     //comment
       (iv)     */ comment */

Ans. (i) /* comment */ and  (iii) //comment

(b) What is meant by a package? Name any two Java Application Programming Interface packages. [2]

Ans. A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.
Two Java Application Programming Interface packages are : java.io and java.util

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

       (i)         a 64-bit integer and is used when you need a range of values wider than those provided by int.
       (ii)        a single 16-bit Unicode character whose default value is ‘u0000’  [2]

Ans. (i) long
        (ii) char

(d) State one difference between floating point literals float and double.  [2]

Ans. float is a single-precision 32-bit floating point literal whereas, double is a double-precision 64-bit floating point literal.
Or,
float can handle about 7 decimal places whereas a double can handle about 16 decimal places.

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

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

Ans. Statement 1 has two errors: the [] is required as “int[] a” or “int a[]“. Also, the 5 should be inside [ ] bracket instead of ( ).

Statement 2 has one error. The condition check should not include the = sign, since the element index should go from 0 to 4 only.

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

Question 2.

(a) Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence. [2]

(i) &&             (ii) %          (iii) >=        (iv) ++

Ans. (iv) ++ , (ii) % , (iii) >= , (i) &&

(b) Identify the statements listed below as assignment, increment, method invocation or object creation statements. [2]

       (i)         System.out.println(“Java”);
       (ii)        costPrice = 457.50;
       (iii)       Car hybrid = new Car();
       (iv)       petrolPrice++;

Ans.     (i)        System.out.println(“Java”); ——- method invocation statement.
            (ii)        costPrice = 457.50; ——- assignment statement.
            (iii)       Car hybrid = new Car(); ——- objet creation statement
            (iv)       petrolPrice++;  ——- increment statement

(c) Give two differences between switch statement and if-else statement. [2]

Ans. (i) if-else can compare conditions for all primitive data types whereas, switch can only compare integers and characters.
(ii) all kinds of relations (= =, <= etc.) can be checked using if-else whereas only equality relation can be checked using switch.

Or,

(iii) In switch case, the control directly goes to the matching case without checking any other cases, whereas, in if-else, all the conditions are checked and then the control goes to the matching condition.

(d) What is an infinite loop? Write an infinite loop statement. [2]

Ans. An infinite loop is a loop which loops endlessly (i.e. executes forever) either due to the loop having no terminating condition or having a condition which is always satisfied.

Examples:

while( true )                                // terminating condition is always satisfied
{
System.out.println(“Infinite”);
}

Or

for( ;; )                                              // terminating condition is missing
{
System.out.println(“Infinite”);
}

(e) What is a constructor? When is it invoked? [2]

Ans. A constructor is a member function with the same name as that of a class and has no return type, not even void. It is invoked whenever an object is created using the new reserved word.

Question 3.

(a) List the variables from those given below that are composite data types. [2]

(i)   static int x;                                               (iv) boolean b;
(ii)  arr[i]=10;                                                 (v)  private char chr;
(iii) obj.display();                                           (vi) String str;

Ans. (ii) arr[], (iii) obj (vi) str

(b) State the output of the following program segment: [2]

       String str1 = “great”;  String str2 = “minds”;
       System.out.println(strl.substring(0,2).concat(str2.substring(l)));
       System.out.println((“WH” + (strl.substring(2).toUpperCase()))); 

Ans. strl.substring(0,2) gives “gr” and str2.substring(l) gives “inds”.
So, strl.substring(0,2).concat(str2.substring(l)) gives “grinds”

strl.substring(2).toUpperCase() gives “EAT”
So, “WH” + (strl.substring(2).toUpperCase()) gives “WHEAT”

Hence the output of the given program segment will be:
grinds
WHEAT

(c) What are the final values stored in variables x and y below? [2]

       double a = – 6.35;
       double b = 14.74;
       double x = Math.abs(Math.ceil(a));
       double y = Math.rint(Math.max(a,b));

Ans. x = 6.0 and y = 15.0
[Working: Math.ceil(- 6.35) will give – 6.0 and Math.abs(- 6.0) will give 6.0
Math.max(- 6.35, 14.74 ) will give 14.74 and Math.rint(14.74) will give 15.0]

(d) Rewrite the following program segment using the if-else statements instead of the ternary operator. [2]

       String grade = (mark>=90) ? “A” : (mark>=80) ? “B” : “C”;

Ans. 

if( marks >= 90 ) {
grade = “A”;
} else if( marks >= 80 ) {
grade = “B”;
} else {
grade = “C”;
}

(e) Give output of the following method: [2]

       public static void main(String[] args) {
       int a = 5;
       a++;
       System.out.println(a);
       a – = (a – –) – (- – a);
       System.out.println(a);  }  

Ans. 6
        4

(f) What is the data type returned by the library functions: [2]

       (i)    compareTo()
       (ii)   equals()

Ans. (i) int
        (ii) boolean

(g) State the value of characteristic and mantissa when the following code is executed. [2]

       String s = “4.3756”;
       int n = s.indexOf(‘.’);
       
int characteristic = Integer.parseInt(s.substring(0,n));
       
int mantissa = Integer.valueOf(s.substring(n+1));

Ans. value of characteristic = 4
        value of mantissa = 3756

(h) Study the method and answer the given questions. [2]

       public void sampleMethod()
       {           for( int i=0; i<3; i++ )
                               {           for( int j=0; j<2; j++)
                                                 { int number = (int)(Math.random() * 10);
                                                    System.out.println(number);     } } }

       (i)         How many times does the loop execute?
       (ii)        What is the range of possible values stored in the variable number?

Ans. (i) The outer loop executes 3 times (for i = 0, 1, 2) and for every execution of the outer loop, the inner loop executes 2 times (for j = 0, 1). Hence, the total number of times the statements in the loop executes = 3 * 2 = 6

         (ii) The range of possible values stored in the variable number is from 0 – 9
[Note: Math.random() generates random decimal point numbers between 0 and 1 like 0.4, 0.1, 0.9 etc. Math.random() * 10 gives you these decimal numbers multiplied with 10, so, you get decimal point numbers between 0 and 10 (10 is exclusive). So, the (int)(Math.random() * 10) will give you random integer numbers from 0-9.]

(i) Consider the following class: [2]

       public class myClass   {
       public static int x = 3, y = 4;
       public int a = 2, b = 3;  }

       (i)         Name the variables for which each object of the class will have its own distinct copy.
       (ii)        Name the variables that are common to all objects of the class.

Ans. (i)         ‘a’ and ‘b’ since these are non-static (instance variables)
        (ii)        ‘x’ and ‘y’ since these are static variables.

(j) What will be the output when the following code segments are executed? [2]

(i)    String s = “1001”;
       int x = Integer.valueOf(s);
       double y = Double.valueOf(s);
       System.out.println(“x=” +x);
       System.out.println(“y=” +y);

(ii)        System.out.println(“The King said “Begin at the beginning!” to me.”);

Ans. (i) x=1001
             y=1001.0

        (ii) The King said “Begin at the beginning!” to me. [ Note: ” is an escape character and prints ” ]

 

SECTION B (60 Marks)

Attempt any four questions from this Section.

Question 4.

Define a class named movieMagic with the following description:

Instance variables/data members:

int year            –           to store the year of release of a movie
String title       –           to store the title of the movie.
float rating      –           to store the popularity rating of the movie.
(minimum rating = 0.0 and maximum rating = 5.0)

Member Methods:

(i)         movieMagic()              Default constructor to initialize numeric data members to 0 and String data member to “”.

(ii)        void accept()               To input and store year, title and rating.

(iii)       void display()              To display the title of a movie and a message based on the rating as per the table below.

Rating Message to be displayed
0.0 to 2.0 Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0 Super Hit

 
Write a main method to create an object of the class and call the above member methods.

Ans. See: [Question 4] ICSE 2014 Paper Solved (movieMagic)

Question 5.

A special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to the original two-digit number.

Example:         Consider the number 59.
Sum of digits = 5 + 9 = 14
Product of its digits = 5 x 9 = 45
Sum of the sum of digits and product of digits= 14 + 45 = 59

Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, output the message “Special 2-digit number” otherwise, output the message “Not a Special 2-digit number”.

Ans. See: [Question 5] ICSE 2014 Paper Solved (Special 2-Digit No)

Question 6.

Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and file extension separately as shown.

Input               C:UsersadminPicturesflower.jpg
Output             Path:    C:UsersadminPictures
File name:        flower
Extension:       jpg

Ans. See: [Question 6] ICSE 2014 Paper Solved (File Path Name)

Question 7.

To be added soon.

Question 8.

To be added soon.

Question 9.

To be added soon.

 

Check Also

Procedure to be followed for Applying for Rechecking of ICSE and ISC Papers

Steps to be followed for applying for a recheck of subject marks for ICSE an ISC and what are evaluated during a recheck.

5 comments

  1. verrrrrrrrrrrrryyyyy much helpful!!!!!!!!!!

  2. thnksssss it helped us so much to get good marks

  3. Thanks
    It was very helpful
    Keep it up
    Thank you sooooooooooooooooo much!!!!!!!!

  4. Input 10 numbers and print the two digit numbers.

    • import java.io.*;
      class Find2Dig
          {
              public static void main(String args[])throws IOException
              {
                  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                  int A[] = new int[10];
                  
                  System.out.println("Inputting the numbers");
                  
                  for(int i=0; i<10; i++)
                  {
                      System.out.print("Enter a number : ");
                      A[i]=Integer.parseInt(br.readLine());
                  }
                  
                  System.out.println("The 2 digit numbers are : ");
                  
                  for(int i=0; i<10; i++)
                  {
                      if(A[i]>9 && A[i]<100)
                          System.out.println(A[i]);
                  }
                      
              }
      }

Leave a Reply to srestha Cancel reply

Your email address will not be published. Required fields are marked *