0% found this document useful (0 votes)
43 views

10 Computer Applications HY 23-24

The document is the question paper for the half-yearly examination of class X for the subject of computer applications (theory). It contains two sections - Section A with 20 multiple choice questions and Section B with 4 long answer questions where students have to write programs. The questions test concepts related to Java programming language.

Uploaded by

anubhavsarkar507
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)
43 views

10 Computer Applications HY 23-24

The document is the question paper for the half-yearly examination of class X for the subject of computer applications (theory). It contains two sections - Section A with 20 multiple choice questions and Section B with 4 long answer questions where students have to write programs. The questions test concepts related to Java programming language.

Uploaded by

anubhavsarkar507
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/ 7

GARDEN HIGH SCHOOL

CLASS X

Half-Yearly Examination, 2023–24

Computer Applications (Theory)

Time: 2 hours Full Marks: 100

This Question Paper has seven printed pages.


Answers must be written in the script/s provided. You will not be allowed to write for the first
15 minutes. This time must be spent in reading the Question Paper.
The time given at the head of this Paper is the time allowed for writing answers.

This Paper is divided into two sections.


Answer all the questions of Section A, and any four of Section B.
Maximum marks for a question or parts of a question are given in brackets [ ].

SECTION A (40 marks)


Answer all the questions.

Question No 1
Choose the correct options: [20]

(a) The process of binding data and functions together as one unit is called
(i) encapsulation. (ii) abstraction. (iii) polymorphism. (iv) inheritance.

(b) Which of the following is a non-primitive data type?


(i) char (ii) class (iii) boolean (iv) short

(c) Assertion(A): In Java, statements or words written after // are not executed.
Reason(R): Anything written after // becomes a comment and comments are not
executed by Java.

(i) Both A and R are true and R is the correct explanation of A.


(ii) Both A and R are true and R is not the correct explanation of A.
(iii) A is true but R is false.
(iv) Both A and R are false.

(d) int f = 10, m = 9;


String e = (m%f==9) ? “YES” : “NO”;
System.out.print(e);
(i) YES (ii) NO (iii) YESNO (iv) NOYES
(2)

(e) Identify the correct statement about break.


(i) break stops the execution of the entire program
(ii) break stops the execution and forces the control out of the loop
(iii) break stops the execution of the current iteration and forces the next iteration to
start.
(iv) break stops the execution of a loop for a certain time frame

(f) The logical operator which is a unary operator is


(i) && (ii) || (iii) ! (iv) &

(g) The method to check if a character is a letter of the alphabet or not is

(i) isLetter(char) (ii) isAlpha(char) (iii) isUpper(char) (iv) isLower(char)

(h) Arrange the following data types in descending order of their size:

short, double, byte, float

(i) byte, double, float, short (iii) double, float, short, byte
(ii) short, double, byte, float (iv) byte, short, float, double

(i) What is the return data type of endsWith() ?


(i) int (ii) boolean (iii) double (iv) char

(j) Find the output:


System.out.println(“CLOak”. compareTo(“CLOCK”));

(i) 30 (ii) 32 (iii) –30 (iv) 35

(k) In Java a ______ is the basis of all computation.

(i) method (ii) constructor (iii) class (iv) object

(l) Assertion(A): An object is an instance of a class.

Reason(R): Instantiation means creation of an object.

(i) Both A and R are true and R is the correct explanation of A.


(ii) Both A and R are true and R is not the correct explanation of A.
(iii) A is true but R is false.
(iv) A is false but R is true.

(m) The java source code is compiled to


(i) object code. (iii) byte code.
(ii) final code. (iv) machine code.
(3)

(n) Assertion(A): The Math.random() method returns a random number between 0 and
less than 2.
Reason(R): The Math.round() method returns the value of a number rounded off to
the nearest integer.

(i) Both A and R are true and R is the correct explanation of A.


(ii) Both A and R are true and R is not the correct explanation of A.
(iii) A is true but R is false.
(iv) A is false but R is true.

(o) The prototype of a function test that returns true or false and takes an integer variable
and a character variable as its arguments is:
(i) int test(int x, char c)
(ii) boolean test(int x, char c)
(iii) boolean test(int x, int c)
(iv) int test(char x, char c)

(p) Which of the following statements causes an infinite loop?


(i) for(; ;)
(ii) for(i = 0; i < 1; i - -)
(iii) for(i = 0; ; i + +)
(iv) all of the above

