Final Specimen Question Paper

 SPECIMEN QUESTION PAPER

 COMPUTER APPLICATIONS

 Maximum Marks: 50

 Time allowed: One hour (inclusive of reading time)

 ALL QUESTIONS ARE COMPULSORY.

 The marks intended for questions are given in brackets [ ]. 

Select the correct option for each of the following questions.

 SECTION A (30 Marks)

Question 1 

Choose the correct answer                                                                   [5×1]

1. Which of the following is called a typecast operator?

(a) []

(b) {}

(c) ()

(d) none of the above

2. Operator which returns quotient as the output after dividing two numbers.

(a) /

(b) %

(c) \

(d) *

3. class is referred as "Object Factory", because it is the producer of

(a) sub-classes

(b) objects

(c) Functions

(d) Data

4. Scanner class belongs to the package.

(a) UTIL

(b) Util

(c) lang

(d) util

5.In Java Programming Language, Source Code is converted to 

(a) Object Code

(b) Platform Independent Code

(c) Byte Code

(d) None of the above

Question 2

Fill in the blanks with the correct option                                             [5×1]

1._______________is called a single precision floating point data type.

(a) double

(b) float

(c) long

(d) Int

2.The ASCII code for 'A' to 'Z' is______________________

(a) 64 to 90

(b) 65 to 89

(c) 65 to 91

(d) 65 to 90

3.   _____________statement is used for the unusual termination of the program

(a) break

(b) continue

(c) return

(d) System.exit(0);

4. Math.rint() always returns ___________ datatype

      (a) int

      (b) float

      (c) double

     (d) depends on the argument type

5.  An if or else if statement accepts ______ as input before branching.

      (a) int

      (b) char

      (c) float

      (d) boolean

Question 3

Name the following                                                                             [5×1]

1.The keyword used to call a package is.

(a) new

(b) Import

(c) import

(d) java

2.The keyword that is used to create symbolic constants in Java.

(a) final

(b) const

(c) Final

(d) FINAL

3.The operator which acts on three operand is known as

(a) ternary

(b) unary

(c) binary

(d) Relational

4. The characters which cannot be typed directly through keyboard are called as

(a) Unicode Characters

(b) Escape Sequence Characters

(c) ASCII Characters.

(d) Special Characters

5. The Scanner class method(function) that reads characters including whitespaces is

(a) nextString()

(b) readLine()

(c) nextLine()

(d) NextLine()

Question 4

State True Or False                                                                              [5×1]

1. A Java program uses a Compiler as well as an Interpreter

(a) True

(b) False

2. The statement p+=5 means p=p * 5;

     (a) True

             (b) False

3. Objects encapsulate State (attributes) and have behaviour 

(a) True

(b) False

4. Class is a user defined data type.

(a) True

(b) False

5. When you need to execute more than one statement(s) based on a conditionthen all the  

    statements must be enclosed within parentheses ( ) inside if block.

      (a) True

(b) False

Question 5

Choose the odd one                                                                             [5×1]

1.       (a) true

(b) void

(c) false

(d) null

2.         (a)  class

(b) static

(c)  void

(d) function

3.        (a) if

(b) do while

(c) while

(d) for

4.        (a) double

(b) String

(c) int

(d) char

5.        (a) ++

(b) *

(c) /

(d) %

Question 6 

Give the output of the following                                                         [5×1]

1. double x = 2.9, y=2.5;

    System.out.println(Math.min(Math.floor(x),y));

(a) 2.5

(b) 2.9

(c) 2.0

(d) 3.0

2. The result of Math.ceil( Math.abs(-9.2)) is

(a) 9.2

(b) 10.0

(c) -9.2

(d) 10

3. char ch='a';

    switch(ch){


case 'M':


System.out.print("Microsoft");


break;


case 'G':


System.out.print("Google");


default:


System.out.print("ANY IT COMPANY");


break; case 'I':


System.out.print("IBM");


break;

     }

(a) Microsoft

(b) ANY IT COMPANY

(c) IBM

(d) Google

4. The result of 2%12 is

(a) 0

(b) 2

(c) 6

(d) 1

5. Give the output of the following [x = -3]

     X + = x+++--X+X+++X;

(a) x=-13

(b) x=14

(c) x=-15

(d) x=0

SECTION B (20 Marks) 

Question 7

In a certain school pass certificate is given to the students who have scored 40 percent

and above. The following program is based on the specification given below.

Fill in the blanks with appropriate Java statements.                                                 [6]

Class name:         Result

Member variables:

String name:         To enter name of a student

double per:         To enter percentage obtained by the student

String pc:         To store the message

Member method

void input():         To accept the detail

void passCertificate(): To check the percentage and award the pass certificate

void display(): To display the detail

void main():         To create an object of the class and invoke the member


import java.___(a)____.*;

class Result

{

    String name;

    double per;

    String pc;

    

