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

Comp StXavier

The document is a test paper for Class 10 Computer Applications at St. Xavier's Collegiate School, Kolkata, consisting of multiple-choice questions and programming tasks. It includes questions on Java concepts, data types, and error handling, along with programming assignments related to banking, string manipulation, sorting, and number classification. The test is designed to assess students' understanding of computer applications and programming skills.

Uploaded by

ankush.590217
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)
24 views4 pages

Comp StXavier

The document is a test paper for Class 10 Computer Applications at St. Xavier's Collegiate School, Kolkata, consisting of multiple-choice questions and programming tasks. It includes questions on Java concepts, data types, and error handling, along with programming assignments related to banking, string manipulation, sorting, and number classification. The test is designed to assess students' understanding of computer applications and programming skills.

Uploaded by

ankush.590217
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/ 4

St.

Xavier's Collegiate School, Kolkata


Second Semester Block Test
Class: 10,Computer Applications Time: 2 Hrs
Date: 12.12.2023 Full Marks: 100
Section A
Answer allquestions
Question 1
Choose the correct answers to the guestions from the given options [20]
Behaves like a student in school
Behaves like a son at home
Behaves like a customer in a store

Name the feature of java depicted in the above picture.


a) Encapsulation b) Inheritance c) Abstraction Polymorphism
ii)Which of the following is a binary operator?
a) ! b) ?: c) %

ii) variables are shared by all objects.


a) instance b) local c) class d) All of the above
iv) Which unit of the class gets called, when the object of the class is created?
d) static method
a) main method b)constructor c) the first method

v) Which of the following is not a wrapper class?


a) Byte b) Char c) Long d) Boolean
type.
vi) The process of convertingawrapper class object into its corresponding primitive data
a) Type casting b) Autoboxing Unboxing d) Coercion

vi) Which feature is implemented using encapsulation?


a) Inheritance b}Abstraction c) Polymorphism d) Overloading

vii) Given that int AD[-{{6, 3,9}, {12, 4, 16}, {17, 7, 5}}, what will be the value at A[1]/2]?
)t6 b) 3 c)7 d) 17

ix) Which of these methods does not return an integer value?


a) equals) b) compareTo) c) indexOf) d) length()
destroyed
x) Which variables are created when an object is created with the use of the keyword 'new' and
when the object is destroyed? c) Class Variables d) Static variables
a) Local variables b}fnstance variables

xi) What datatype will be stored in x?


X=Sc.next).charAt(0);
a) String b) double echar d) short

xii) Name the type of error, if any, in the following code:


int a[]=new int[10];
System.out.println(a[10]);
a) Syntax error b) Runtime error c) Logical error d) No errOr
xii)Which is the typecast operator?
b) } d) ?:
a) []
xiv) Choose the odd one:
a) true b) void c) false d) null

xv) Give the output:


System.out. println(*"BUTTER'". compareTo("butter);,
a) 0 t-32 c) 32 d) 26

XVi) Which of the following is an infinite loop?


b) while(a--true){ a-false;}
a) for(i=0; i>0; i++) do{ a-true:} while(a-false};
c) do a=true;} while(a=-true);
Xvii) Assertion(A): In java, "VOID" cannot be used as an ídentifier.
Reason(R): In Java, keywords cannot be used as identifier names. correct explanation of ASSertion (A)
and Reason (R)ís a
a) Both Assertion (A)and Reason (R) are true Reason (R) is not a correct explanation of AssertiontA)
b) Both Assertion (A) and Reason (R) are true and
c) Assertion (A) is true and Reason (R) is false
d) Assertion (A) is false and Reason (R) is true

xviil) Assertion(A) : In Java, a word cannot be inserted in a String object.


Reason(R): In Java, String objects are immutable. Assertion (A)
a) Both Assertion (A) and Reason (R) are true and Reason (R) is a
correct explanation of. of. Assertion(A)
correct explanation
b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a
c) Assertion (A) is true and Reason (R) is false
Assertion (A) is false and Reason (R) is true

