Nothing Special   »   [go: up one dir, main page]

Comp Question Paper HFE

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

SOUTH END SCHOOL

Affiliated to CISCE, New Delhi (ICSE)


Affiliation No. WB420
Nalhati, Birbhum
IX
FIRST TERMINAL EXAMINATION YEAR 2023-24

Maximum Marks – 100 Subject – Computer Applications (Theory) Time - 2 Hours

______________________________________________________________________________________________
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 from this Section.)
Question 1 [20]
Choose the correct answers to the questions from the given options. (Do not copy the question, Write the
correct answer only.)
(i) Name the feature of Java depicted in the following picture.

SWARN
(a) Data abstraction (b) Polymorphism (c) Inheritance (d) Encapsulation
(ii) The extension of byte code is:
(a) .class (b) .obj (c) .java (d) .exe
(iii) Java made web interesting as it makes it:
(a) interpreted (b) interactive (c) platform independent (d) None of these
(iv) An object is represented by two attributes, out of which one is characteristics and the other one is:
(a) behaviour (b) situation (c) abstraction (d) problem solving
(v) The method used by objects to interact with each other is known as:
(a) Message interaction (b) Object communication (c) Message passing (d) None of these
(vi) The range of byte data type is:
(a) -128 to 128 (b) -128 to 127 (c) -127 to 127 (d) -127 to 128

Page 1 of 5
(vii) Predict the output:
boolean x = true;
System.out.println((int) x);
(a) 1 (b) 0 (c) true (d) Syntax error

(viii) A token can be:


(a) a variable (b) a literal (c) a keyword (d) All of these
(ix) An explicit type conversion is also referred to as:
(a) Type demotion (b) Narrowing conversion (c) Both of these (d) None of these
(x) The return data type of Math.abs() method is:
(a) long (b) int (c) double (d) depends upon its argument
(xi) Identify the valid symbols for using multiline comment in Java programs.
(a) /*….*/ (b) //……// (c) #......# (d) All of these
(xii) Predict the output:
boolean f = true;
if(!f)
System.out.println (f);
else
System.out.println (!f);
(a) true (b) false (c) Syntax error (d) None of these
(xiii) An example of unary operator is:
(a) * (b) ++ (c) != (d) +=
(xiv) Go through the following text, and choose the correct answer:

Sometimes a program may compile properly and seems perfect with the logic. But certain abnormal
situation may arise in the code sequence at run-time. This is called an exception or run-time error.

A run-time error may occur during:


(a) compilation (b) execution (c) debugging (d) None of these

(xv) Assertion (A): Relational operators are used for comparison between two data items that are used in
a test expression.
Reason (R): An expression with relational operator will always result in either true or false to represent
a success or failure.

(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of
Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of
Assertion (A)
(c) Assertion (A) is false and Reason (R) is true
(d) Assertion (A) is true and Reason (R) is false

(xvi) The evaluated value of the expression a > b || a > c (where a = 10 , b = 8 and c = 20) is:
(a) true (b) false Page 2 of 5
(xvii) Assertion (A): Logical operators can be used to join more than one relational expression
Reason (R): Logical operators are binary in nature

(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of
Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of
Assertion (A)
(c) Assertion (A) is false and Reason (R) is true
(d) Assertion (A) is true and Reason (R) is false

(xviii) The first operand that a ternary operator deals with is:
(a) test expression (b) Expression 1 (c) Expression 2 (d) any one of these
(xix) nextInt() is a method of a class included in:
(a) java.lang (b) java.io (c) java.util (d) None of these.

(xx) Predict the output of the following statement:


System.out.print(Math.pow(Math.sqrt(25), 2);
(a) 32 (b) 25 (c) 625 (d) -625

Question 2
Answer the following questions (working must be shown if required):

(i) Write the purpose of Math.round() method. [2]

(ii) Write a Java expression for the following mathematical expression: [2]

c = 𝑥√𝑦

(iii) Write the syntax of if-else with else if ladder considering three possible outcomes. [2]

(iv) Convert 209.001 into its equivalent scientific notation. [2]

(v) Evaluate the following expression when x = 10: [2]

x = x– – + x++ / – –x;

(vi) State two differences between a class and an object. [2]

(vii) Identify the type of the statement as follows: [2]

String school = “SOUTH END SCHOOL”;

(viii) What is fall through ? [2]

(ix) Write two differences between if-else and switch-case statements. [2]

(x) Rewrite the following code fragment using if-else statement: [2]

double tax = (income <= 10000) ? 0.0 : 12.0;


Page 3 of 5
SECTION B (60 Marks)
(Answer any four questions from this Section.)
The answers in this section should consist of the programs in either 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.
Flow-charts and algorithms are not required.

Question 3
Write a javaa program
(i) Write program to to input
inputtwo
a number
integers(Num) and print
as arguments to all factors main()
a method of Num, in find
and descending
their sumorder
without
and their sum, in following format-
using the addition operator (‘+’). Print the result with a proper message. [8]
Sample Input/Output:
(ii) Write a program to accept three integers as arguments to a method main() and evaluate the product
of their last digits. Print theInput
result: with a proper message. [7]
10
Output :
10 + 5 + 2 + 1 = 18
Question 4
(i) Write a program to input the radius of a semicircle using a Scanner class input method and evaluate
its perimeter as well as area. Display the outputs in separate lines with proper messages. [8]
(ii) Write a program to input three integers using a Scanner class input method and display the smallest
number with a proper message. [7]

Question 5
(i) Write a program to input a real number (floating-point number) using a Scanner class input method
and round it off to the nearest integer without using any Mathematical library method and conditional
statement. Display the result with an appropriate message. [8]
(ii) Write a program to input a digit character using a Scanner class input method and using switch-case
statement display the name of the digit. [7]

Question 6
(i) Write a program to accept two integers as arguments to a method main() and swap their values
without using a third variable. Display the result in suitable format. [8]
(ii) Write a program to input an integer (positive or negative) as argument to a method main() and check
whether it is a 4-digit number or not. [7]

Question 7
(i) Write a menu-driven program using switch case to perform the following operations as per a choice
selected by the user (use Scanner class input methods): [8]

Page 4 of 5
(a) Accept two numbers and print the sum of their absolute values.
(b) Accept two numbers and display the first number raised to the power of second number.
Also display an error message if the user opts for an invalid choice.
(ii) Write a program to accept the perimeter of a square and evaluate its area. Display the output with a
suitable message. [7]

Question 8
To foster a sense of water conservation, the water department has an annual conservation tax policy.
The taxes are based on the water consumption of the consumer. The tax rates are as follows: [15]

Water Consumed annually (in Gallons) Tax rate in ₹ / 100 Gallons

Upto 40 No Tax

More than 40 but 70 or less 525.00

More than 70 but 120 or less 775.00

More than 120 but 200 or less 1250.00

More than 200 but 350 or less 1825.00

More than 350 but 500 or less 2650.00

Above 500 3550.00

Write a program to input the consumer id and water consumed annually in gallons and display the
output in the following format:

Consumer ID: ******


Water consumed annually: *****
Tax payable: *****
---THANK YOU---

***END OF QUESTION PAPER***

Page 5 of 5

You might also like