Sample Ut2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Amarjyoti Saraswati International School

Sample paper
Sub: - Computer Applications

STD: IX Date:
Marks: - 50 Time: 1 ½ Hrs.

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, Section A and Section B.


You have to answer all the questions from Section A and TWO questions from Section B.
The intended marks for questions or the part of the questions are given in the brackets [].

SECTION – A
(Attempt all the questions.)

Q-1 Do as directed.
[A] Define the terms : Class and Objects. [2]
[B] Consider the given class declaration and answer the questions that follows:
Class Pet
{
String breed;
Float price;
}
(i) Make an object ‘Romeo’ from the ‘Pet’.
(ii) Assign the data values “Beagle” , 3450 to Romeo. [2]
[C] Demonstrate the concept of ‘Fall Through’ with a simple example. [2]
[D] Differentiate between the statements (i) “a” and(ii) ‘a’ [1]
[E] Write a statement to make an object name ‘Kavya’ from the class ‘Topper’ [1]
[F] “main is a keyword in java’ – true/false [1]
[G] Give an example of a body less loop. [1]

Q-2 MCQ [10X1]


(1) Which among the following is not a primitive data type?
a. int b. float c. String d. char
(2) Assigning value to a variable during declaration is called.
a. Declaration b. Assignment c. Initialization d. None of these
(3) Which among the following is not a syntax error?
a. Missing semicolon
b. Mismatched braces in classes and methods.
c. Misspelled keywords and identifiers.
d. Addition is required but subtraction is performed
(4) How are the characteristics of an object represented in a class?
a. Data Members b. Member Functions c. Access specifiers d. None of these
(5) How many objects can you create from a class?
a. One b. Two c. Three d. Any number
(6) Java uses ........... character set.
a. ASCII Only b. Extended ASCII Only c. Unicode d. None of these
(7) Which one of the following is not a binary operator?
a AND b. % c. == d. !
(8) The statement System.out.println(“six” + (3 + 3)); gives the output ...........
a. six 33 b. six 6 c. 33 six d. 6 six
(9) Given the following statements:
int min = 1, max = 10;
int range = max - min + 1;
int num = (int) (range * Math.random() + min);
The value of num will be in integer such that ...........
a. 1 to 10 b. 0 to 9 c. 0 to 10 d. None of these
(10) What is the return type of Math.random() method ?
a. double b. int c. float d. None of these

SECTION – B
(Attempt any TWO questions. Each one carry 15 marks.)

Q-3 Write a program to implement the following class diagram :


Class : Game
D.M. d1 ,d2 (int)
Methods
Void generate() – Generate two dice and store them into d1 and d2.
Void check() – Based on the dice result, print the following :
Sum of Dice Result
12 Bingo!!!
9 to 11 Gotcha!
<9 Alas!
Create two objects BoardGame1 and BoardGame2 from the class and print their result.
Q-4 Write a program that accept any 50 values from the user and count total number of LOL
numbers in it :
A 3 digit number is said to be LOL number of the sum of last two digits is 10.
e.g. 164 , 391 , 382 etc

(i) Count total number of LOL numbers .


(ii) Calculate the average of LOL numbers entered.

Q-5 Write a program to implement the following class diagram :


Class : Shirt
Data members
Brand , price , material ,qty , amt , color

Methods
void accept() – accept material ,color ,brand of a shirt
void calcAmt() – calculate the price as per the following :
Color Price
Yellow 600
Green 700
White 500
Material Price
Cotton Same price
Linen 200 more than the ordinary price.
Calculate the amount as price x qty

Void printAll() – Print all the data members on screen.

Success doesn’t come from what you do OCCASIONALLY.


It comes from what you do CONSISTENTLY.

You might also like