0% found this document useful (0 votes)
14 views8 pages

AOASS Selection

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)
14 views8 pages

AOASS Selection

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

Assembly of Angels Secondary Schocl

Selection Examination
2023- 2024

Subject: Computer Science


Grade: 10 Max Marks: 100
Date :17/01/2024 Duration :2 hrs.

SECTION -A
Attempt All questions.
Question 1. |20*1-20]

Choose the correct option

(i) What does the 'void' keyword mean in Java?


(a) It signifies that a method returns nothing
"(b) It indicates a method is private
(c) Itspecifies a method is static
" (d) It denotes a method has no parameters

(ii) What is the output of the following Java code snippet?


int x =5:
X+=3;
System.out.println(x++);
.(a) 8
. (b) 2
(c) 9
.(d) 3

(ii) Findout the value of y when String s= "SELECTION EXAMINATION";


String y= s.substring(s.indexOf(E'),s.lastIndex Of(E)-1);
(a) SELECTION
(b)CTION
(c) ELECTION
-(d) None of the Above
(iv) Name the method to convert îrom String to double datatype.
.(a) parseDouble( )
(b) Double.toString( )
(c) Parsedouble( )
(d) ParseDouble( )
(v) What value will be stored in variable a?
char ch='d';
boolean a-Character.isLetterOrDigit(char)(Character.toUpperCase(ch)-20):
1
This question paper consists of 8 printed sides
(n) "ale"
b) te

() false

(vi) Wraper class bclongs to whlch packagc.


() javn,lang
(b) juva.lo
(e)java.upplet
(d) java,util

(vii)Fdthe output of the following code:


int al |{5,6,7,12,3,90});
int len-a.length;
System.out.print(len-alI):
System.out.print(len ta|4);
(a) 10
(b) 03
{c) 09
(d) 163

(viii) Assertion: Dcclaring an array of síze 5 in Java will crcatc an array with indices 1 to 5.
Reason: In Java, array indices start from 0, so an array of size 5has indices from0 to 4.
(a) Both asscrtion and reason arc correct, and the reason is a correct
cxplanation of the assertion.
(b) Both assertion and reason arc correct, but the reason is NOT a correct
explanation of the assertion,
-(c) Thc assertion is correct, but the reason is incorrect.
- (d) The assertion is incorrect,

(ix) ldentify tlhe concept done in following statements:


int Y-S;
Integer X-new Integer(Y);
System.out.println(X);
.(a) Boxing
(b) Unboxing
(c) Type Casting
{d)Cocrcion

(x) Selcct the correct output for "prime number".indexOf('m', S):


(a) 7
(b)
(c) 3
(d)

2
This question paper consists of 8 printed sides
(xi) Asserion: Ado-while loop in Java will execute the loop body at least once, even if the
condition is false initially.
Reason: The do-while loop checks its condition at the end of the loop body.

asserionand reason are correct. and the reason is a correct explanation of the
assertion.
(b) Both assertion and reason are correct. but the reason is NOT acorrect explanaton of
the assertion.
(c) The assertion is correct, but the reason is incorrect.
(d) The assertion is incorrect.

(Xi1) Which of the following options correctly represents avalid constant or value in the Java
programming language?
A. "Hello, World!"
B. 3.14.2
C.true
D. '3.2"
(a) Only A
b) OnlyC
(c) A and D
(d) A and C

(xii) Which of these operators is used to allocate memory for an object?


(a) malloc
(b) alloc
(c) new
-(d) give

(xiv) Which of the followingfunctions is used to remove leading and trailing white spaces
from the string?
{a) trail()
(b) trim()
(c) truncate( )
-(d) slice()

(xv) The number of bytes occupied by acharacter array of 10elements.


(a) 20 bytes
-(b) 60 bytes
(c) 40 bytes
(d) 120 bytes
(xVi) Which of these can be overloaded?
(a) Methods
(b)Constructors
3
This question paper consists of 8 printed sides
(c) All of the mentioned
(d) None of the mentioned

(xvi)What is the output of the following Java code snippet?


int num9;
System.out.println(num++ +++tnum):
'(a) 19
(b) 21
(c) 20
<d) error

(xvii) What is the output of the following Java code?


String strl = "Hello";
String str2 = "Hello":
System.out.println(str l == str2);

{a) true
(b) false
"(c) Hello == Hello
"(d) Nonc of the Above