    public void input(){

        Scanner obj = new Scanner(System.in);

        System.out.println("Enter Name: ");

        name = obj.nextLine();

        System.out.println("Enter Percentage : ");

        per = ______(b)_____

    

    }

    public void passCertificate(){

        if(______(c)______)

        pc =______(d)______;

        else

        pc = "FAIL CERTIFICATE NOT ISSUED";

    }

    public void display(){

        System.out.print("\n Student Name : "+name);

        System.out.print("\n Percentage   : "+per);

        System.out.print("\n Result       : "+pc);

    }

    public static void main(String args[]){

    Result ob = new ______(e)______;

    ob.input();

    ob.passCertificate();

    ob.______(f)______;

    

    }

}

(a)

1. utility

2. Util

3. util

4. UTILITY

(b)

1. obj.nextDouble();

2. nextDouble();

3.obj.nextFloat();

4. nextFloat()

(c)

1. per >= 40

2. per <= 40

3. per >= 40

4. per == 40

(d)

1. "PASS CERTIFICATE ISSUED";

2. "FAIL CERTIFICATE ISSUED";

3. "PASS CERTIFICATE NOT ISSUED";

4. "FAIL CERTIFICATE NOT ISSUED";

(e)

1. Result()

2. Result();

3. result();

4 .RESULT()

(f)

1. display()

2. Display()

3. display();

4. DISPLAY()

Question 8

Given below is a class with the following specifications:

Class name:                       Overload

Member Methods:

static float print () -         To find the sum of the series sum=0.0+0.25+0.50+0.75+…7.5

static int print (int n) -     To find the sum of the digits of a number n= 869

                                            sum= 8+6+9 = 23

Value for n is given from the main method and results are displayed in the main

method. Fill in the blanks of the given program with appropriate java statements    [6]

class Overload { 

static float print()

{

float sum=0.0f;

for(____(a)____ ; _____(b)_____;  i=i+0.25f)

sum=sum+i;

return_______(c)______;

}

static ____(d)_____print(int n)

{

 int d,s=0;

while(_(e)______)

{

d=n%10

s=s+d;

n = _____(f)_______;

}

return s;

}

void main()

{

System.out.println(print());

 System.out.print(print(869));

}

}

(a)

1. float i=0.0f

2. float i=0.0

3. float i=0

4. Float i=0.0

(b)

1. k<=7.5f

2. i>=7.5f

3. 1==7.5f

4. i<=7.5

(c)

1. Sum

2. sum

3. SUM

4. sum+i

(d)

1. float

2. double

3. int

4. char

(e)

1. n! =0

2. n==0

3. n<=0

4. n>=0

(f) 

1. n%100;

2. n/10;

3. n%10;

4. n/100;

Question 9

The following program segment displays all the Mersenne numbers between 1….n

using the method name void MersenneNos(int n) where n has to be in the range

1…20.Mersenne numbers are the ones which are one less than a power of 2

i.e 1(21-1), 3(22-1),7(23-1),15,31,63 etc.

Fill in the blanks with appropriate java statements                                          [4]

public (a)__________MersenneNos(int n)

{
      long num=0;
      
      int i;

       if(n>=1(b)______n<=20)
      
        {
        
                System.out.println(“The mersenne numbers are: “);

                for(inti=1;(c)_____;i++)
               {
                    
                    num = ((d)_____)(Math.pow(2,i)-1);

                    System.out.print(num+”,”);
    
                }

        }

        else
                System.out.println(“Value of n should be in the range 1….20”);
        }
(a)    
       1. int

        2. float

        3. double

        4. void
(b)
        1. ||

        2.&&
    
        3. >=

        4. ==                                                                                                  
(c)
        1. i<n
    
        2. i<=n

   3. i>=n    
    
        4. i == n                                                                                          
(d)
        1. int

        2. float

        3. double
        
        4. long

Question 10
Read the paragraph given below and answer the questions given below:
Case study 1

In java programs the flow of control happens in 3 ways. They are (i) Sequential flow (ii) Conditional flow and (iii) iteration. Iteration is executing a group of statements again and again based on a condition. The four main parts of an iterative construct is (i) initialisation (ii) test condition (iii)body of the loop and (iv)updation. Loops are divided based on whether the number of iterations are known in advance into (i)fixed iterations and (ii)unfixed iterations. Based on when the test condition is checked loops are further classified into (i) entry controlled loops and (ii) exit controlled loops.   [4]                     (a) In a ___________construct the test condition is checked after the body of the loop

      is executed

1. for

2. while

3. do…while

4.if                                                                                                                      

(b)_________construct is more preferred when the number of iterations are known

     in advance

1. for

2. while

3. do…while

4.if                                                                                                                      

(c)In any looping construct ___________happens only once

1. initialisation

2. checking test condition

3.execution of body of the loop

4. updation of the control variable                                                            

(d)___________ statement can be used for unusual termination of a loop

1. return

2.break

3.continue

4.jump