0% found this document useful (0 votes)
80 views6 pages

Comp - 10 - Selection Exam

The document is a selection examination paper for Computer Science for Grade 10 at Assembly of Angels Secondary School for the academic year 2024-2025. It includes multiple-choice questions and programming tasks covering various topics in Java, such as data types, control structures, and object-oriented programming concepts. Additionally, it requires students to write Java programs based on specified criteria and to demonstrate their understanding of programming logic.

Uploaded by

stacc.abhi
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)
80 views6 pages

Comp - 10 - Selection Exam

The document is a selection examination paper for Computer Science for Grade 10 at Assembly of Angels Secondary School for the academic year 2024-2025. It includes multiple-choice questions and programming tasks covering various topics in Java, such as data types, control structures, and object-oriented programming concepts. Additionally, it requires students to write Java programs based on specified criteria and to demonstrate their understanding of programming logic.

Uploaded by

stacc.abhi
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/ 6

Assembly of Angels Secondary School

Selection Examination
2024- 2025

Subject: Computer Science

Grade: 10 Max Marks: 100


Date : 17/01/2025 Duration : 2 hrs.

SECTION - A
Attempt All questions.
Question 1: Choose the correct option [1*20=20]

(i) Which among the following is not an error?


(a) Syntax errors (b) Logical errors (c) Run-time errors (d) Technical errors
(ii) Name the feature of Java depicted in the picture.

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


(iii) Static variables belong to the __________.
(a) Class (b) Object (c) Identifier (d) Library
(iv) The number of bytes occupied by the array char m[ ] = {'R', 'O', 'B', 'O', 'T', 'I', 'C', 'S'} is:
(a) 32 bytes (b) 8 bytes (c) 16 bytes (d) 60 bytes
(v) Math.sqrt(169) + Math.floor(22.8) equals:
(a) 36.0 (b) 37.0 (c) 35.0 (d) 34.0
(vi) Find the output of the following code:
int s = 14;
if (s > 20) System.out.print("AB" + ((char)(s + 64)));
else System.out.print("BB" + ((char)(s + 96)));
System.out.print(" CC");
(a) ABC BBN CC (b) AB BBn CC (c) BbNCc (d) BBnCC
(vii) Constructor overloading comes under:
(a) Inheritance (b) Polymorphism (c) Abstraction (d) Encapsulation
(viii) The method to check if a character is an alphabet or not is:
(a) Character.isAlphabet(char) (b) Character.isLetter(char)
(c) char.isAlphabet() (d) char.isLetter()

1
This question paper consists of 6 printed sides
(ix) The output of Float.parseFloat("68.75") + 0.5 is:
(a) Error (b) 69.0 (c) 69.25 (d) 68.750.5
(x) What will be the output of the expression:
If a = 14, then b = (++a * (a++ + 5))
(a) 120 (b) 625 (c) 300 (d) 230
(xi) Evaluate double x = Math.pow("COMET".indexOf('M'), 3) +PAPER".compareTo("PEN");
(a) 12.0 (b) -4.0 (c) 8.0 (d) 4.0
(xii) If the class name is Word, which is a valid constructor?
(a) word() (b) Word_Constructor() (c) Word() (d) word_constructor()
(xiii) What value will be stored in variable a?
char ch=’d’;
boolean a=Character.isLetterOrDigit((char)(Character.toUpperCase(ch)-20));
(a) "False" (b) true (c) True (d) false
(xiv) Assertion: Declaring an array of size 5 in Java will create an array with indices 1 to 5.
Reason: In Java, array indices start from 0, so an array of size 5 has indices from 0 to 4.
(a)Both assertion and 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 a correct explanation of the
assertion.
(c)The assertion is correct, but the reason is incorrect.
(d)The assertion is incorrect.
(xv) Find out the value of y when String s= "SELECTION EXAMINATION”;
String y= s.substring(s.indexOf(‘E’),s.lastIndexOf(‘E’)-1);
(a) SELECTION (b) CTION (c) ELECTION (d) None of the Above
(xvi) Name the method to convert from String to double datatype.
(a) parseDouble( ) (b) Double.toString( ) (c) Parsedouble( ) (d) ParseDouble( )
(xvii) Identify the concept done in following statements:
int Y=5;
Integer X=new Integer(Y);
System.out.println(X);
(a) Boxing (b) Unboxing (c) Type Casting (d) Coercion

(xviii) Select the correct output for “prime number”.indexOf(‘m’, 5);


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

(xix) Assertion: A do-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.