(xix) System.exit(0) terminates the program from any point.


(a) True
(b) False

(xx) int x;
for (x=1; x<=3; x++ )
System.out.print (x);
System.out.print (x);

-(a) 123
(b) 1
·(c) 1234
(d) 1233

Question 2.

(i) Predict the output of the following code snippet:


String ten = "10";
[21
String hundred = Hundred":
String one = "1";
System.out.printin(one + Integer.parselnt(ten)+hundred);
(ii) Write a Java statement for the expression:
[2|

4
This question paper consists of 8 printed sides
0.05-2y'
X-Y
(iu) Write a prototype of the method ShowWiz) which receives a double and an integer
as arguments and returns true or false. (2]

(iv) Give the output of the following [2|


statements:
SystSysteem.m.ooutut..ppririnnttlinn("Good".concat("Day");substring(0,5))
("MERRYWORLD".
System.out.printin("My dream".length);
System.out.println("Memory".starts With("Me");
(v) What do the following functions return for?
[2]
String x ="hello";
String y "world";
System.out.println(x +y);
System.out.printin(x.length);
System.out.printin(x.charAt(3);
System.out. println(x.equals(y));
(vi) Convert the following into equivalent for loop:
[2]
int i=10, p=0;
while(p<=20)
{System.out.print();
pt+;

(vii) Name the following:


(2]
(a) Parameters present in the method call statement.
(b) Smallest individual unit ofa program.

(vi) Find the errors in the given program segment and re-write the statements correctly to
assign values to an integer array. (2]
int a =new int (5);
for (int i = 0; i<= 5; itt)
a [i] = i;

5
This question paper consists of 8printed sides
statements instead of the
using nested if-else
segment 121
(ix) Rewrite the following program
ternary operator:
(mark>=90) ? A": (mark>=80) ? "B": "C";
String grade=
2]
and y below ?
What are the final values stored in variable x
(x)
double a=-6.35;
double b = 14.74;
double x = Math.abs(Math.ceil(a));
double y = Math.round (Math max (x,b));

SECTION -B

Section.
Attempt anyfourquestionsfrom this
J environment or any
answers in this Section should consist of thePrograms in either Blue
The as the base.
program environment with Java

using Variable descriptions/Mnemonic Codes so that the logic


Eachprogram should be written
ofthe program is clearly depicted.
Flow-Charts and Algorithms are not required
[15]
Question 4.
specifications: -
Design a class BusFare that has the following
Instance variables :

String nm:Tostore the passenger's name


kilometers.
int km : To store the distance travelled in
int fare: To store total fare.
Member functions :
BusFare(): Constructorto initialize the instance variables.
void input( ):To input name and km travelled by a passenger.
conditions :
void calfare( ): To calculate bus fare according to the given
Distance (in km) Rate
Up to 5 km Rs. 25
Next 5 km Rs. 10/km

Next 10 km Rs 8/ km
Next 10 km Rs 6/ km
More than 30 km Rs. 5/ km

6
This question paper consists of 8 printed sides
void display( ): To
passcnger. dispiay the details such as name, km travelled and the total fare of the
Write a main( )
method to create an object of the class and call the above member methods.
Question 5.
|151
Wite a program to input 20 number of String elements in an
order using bubble sort technique array and sort them in descenaing
and print the sorted list.
Question 6. |15]
Write a program to input a number and check and nrint whether it is an
EvenPal number or iot.
The number is said to be an EvenPal number when the number is a
sum of its digits is an even number. palindrome number and ne

Example:
Number 121 is a palindrome number and the sum of its digits is 1+2+1=4, which is
an even number.

Therefore 121 is an EvenPal number.

Question 7. [15]

Wite a program to accept values in a4*4 Matrix and Print the Original Matrix and the sum of its
right diagonal elements.
Question 8. [15]
Define a class to overload the method display as follows:
void display(): To print the following format using nested loop
1111
3333
5555
7777

void display(int n): Toprint the cube of each digit of the given number
Example: n= 4329
Output - 64
27

729

This question paper consists of 8printed sides


Question 9. [15]

Define a class to declare an array to accept and store ten words. Display only those words

which begin with the letter'A' or 'a' and also end with the letter 'A' or 'a'.

EXAMPLE:

Input : Hari, Anita, Akash, Arpita, Alina, Devi Rishab, John, Farha, AMITHA
Output: Anita

Arpita
Alina

AMITHA

You might also like