[go: up one dir, main page]

0% found this document useful (0 votes)
45 views4 pages

Computer Practice Paper

Uploaded by

0613.apobangpo.7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

Computer Practice Paper

Uploaded by

0613.apobangpo.7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

THE BISHOP’S SCHOOL, CAMP

FIRST PRELIMINARY EXAMINATION


SUBJECT: COMPUTER APPLICATIONS
CLASS: X MARKS: 100
DATE:24.11.2022 TIME: 2HRS
===========================================================
Answer to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing the answers.
This paper is divided 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
Question 1 [20]
Choose the correct answers to the questions from the given options.
(Do not copy the questions , write the correct answer only.)
1. Which of the following is a super class of all other java classes?
a. Object b. Math c. System d. Import

2. Which of the following is the output of below code snippet?


double x= - 3.142;
int y =(int)Math.abs(x)+(int)x;
System.out.print(y);
a. 0 b. 6.284 c. 6.0 d. -6

3. When an object of a class is converted to a simple data type is called_________.


a. Unboxing b. boxing c. explicit type conversion d. Implicit type conversion

4. Which of the following methods of Java return nearest and largest whole number which is
greater than or equal to the argument?
a. ceil b. floor c. trim d. max

5. Which of the below specifiers provide minimum security for the class members?
a. private b. protected c. public d. default/friendly access

6. _______variables are the variables declared inside a method and have a scope limited to the
method. They cannot be accessed outside the method.
a. Static b. local c. global d. protected

7. System.out.print(“Be happy, not because everything is good but because you can see the
good in everything”.substring(40).length());
a. 47 b. 46 c. 45 d. 40

8. What is the output for:


System.out.print(“Malayalam”.replace(„a‟,‟z‟).substring(3,6));
a. Mzlzyzlzm b. Mzlayalam c. zyz d. zyzl

9. Which of the following method can be used to convert String objects to integer objects?
a. toString() b. valueOf() c. Both (a) and (b) d. None of the above

1
10. Decide how many searches using linear search it will require to successfully search for 2
from the below array?
15 12 2 3 4 5
a. 2 b. 3 c. 4 d. 5

11. What is printed by the below statements?


int num[]={11,22,33,44,55};
System.out.println(num[2]+”\t”+num[1]+”\t”+num[3]+”\t”+num[4-2]);
a. 33 55 11 22 b. 33 11 44 33 c. 55 11 22 44 d. None of these

12. Absence of break in switch statement causes:


a. Runtime error b. Syntax error c. no error d. Logical error

13. Given the code:


int num;
for(num=1; <=5;num++);
System.out.print(mum);
What will get printed?
a. 1 b. 4 c. 5 d. 6

14. What will be the output for: System.out.print(Character.toLowerCase(„A‟)+1);


a. 66 b. 6 c. error d. 98

15. A class is also known as __________


a. Primitive data type b. Constructor c. Composite data type d. Simple data type

16. System and Math classes are contained in _________packages.


a. lang b. io c. util d. api

17. Which of the following statements are valid for a string declaration?
a. String d= null; b. String d= „null‟; c. String d=0; d. String d= (String) “Hello”;

18. Which of the following types of functions does not return a value?
a. Pure method b. Impure method c. Specific method d. None of these

19. ______fields may be accessed by all subclasses of the current class, but are not visible to
classes outside of the current package.
a. Public b. protected c. private d. default

20. Based on the below code snippet, conclude on the statement below it.
public class StopLight
{ int RedGreenYellow;
changeLight()
{ RedGreenYellow++
} }
The methods in a class definition are named, self-contained blocks of code that typically
operate on the fields that appear in the:
a. Object definition b. Interface definition c. Class definition d. Function definition
Question 2 [20]
a. Name the operators : a. < b. ++ c. && d. ?:
2. Write the following in Java expression: + +√
3. What does the token „keyword‟ refer to, in the context of Java? Give an example.
4. Write the difference between length and length() functions.
5. Write two characteristics of a constructor.

2
6. What is an array? Write a statement to declare an integer array of 10 elements.
7. How can a class type variable support the accessing of members of a class?
8. Write a statement each to perform the following task on a string:
a. Extract the second last character of a word stored in the variable wd.
b. Check if the second character of a string str is in upper case.
9. Define: Instance variables.
10. Give the output of the following program segment:
String say=”Pharaoh-meant-King”;
tring ok= say.substring(0,5).toLowerCase();
String wow=say.substring(5).toLowerCase();
System.out.println(“ok = “+ok);
System.out.println(“wow = “+wow);

Section B (60 Marks)


Attempt any four questions from this section.
The answer in this section should consist of the Program either in BlueJ environment or any
program environment with Java as the base.
Each program should be written using variable description/Mnemonic codes so that the logic of the
program is clearly depicted.
Question 3 [15]
Design an overload method named pattern () to print the following patterns:
** Printing the pattern... ** ** Printing the pattern... **
1 A
26 BA
3 7 11 CBA
4 8 12 16 DCBA
EDCBA
FEDCBA

Question 4 [15]
Write a program to accept the year of graduation from school as an integer value from the user.
Using the binary search technique on the sorted array of integers given below, output the
message "Record exists" if the value input is located in the array. If not, output the message
"Record does not exist".
Sample Input:

n[0] n[1] n[2] n[3] n[4] n[5] n[6] n[7] n[8] n[9]

1982 1987 1993 1996 1999 2003 2006 2007 2009 2010

Question 5 [15]
Define a class to accept and store 10 strings into the array and print the strings with even
number of characters.
Sample Input:
Enter Strings:
Apple
Cat
Book
Cake
Candle
Strings with even number of characters:
Book
Candle

3
Question 6 [15]
Define a class called BookFair with the following description:

Data Members Purpose

String Bname stores the name of the book

double price stores the price of the book

Member
Purpose
Methods

BookFair( ) Constructor to initialize data members

void input( ) To input and store the name and price of the book

To calculate the price after discount. Discount is calculated as per the table
void calculate( )
given below

void display( ) To display the name and price of the book after discount

Price Discount

Less than or equal to ₹1000 2% of price

More than ₹1000 and less than or equal to ₹3000 10% of price

More than ₹3000 15% of price

Write a main method to create an object of the class and call the above member methods.
Question 7 [15]
Write a program in Java to accept a word. Pass it to a function magic(String str). The function
checks the string for the presence of consecutive letters. If two letters are consecutive at any
position then the function prints "It is a magic string", otherwise it prints "It is not a magic
string".
Sample Input: computer
Sample Output: It is not a magic string
Sample Input: DELHI
Sample Output: It is a magic string
Question 8 [15]
A number is said to be Duck if the digit zero is (0) present in it. Write a program to accept a
number and check whether the number is Duck or not. The program displays the message
accordingly. (The number must not begin with zero)
Sample Input: 5063 Sample Input: 7453
Sample Output: It is a Duck number. Sample Output: It is not a Duck number.

**************************
4

You might also like