2
This question paper consists of 6 printed sides
(a) Both assertion and 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 a correct explanation of
the assertion.
(c) The assertion is correct, but the reason is incorrect.
(d) The assertion is incorrect.
(xx) int x;
for ( x=l; x<=3; x++ )
System.out.print (x);
System.out.print (x);

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

Question 2.

(i) What will be the output of the given code?


String str = "ALPHA";
System.out.println(str.charAt(0) * str.charAt(str.length() - 1)); [2]
(ii) Consider the following program segment and answer the questions given below: [2]
int x[ ]={ 10,20,30,40,50,60, 70}
int n=6;
int y=x[ n/2 ];
System.out.println(y/2.0);
(a) What is the position of 50?
(b) What would be the output of above code?
(iii) Write a Java statement for the expression: [2]

(iv) What will be the output of the following statements:


int des[]={5,8,3,1,0,3,5}
des[3]=des[5];
System.out.println((char)(des.length+64));
System.out.println(“=”+(char)(des[5]+64)+(char)(des[5]+96)); [2]

(v) String s[ ]={“Cyber”,“Punk”,“Far”,“Cry”,“Wukong”};


(a)Write java statement to display the elements that starts with even ascii character. [2]
(b) Write the output: s[3].substring(1).compareToIgnoreCase(s[0].substring(2)); [2]

3
This question paper consists of 6 printed sides
(vi) Study the following iterative structure and answer the questions with working: [2]
int k = 3;
while(++k<=10)
{
if((k+5) % 5==0)
break;
System.out.println(k+5);
}
(a) How many times will the loop get executed ?
(b) What will be the output ?

(vii) Predict the output and the data type: [2]


(a) “ARTIFICIAL”.endsWith(“AL”);
(b) “Java_Basics”.trim().length()
(viii) Name the data type and value returned by: [2]
a. Math.sqrt(16)
b. "COMIC".compareTo("COMET")
(ix) Consider the array: [2]
int a[]={12,35,40,22,56,9,70};
In the above given array, using linear search, how many iterations are required to
check for the existence of the value 56?
If the array is arranged in descending order, how many iterations are required to
check for the existence of 56 using linear search?

SECTION – B

Attempt any four questions from this Section.


The answers in this Section should consist of the Programs in either Blue J environment or any
program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes so that the logic
of the program is clearly depicted.
Flow-Charts and Algorithms are not required

Question 3. [15]

Define a class HotelBooking with the following specifications:


Class name: HotelBooking
Member Variables:
String guestName: To store the name of the guest.
int days: To store the number of days stayed.
double tariff: To store the rate per day.
4
This question paper consists of 6 printed sides
double discount: To store the discount amount.
double totalAmount: To store the total amount to be paid after the discount.
Member Methods:
HotelBooking(): Default constructor to initialize data members.
void input(): To input the guest’s name, number of days stayed, and tariff.
void calculate(): To calculate the discount on the total cost based on the following criteria:
No. of days Discount %
Discount for stay of 3 to 5 days 5%
Discount for stay of 6 to 10 days 10%
Discount for stay of 11 to 15 days 15%
Discount for stay of more than 15 days 20%

void display(): To display the details in the given format:

Guest's Name No. of days stayed Total amount after discount


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

Question 4. [15]

Write a program in Java to enter a number containing three digits or more.


Arrange the digits of the entered number in ascending order and display the result.
Sample Input: Enter a number 4972
Sample Output: 2, 4, 7, 9

Question 5. [15]

Write a program to accept values in a 4*4 Matrix and Print the Original Matrix and check if the
sum of its right diagonal elements is equal to the sum of Left diagonal elements or not.

Question 6. [15]

Write a program that accepts a sentence as input. Modify the sentence by bringing all vowels of
the word to the beginning, followed by the consonants. Display the new sentence with the modified
words.
Example:
Sample Input: Computer Applications
Sample Output: oueAiaoCmptrpplctns

5
This question paper consists of 6 printed sides
Question 7. [15]

Define a class to overload the method display as follows:

void display(): To print the following format using nested loop

A
B C
D E F
G H I J
K L M N O

void display(int n): To print the sum of the series given below:

2/1! + 4/2! + 6/3! + ………… upto n terms


Question 8. [15]

Write a program to accept two arrays to store 20 names and their marks. Arrange the marks
using bubble sort technique in descending order. Also display the marks along with
corresponding student name.

EXAMPLE :
Input :
Hari, Anita, Akash, Arpita
80,98,75,88
Output: 98 Anita
88 Arpita
80 Hari
75 Akash

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

6
This question paper consists of 6 printed sides

You might also like