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

Class 9 Computer Mock Test

This document is a mock test for Computer Application with a total of 100 marks, divided into two sections. Section A consists of multiple-choice questions and short answer questions, while Section B requires programming tasks. The test covers various topics including Java programming concepts, data types, loops, and mathematical operations.

Uploaded by

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

Class 9 Computer Mock Test

This document is a mock test for Computer Application with a total of 100 marks, divided into two sections. Section A consists of multiple-choice questions and short answer questions, while Section B requires programming tasks. The test covers various topics including Java programming concepts, data types, loops, and mathematical operations.

Uploaded by

Soumendu Halder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MOCK TEST

Subject – Computer Application


Full Marks: 100 Time: 2 Hours

SECTION A (40 Marks)


Answer all questions from this section.

A. Choose the correct option:


1. Among the following which method does not have a body?
(a) A class (b) An interface (c) An abstract method (d) None of the above

2. Among the following, which is not an OOP's concept?


(a) Encapsulation (b) Exception (c) Abstraction (d) Polymorphism

3. Which statement satisfies the empty loop in Java?


(a) It has an empty conditional clause (b) It has an empty increment clause (c) It has an
empty initialization clause (d) All of the above

4. Among the following classes, which is the superclass of all other classes?
(a) Math (b) Process (c) System (d) Object

5. Exit controlled loop is:


(a) for (b) while (c) do-while (d) if-else

6. Evaluate the expression if x=3, y=5, z=10:


++z + y - y + z + x++
(a) 23 (b) 25 (c) 20 (d) 24

7. If a user wants to execute a loop 10 times, which statement can be used?


(a) for(i=6;i<=26;i=i+2)
(b) for(i=3;i<=30;i=i+3)
(c) for(i=0;i<10;i=i++)
(d) All of the above

8. Which is the smallest integer data type?


(a) byte (b) short (c) long (d) int

9. Evaluate: 6 - 2 + 10 % 4 + 7
(a) 13 (b) 12 (c) 19 (d) 11

10. [Link](46.6) output is:


(a) 46.0 (b) -46.0 (c) 47.0 (d) 47.5
11. Consider the following Java program and find the output:

class abc {
public static void main(String[] args) {
int g = 5;
[Link](++g * 8);
}
}

(a) 41 (b) 50 (c) 48 (d) 42

The following questions have Assertion (A) and Reason (R). Choose the correct
option.

12. Which is odd in the given options?


(a) Constructor and Destructor
(b) Inheritance and Polymorphism
(c) Structure and Union
(d) Class and Object

13. Assertion (A): == is used to compare two strings in Java.


Reason (R): The == operator checks if two references point to the same memory location.

14. Assertion (A): Nested loops allow more complex iteration patterns.
Reason (R): Java allows loops to be nested within each other.

15. Assertion (A): The Scanner class in Java is used for reading input.
Reason (R): The Scanner class is found in the [Link] package.

16. Assertion (A): [Link]() returns the square root of a number.


Reason (R): [Link]() accepts only integer values as arguments.

Codes:
(a) Both A and R are true and R explains A
(b) Both A and R are true but R does not explain A
(c) A is true and R is false
(d) A is false and R is true

B. Answer the following questions: (2 Marks Each)


1. Identify whether they are primitive or non-primitive types:
(i) String (ii) Arrays (iii) char (iv) Classes

2. [Link]("BEST ");
[Link]("OF LUCK");
Choose the correct output:
(i) BEST OF LUCK
(ii) BEST
OF LUCK

3. Convert the following if-else-if construct into switch case:


if(var == 1)
[Link]("good");
else if(var == 2)
[Link]("better");
else if(var == 3)
[Link]("best");
else
[Link]("invalid");

4. Write a Java expression for: √3x + x⁴ / (a + b)

5. What do you mean by type conversion? How is implicit conversion different from explicit
conversion?

6. Why is Java called a platform independent language?

7. If a = 5 and b = 9, calculate: a += a - b + a

SECTION B (60 Marks)


Attempt any four programs.