Xíx) Read the following text, and choose the correct answer:
An expression is composed of one or more operations.
expressions and relational or logical
Expressions in Java can be of the following types: arithmetic
expressions.
mixed expressions. In pure expressions, all the
Arithmetic expressions can be either pure expressions or operands are of different data types.
operands are of the same type and in mixed expressions the
Boolean expressions result in either true or false.

What typeof expression is this: int x=45+6*7c) ?Boolean d) Mixed


A) Pure b) Impure

XX) Choose the odd one: d) for


b) class c) else
/a) true
Question 2

a) Rewrite the following loop using for loop:


while (true) (21
System.out,print("xyz"); 50

b)Write the prototype of a function charsearch which takes two parameters, a string and a character and returns
false otherwise (21
true if thecharacter is found in the string and

c) Evaluate the following if the value of x=7, y=5 (2]


x*=x+++x+y
47
d)Prediet the output:
int i-5;
do
{ System.out println(-+it5);
itt;
}while(+ti);
(21
System.out.println):
process called?
e) What is being done in the code below? What is the
char e z':
Character objc c; (21
for the following:
)Using a conditional operator write the equivalent Java statement print "Not a Single Digít Number" (21
Print "Single Digit Number" if dis a single digit number otherwise
character array with all the yowels, (2)
g) Write the Java statement to declare and initialize a
h) What will the following code print?
System.out.println(Math.pow(144,1/2)); 4 0
12.0? (2)
What modification has to be made to get the output

i) Give the output of the following:


class ABC

int a =50;
ABCO
{a= 100;}
void main()

int a=20;
ABCabc = new ABCO;
System.out. println(a+"+abc.a):
121
j)Give the output:
System.out.println(int)("dreams". charAt(2); 161
System.out. println("MISSISSIPPr" JastlndexOf('S'); C (2

SECTIONB
(Answer any four questions from this Section.)
Each program should be written using variable description / mnemonic codes so that the logic of theprogram is
clearly depicted.
Question 3
Design a class Bank to store the details of acustomer and enable transactions for the customer with th
bank. The details of the class is given below:
Class name : Bank
name stores the name of the customer
accno stores the account number
stores the principal arnount in decimals
amt
stores the transaction amount in decimals
Member functions/methods:
void input) theinstance variables
tO dccept the valuesof
updates the
accepts the amount and updatesthe principal as pp tamt
void deposit( ) as
void withdraw( ) accepts the amount and than the principal pp amt Ifthe
withdrawal amount tis more principal amount, then display the
"INSUFFICIENT BALANCE" Ifthe principal amount after
message
withdrawal is lesssthan 500, then a penalty is imposed by using the
formula p=p-(500-p)/10
void display( ) displays the details of the customer
Write a main function to create an object and invoke the methods. [15]
Question 4
Wite aprogram to accept a string in uppercase and print the frequency of each cnataver.
Eg. HARDWARE

CHARACTERS FREQUENCY
A
D 1
E
H 1
R
W 1 [15]

Question 5
Write a program to store the product name and unit price of 10 different products in two single dimensional
arrays. Sort the unit price of the products in descending order, using the selection sort method, and display
the correspondingly sorted product name and unit price with proper headings. [15]
Question 6
Write a program to overload a function count) as given below:
count(int n, intd)to Accept a number and adigit and count the number of times the digit is present in the
number.
count(String s) to Accept a sentence and count the number of words beginning with a vowel. [15]
Question 7
Using a switch statement, write a menu- driven program to do the following as per the user's choice :
Accept an integer and find and display if it is a Spy number or not.
ASpy number is a number where the sum of digits-product of digits.
Eg. 1412; 1+4+1+2=1x4x1x2-8
Accept an integer and find and display if it is a Trimorphic number or not.
ATrimorphic number is one whose cube ends with that number.
Eg.: N=49
N'= 117649
Foran incorrect choice, an appropriate error message should be printed. [15]
Question 8
Write a program to enter integers in a 3x4 2-D array. Find and print the largest number in each row of the
array. [15]

You might also like