0% found this document useful (0 votes)
6 views3 pages

Computer Applications Sample Paper IX

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)
6 views3 pages

Computer Applications Sample Paper IX

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

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 [Link](“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 * [Link]() + 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 [Link]() 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.

Common questions

Powered by AI

In programming, the difference between 'a' and "a" lies in their usage and data types. 'a' represents a character literal, which is a single character and typically has the data type char, whereas "a" represents a string literal, which is a sequence of characters with the data type String or similar, depending on the programming language .

The class diagram for the Shirt class includes attributes like price and material, influencing how the 'calcAmt' method operates by dynamically calculating shirt prices based on color and material. The method assigns fixed prices per color and adjusts them when materials like Linen are used, which cost more. This structure allows flexible pricing strategies within the system, adapting to inventory and customer preferences .

Programmers might use a body-less loop when they want to execute simple, repetitive tasks within the loop's control structure without additional actions. This practice reduces code verbosity, improves readability, and streamlines functions. For instance, using loops like 'for(int i = 0; i < n; arr[i++] = 0);', body-less loops can efficiently initialize arrays or counters with less overhead .

The 'check' method in the Game class is crucial because it provides feedback based on the sum of dice rolls, enhancing user interaction by delivering immediate results. It differentiates outcomes such as "Bingo!!!" for a sum of 12, "Gotcha!" for sums between 9 to 11, and "Alas!" for sums below 9, thereby adding meaningful output to the game and improving user engagement .

Conditional statements can identify LOL numbers—where the sum of the last two digits of a three-digit number equals 10—by iterating through data using loops. For instance, if examining the number 164, one could use conditions to check if (6 + 4) == 10. These logical checks ensure only LOL numbers are counted, and loops efficiently process large datasets, such as accepting 50 values from the user .

Object-oriented programming (OOP) principles support the creation of multiple objects from a single class by leveraging encapsulation, inheritance, and polymorphism. Encapsulation ensures each object maintains its state, while inheritance allows shared characteristics and polymorphism promotes method variations. These concepts justify how a class can model real-world entities effectively, and multiple objects like 'BoardGame1' and 'BoardGame2' from one class offer diverse functionality without code repetition .

Keywords in programming languages are reserved words that have specific syntactical meanings, like 'main,' signifying the program’s entry point in Java. Unlike identifiers, which are developer-defined names for variables or functions, keywords follow strict usage rules and cannot be altered. Identifiers like variable names offer flexibility for developers to customize program components without conflicting with the language's syntax .

'Fall Through' refers to a behavior in switch-case statements within some programming languages, like C, where control moves to the next case block unless a break statement is encountered. It can lead to unintended execution of multiple blocks if breaks are missing. For example, in the following code snippet: switch(day) { case 1: printf("Monday"); case 2: printf("Tuesday"); } Both "Monday" and "Tuesday" would be printed if 'day' is 1, demonstrating the 'Fall Through' effect .

Object creation in classes enhances reusability and modularity by allowing multiple instances of objects that encapsulate data and behavior. This enables programmers to use and modify objects independently without affecting others, facilitates code maintenance, and encourages code reuse through object instantiation from existing classes, as suggested by creating objects like 'Romeo' from 'Pet', in Source 1.

Using the String data type affects memory allocation differently because Strings are typically reference data types, meaning memory is allocated dynamically on the heap, allowing for larger, variable-size data storage. In contrast, primitive data types like int or char have fixed-size memory allocation, leading to predictable, constant memory use. Thus, Strings offer flexibility but can increase the complexity of memory management .

You might also like