1. A library charges a fine for books returned late:


First five days – 40 paisa per day
Six to ten days – 65 paisa per day
Above 10 days – 80 paisa per day

Write a program to calculate the fine assuming a book is returned N days late.

2. Generate the pattern:


*
***
*****
*******
*****
***
*

3. Write a program to accept a number and check whether it is a Perfect Number.


A number is perfect if the sum of its factors (excluding the number itself) equals the
number.
Example:
6 → Factors: 1,2,3
Sum = 6

4. Find the sum of the series:


S = (X + 1)² + (X + 2)³ + (X + 3)⁴ + (X + 4)⁵ + ... + (X + N)(N + 1)

5. Using switch case write a program to find volume:

Cuboid: V = l × b × h
Cylinder: V = π × r² × h
Cone: V = 1/3 × π × r² × h
(π = 22/7)

6. A special two-digit number is such that the sum of its digits plus the product of its digits
equals the number.

Example:
59 → (5+9) + (5×9) = 59

Write a program to check whether a given two-digit number is a Special Number.

Common questions

Powered by AI

Implicit type conversion, also known as automatic type conversion, generally occurs without programmer intervention and involves safe operations such as converting a smaller type to a larger one (e.g., int to double). It is easier and safer but limited to compatible types and can cause unintended data loss if precision is required. Explicit type conversion, or casting, requires programmer intervention to convert one data type to another, allowing for more control but also presenting potential risks of data loss and errors if not handled properly .

A 'Special Number' in programming is typically defined by a property that combines its digits to reproduce the number itself. For instance, for a two-digit number, it is considered special if the sum of its digits plus the product of its digits equals the number. The number 59, for example, is special because (5 + 9) + (5 * 9) equals 59 .

Polymorphism in object-oriented programming allows objects to be treated as instances of their parent class rather than their actual class. This can be exemplified in method overriding, where a child class provides a specific implementation of a method that is already defined in its parent class. An example is a 'Shape' class where a method 'draw' is overridden by 'Circle' and 'Rectangle' subclasses to perform shape-specific drawing .

The 'Object' class is fundamental in Java as it serves as the root superclass from which all other classes inherently derive. This means every class implicitly extends Object. This design provides several essential methods that are common across all objects, such as 'toString()', 'equals()', and 'hashCode()', allowing a consistent interface for basic operations on objects regardless of their specific types .

The 'Math.floor' function in Java is used to return the largest integer less than or equal to a given double value. It effectively rounds down the value. For Math.floor(46.6), the function returns 46.0 as it provides the greatest integer less than or equal to 46.6 .

Java is considered platform-independent due to its use of the Java Virtual Machine (JVM) which allows Java bytecode to be executed on any device or operating system that has the JVM installed. This 'write once, run anywhere' capability is a result of the JVM interpreting the bytecode rather than depending on the OS-specific code, thereby ensuring Java programs can be executed consistently across various platforms .

An abstract method differs from other methods as it is declared without an implementation, meaning it does not have a body. Abstract methods are intended to be overridden in subclasses where the exact implementation is provided. This allows for polymorphic behavior in object-oriented programming .

An exit-controlled loop in Java executes the loop body and checks the condition after the execution. The 'do-while' loop is an example that demonstrates this characteristic as it guarantees that the body of the loop is executed at least once before the termination condition is evaluated .

The do-while loop guarantees at least one execution of the loop's body, which can be advantageous for certain algorithms that need an action executed at least once. However, this characteristic may lead to inefficiencies if the condition is not met eventually, as it ensures at least one execution. Comparatively, controlling entry conditions in 'while' or 'for' loops may offer more optimized execution paths since they check conditions before execution, potentially skipping unnecessary computations entirely .

The expression evaluates as follows: Pre-increment on z results in z becoming 11; z + y - y results in 11 as the y terms cancel out. Adding z again yields 11 + 11 = 22. Post-increment on x results in using 3 in computation (thus 22 + 3 = 25) while making x 4 subsequently. This illustrates use of pre and post-increment operators in Java, and operator precedence .

You might also like