Computer Applications Sample  Paper - ICSEHUB

Q. 1. Multiple choice: (5)

(a) A program of java that can be executed from any remote machine is called:

i) Application                             

ii) Applet

iii) Object

iv) None

(b) Find which one is not a character literal.

i) ‘1’

ii) ‘10’

iii) '\0’

iv) ‘\n’

(c) Which of the following return type does a constructor have:

i) Void 

ii) Boolean

iii) Int

iv) None

(d) The arguments of the function given in the function definition are called:

i) Formal parameter

ii) Actual parameter

iii) Reference parameter

iv) None

(e) The address of a memory location which can store a value and which may change during the program execution is known as:

i) Identifier

ii) Keyword

iii) Separator

v) Literal

Q. 2. Fill in the blanks: (5)

The compiler ignores the characters in the _____.

_____ is used to force a conversion from one data type to another.

The logical _____ is equivalent to OR function.

A _____ is a blue print of the attributes and the methods common to all its objects.

When an expression within the parenthesis   in a set of statements returns zero value, the condition is considered to be _____.

Q. 3. State True/False: (5)

Switch statement can use characters and numbers in its case.

The continue statement force an early iteration of a loop.

do …. While is an entry controlled loop.

For every primitive type in java , there is a built in object type called Wrapper class.

Software objects interact and communicate with each other using machine language.

Q. 4. Write the output: (5)

(a)                                                                                 b)

public class test                                                             public class result
{                                                                                  {
public void main( )                                                         public static void main( )
{                                                                                  {
int a=5,b;                                                                       char a= 'a' ;
b=2*a - - + - - a;                                                           System.out.println(+a);
System.out.print(+a+" "+b);                                            a++;
System.out.println(a);
}                                                                                  }
}                                                                                  }

Q. 5.Explain the following with example. (2 x 5)

  1. Type casting

  2. Switch statement

  3. Literal

  4. Looping

  5. Possible loss of precision

Q. 6. Answer the following.(2 x 2)

  1. What is the need of JVM ?

  2. What do you mean by Polymorphism ?

Q. 7. Differentiate between. (2 x 3)

  1. keyword  and  reserved word.

  2. conventions  and  rules ?

  3. java application  and  java applet ?

Section – B
(Answer any four)

(The answers of this section should consist of the Program in Blue J environment with Java. Each program should be written using Variable description / Mnemonic Codes such that the logic of the program is clearly depicted.)

Q. 8. Write a java class to calculate the income tax by taking monthly salary of an employee based on the following conditions: (15)

Annual income(Rs)                                Tax

Upto 130000                                         No tax

Between 130000 – 200000                     15% of the amount exceeding over Rs.130000

From 200000 – 250000                          Rs. 5000 + 20% of the amount exceeding over Rs. 2000000

Above  250000                                      30% of the amount exceeding Rs.250000

Q. 9. Write a java class to calculate  and print the electricity  bill to be paid by a customer. (15)

Assume that the customer pays a rent of  Rs. 250.00 .

No. of units                                           Charge per unit

Upto 100 units                                       Rs. 1.50

For the next  100 units                           Rs. 2.00

For next 50 units                                    Rs. 2.50

Beyond  250 units                                  Rs. 4.00

Q. 10. A ball is dropped from a certain height ( h ) and each time it  bounces 0.8 %  less than  the previous height.  The ball is at rest  when  the height  is 0.2 cm.  Write a java  class  using a call  by  value method drop ( ) to print the number of  bounces occurred. (15)

Q. 11. Write a class with a special member function to input a multi digit number ( max. 9 digit) and print the following: (15)

total number of  even and odd digits

the reverse number

total number of  zero’s present.

Q. 12. Write a class  to print the value of   ‘ n ’  by accepting  ‘ p ’  as a single digit integer. (15)

n =      p     +     p2     +     p3    +     p4    + ……   pn
               -----------------            -----------------           -----------------        -----------------                        -----------------------------
       (1+2)      (2+3)       (3+4)      (4+5)           ((n-1) + n)

Q. 13. Write a class to generate the following series using  a special member function. (15)

1
2          3
4          5          6
7          8          9          10

 

 

 

This Paper is divide into two Sections. Attempt all questions from Section – A and any four questions from Section – B. The intended marks for questions or parts of questions are given in brackets[ ].

Section – A ( 40 Marks )

(Attempt all Questions)

Q. 1. Multiple choice: [6]

(i) The smallest element  of a program that is meaningful to the compiler:

  1. keyword

  2. class

  3. token

  4. object

(ii) When an expression contains more than one operator then their execution is based on their:

  1. precedence

  2. type

  3. method

  4. none

(iii) The string class provides function to convert other objects to string objects:

  1. toString ( )

  2. java.io

  3. comments

  4. all

(iv) The variable which is declared inside a class is :

  1. local variable

  2. instance variable

  3. both

  4. none

(v) Find the odd one out :

  1. int prime ( )

  2. double radius ( )

  3. String reverse ( )

  4. void display ( )

(vi) Comments can be written

  1. In the beginning of the prog.

  2. at the end of the prog.

  3. anywhere

  4. none

Q. 2. Fill in the blanks: [6]

A program having _____ error does not compile.

An _____ is a combination of constants, operators, variables which are used to calculate some value.

If n = 5 and m = 9, then System.out.println( n > m ); will return _____ .

Condition in _____ loop is tested after execution.

_____ function removes white spaces from both the ends of a string.

_____ function returns the all the characters from a given location to the end of the string.

Q. 3 Write the output [2 * 4 = 8 ]

(i)          public class test_1                                             ii) public class test_2
            {                                                                           {
    public void  res_1(  )                                               public void  res_2(  )                     
     {                                                                           {
                      int m,p=2;                                                            int k=1,j=0
                      for( m=0;m<=p;)                                                  while ( k <=10)
                      {                                                                                      {
System.out.println( m );                                          for(j=k; k<5;j++)
                       }                                                                                         {
                   }                                                                                       System.out.print(j+“  ”);
              }                                                                                       }
                                                                                                              System.out.println( );  k++ ;
                                      k ++;
                             }}
(1)
i) public class test_3                                                      ii) public class test_4
    {                                                                                    {
         int a=5,b=0;                                                                     int x,y=2
         public void  res_3(  )                                                        public void  res_4(  )                   
          {                                                                                                  {
             while(b<5)                                                                         for(x = y; x<=50;)    
              {                                                                                          {
                   b++; a- - ;                                                                           System.out.print(x+ “  ”);
                   System.out.println(a+”  “ +b);                                                x*=5;
              }                                                                                          }
                   System.out.println(a+”  “ +b);                                                System.out.print(x);
          }                                                                                                   }
     }                                                                                      }

Q. 4. Answer the following:

  1. What is the use of Logical operator and (&&) and   or ( || ) ? [2]

  2. What do you mean by Debugging ? [2]

  3. Explain Dynamic initialization [2]

  4. Explain abstraction? [2]

  5. Explain the function of return type in a function.[2]

Q. 5. Differentiate etween:

  1. compareTo( ) and equalsIgnoreCase ( )[2]

  2. Math.ceil ( )  and  Math.floor ( ) [2]

  3. constructor( )  and  method ( ) [2]

  4. class and object [2]

  5. compiler  and  interpreter [2]

Section – B

(Attempt any four questions from this section. The answers in this section should consist of the program in Blue J environment with java. Each program should be written using Variable description / Mnemonic codes such that the logic of the program is clearly depicted. Flow-charts and Algorithms are not required.)

Q. 6. Digital World announces seasonal discount on the laptops in the given order. [15]     

Cost of the laptop                      Discount
Rs.20,000 -  Rs.30,000   10%
Rs.30,000 – Rs.40,000   15%
Rs.40,000 – Rs.50,000   18%
> = Rs.50,000                            20%

An additional discount of   5% on all types of laptops is given. Sales tax is calculated at 12% on the price after the discounts. Define a class to accept the cost of the laptop and print the amount payable by the customer on purchase ( use constructor).(2)

Q. 7. Write a class to accept a number and check whether it is a Prime-palindrome number or Armstrong number based on user’s choice.

Prime-palindrome number - a number is a prime no. and palindrome no. Eg. 101

Armstrong number - Sum of the cubes of the digits = number Eg. 153[15]

Q. 8. Write a class to enter a proverbial statement and display the frequency of each alphabet presentin it. [15]

Q. 9. Write a class to accept a multi digit no.(max. 8 digits) and do the following: [15]

  1. print the reverse number.

  2. print the absolute difference between them.

  3. print smallest digit.         

Q. 10. Write a class to input a string (combination of letters and digits) and replace the repeated characters with dollar ($) sign. Then display both old and newly created string. [15]

 

 

 

 

 

 

 

Paper - 1

Paper - 2