(q) The method that changes the state of an object is known as


(i) impure method. (iii) perfect method.
(ii) pure method. (iv) accessor method.

(r) Which of the following statements is incorrect?


(i) String is a class.
(ii) In Java, string objects are mutable.
(iii) Every string is an object of the String class.
(iv) Java defines a class of String called StringBuffer, which can alter a string.

(s) Which of the following variable declaration would not compile in a Java program?
(i) int var; (ii) int VAR; (iii) int var1; (iv) int 1_var;

(t) The access specifier which gives restricted accessibility is


(i) private. (ii) protected. (iii) public. (iv) default.
(4)

Question No 2
(a) Find the output of the following:
(i) String str = “Information Technology”; [2]
String s = str.substring(str.lastIndexOf(‘o’));
System.out.println(s);

(ii) Math.max(Math.min(–8, –4), –5) [2]

(iii) Math.round(–12.98) [1]

(b) Write the Java expression for the following: [2]

a = x + 5 ÷ x2 – �x + y ÷ 2

(c) Read the following code and answer the questions given below: [3]

public class Myclass


{
public static int a, b;
public int x,y;
Myclass()
{
a = 5;
b = 7;
x = 2;
y = 5;
}
public void(int m, int n)
{
System.out.println(m);
System.out.println(n);
}
}

(i) Name the variables for which each object will have its own distinct copy.
(ii) Name the variables which are common to all objects of the class.
(iii) Name the local variables.
(5)

Question No 3
Write the output of the following:

(a) int i; [2]


for( i = 5; i > 10; i--)
System.out.println( i );
System.out.println( i*4 );

(b) void func( int x ) [3]


{
for( int i = 1; i < = x; i++ )
{
if ( x%i==0 )
System.out.print( i + “ ”);
}
}
The value 10 is passed to func().

(c) void prac(String s) [3]


{
String temp= “”;
for( int i = 0; i<s.length(); i++ )
temp = s.charAt(i) + temp;
System.out.println( temp );
}
The string ‘programming’ is passed to the function prac().

(d) Convert the following code to an ‘if’ construct: [2]


switch(x)
{
case ‘M’: System.out.println(“Microsoft Teams”);
break;
case ‘G’: System.out.println(“Google Meet”);
default: System.out.println(“any software”);
}
(6)

SECTION B (60 marks)


Answer any four questions.

Answers should consist of programs in either Blue J environment or any program


environment with Java as the base.
Variable Descriptions/Mnemonic Codes should be used to write each program so
that the logic of the program is clearly demonstrated.
Flow charts and algorithms are not required.

Question No 4

Write a menu-driven program to perform the following as per the user’s choice: [15]

(a) Print the following series:

1, 12, 123, 1234, ……n

(b) Print the sum of the following series:

a2 a3 a4 a10
a– + – +…… –
2! 3! 4! 10!

Question No 5

Write a program to overload the function number() as follows: [15]

(a) void number(int n): Input a number, check and print whether it is a Disarium number or
not.

(A Disarium number is a number whose sum of digits powered with their respective
positions is equal to the original number. Eg. 175 = 11 + 72 + 53)

(b) void number(int a, int n1): Print the sum of the following series:

x x3 x5 xn1
+ + + ……… +
2 4 6 (n1 + 1)

Question No 6

Write a menu-driven program to the print the following patterns as per the user’s choice: [15]

(a) 55555 (b) A

44444 BC

33333 DEF

22222 GHIJ

11111 KLMNO
(7)

Question No 7
Write a program to input a sentence and print the longest word in the sentence and also the
length of the longest word. [15]
Sample input: We are learning Java
Sample output: longest word: learning length: 8

Question No 8
Design a class Showroom according to the following specifications: [15]
Data members: String name: name of the customer
String mbno: mobile number of the customer
int cost: cost of items purchased
double dis: amount of discount
double amt: amount to be paid after discount
Member methods:
(a) A default constructor to initialize the data members.

(b) void input(): to input name, mbno and cost

(c) void calculate(): to calculate the discount on the cost of items purchased and also the
final amount to be paid based on the following:

Cost(₹) Discount
<=10000 5%
>10000 and <=20000 10%
>20000 and <=35000 15%
>35000 20%

(d) void display(): to display all the details


Write a main() method to create an object of the class and call the above methods.

Question No 9
Write a program to input a sentence and a word in upper case. Count and print the number
of times the word occurs in the sentence. [15]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy