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

CBS Computer Application

Uploaded by

Suchetana Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

CBS Computer Application

Uploaded by

Suchetana Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Calcutta Bops' School Rehearsal Examination --- 2022- 2023 CI:X

Time: 2 Hrs. COMPUTER APPLICATION Marks: 100


Reading Time: 15 Minutes
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 Lj.

SECTIONA
(Attempt all questions from this Section)
Question 1 [20]
Choose the correct answer and write the correct option.
(i) promotes Reusability.
(a) Data Encapsulation
(b) Function Overloading
(c) Inheritance
(d) Data Abstraction

(ii) Automatic type conversion (implicit) is possible in which of the following cases?

(a) double to float


(b) boolean to char
(C) char to boolean
(d) None of these

(in) Identify the keyword among the following that makes a variable belong to a class rather than being
defined for each instance of the class

(a) abstract
(b) final
(cstatic
(d) neW

iv IfString str =
"

"+true; then what is stored in str?

(a)
(b) Null
(C)true
dY "true

Which of the following is a keyword in Java ?


(V)

(a) String
(b) that
(c) this
(d) both (a) and (c)
statement terminates the complete execution of a program
(vi) Which of the following

(a) break
(b) exit
(c) System.exit(0)
(e) both (a) and (c)
13o1
code System.out.print(b+C+a) a0
be output of the
-

If a=7, b= -2, c= a+5 then what will


(vil)
(a) 8
(b) 10
( e 17
(d) None of these
("Kolkata")
of the code
-

System.out.print (str.concat
str=null then what will be the output
(Vii) f
(a) nullKolkata
(b) Kolkata
(c) \u0000'Kolkata
(d) None of these

(ix) Entry controlled loops are

(a) for loop


(b) while loop
(c) do-while loop
both
(d) (a) and (b)
method due to similar method
matches for an invocation of a
Sometimes there are two or more possible
This is referred to as
so the compiler cannot
determine the most specific match.
Signature,
(a) Ambiguous simulation
(b) Ambiguous Overriding
(c) Ambiguous invocation
(d) (a) and (c) both
What will be the output of the code
(xi) int arr[]={12, 7,5, 9, 45, 100, 32, 89, 90, 87};
System.out.print(arr[3]+arr[5-1]%arr[6-3]*arr[3*0])

(a) 87
(b) 69
9
(d) None of these

ASCII Code of 7 is_


(xil)
(a) 54
b 55
(c) 56
None of these
(d)
can contain a mix of :
An arithmetic expression
(xii)
(a) Literals
Variables is the name of an Array
(b) Variables like arr[1] where arr
(c) Subscripted
(d) All of these
What will be the
data type of arr[]?
arr[]={2.5, 3.7,6.1, 9.3};
(xiv)
(a) long
bdouble
(c) int
None of these
(d)
xv) Public, Private, Protected
(a) Access Maker are called
(b) Visibility Modifiers
(c) Access Specifier
y (b) and (c) both

(xvi) Wrapper classes are the part of library


(a) Java.util
(b) Java.lang
(c) Java.awt
(d) None of these

(xvii) A default constructor can take. parameters


(a) 1
(b) More than one
(c) 0
(d) All of these

(xvii) What will be the value of x when x=Integer.parseInt" 123")+ Integer.parseInt(" 123")
(a) 123
(b) 123123
(c) An Error occurred in runtime
(d) 246

(xix) The output of the code is -System.out.print("MALAYALAM".indexOf('m))


(a)-1
(b) 0
(c) 8
(d) None of these

The string function endsWith() will return datatype


(xx)
(a) character

(b) String
(c) boolean
(d) integer

Question2
(2
(a) Write down java expression for
Va2+b2+c2
X
[2+2]
Define the following with example
(b) (i) Access Specifier
() Data Encapsulaione
if-else and switch-Case Statement. (2
(c) Differentiate (at least 2) between (2]
to lowercase.
which will change a character
Write a single line code
(d) (2)
expression:
(e) Give the output of the following
10*a + (++a) -

20%a + (a --); when a =10


at= a +
3101
rewrite the code using ternary operator 2]
Analyze the given Code snippet and

String grade;
if(score> = 80)
grade ="A";
else if (score>= 70)
grade = "B";

else if (score >= 60)


grade = "C";

else
grade = "D";

(g) What is Autoboxing? Explain with example. 2]


(h) Write a function in java which will print the Floyd's triangle given below [21
1

2 3
45 6
7 89 10
11 12 13 14 15
(Class, Member data, Member functions, Main function are not needed. Write only a function which will
take the limit of the triangle as formal parameter and print the above triangle. Example:- void

Floyd(int size)) Use local variable if needed.


) State the difference between = = operator and equals() method [21

SECTIONB
(Attempt any four questions from this Section)
The answers in this section should consist of the programs in either Blue) environment or any program
environment with java as the base.
Each program in this section should be written using varíable description
Flowcharts and algorithms are not required.
[15]
Question3
Define a class called SECURITY with the following description:
Instance variables /Data members:

String t o store name of the Security personnel


name
for which wages are to be paid
int hour-to store number of hours
double rate- to store the hourly rate
store the wages
double wages t o calculate and

Member methods: rate


store the name of the customer, hour and
void accept()- to input and
the wages of security personnel.
void calculate()- to calculate
details of security personnel including
wages
void display()-display the

basis:
Therate is charged on the following Charges/Day
Days 5/hour
Up to 40 hours 6.5/hour
For next 20 hours 8/hour
Fornext 20 hours
Call the member
methods by using the object.
and create the object of the class.
Write a main function
Question 4
write a menu driven
Scanner class java
program
to
perform the following:(use switch-case statement) which will take a number
[15]
r Using
(1) Check the number fro
whether it is an
An Armstrong number is Armstrong number or
For example, 153 is an
an
integer such that the sum of thenot.cubes
of its
Armstrong number since 13 + 53+33
digits is equal to the number elf
=
153]
(2) Check the number whether
it is a Prime
Prime number which isnumber or not.
A number
is called a
divisible by itself and 1. For example 2, 3, 5, 7, 11
Question s5 etc.
Design a class to overload a function [15]
(a) void volume (double compared as follows:
n* radius2 *
radius, double height) -

to find out the volume of a Cylinder. [Volume of


height
when n=
a Cylinder
(b) void volume (double radius)- to find out the
volume of a Sphere.
[Volume of a Sphere *n* radius3 when n=]
=

Write a main function and create the


main
object of the class. Call the member functions mentioned above from the
through the object.
Question 6 program which will take salary (in double) of ten people as input from the user and store
Write a java [15] them in
a one dimensional array. Sort and display the elements of the array in descending order by using bubble sort
technique.
Question7 [15]
Write a java program to input a string in uppercase from user by using Scanner class and print the frequency
for each character.
Example:
Input: HAPPY NEW YEAR
Output: HAPYNEWR
1 2 2 2 1 2 1 1

Question 8 [15]
by using Scanner Class and encodes the word in PIGLATIN.
Write a java program to input a word from the user

Howto make a word PIGLATIN?

Step 1: At first convert the word into Uppercase


Step 2 Find out the index of first Vowel
and s2
Step 3: Obtain two substrings, they are S1 1
Step 4: S1 characters from beginning till
index of first vowel
-

S2 from index of first vowel till end of the String.


Step 5: :
"AY"
Step 6: S3 will be $3=$2 + S1 +
be in Pig Latin form of the given Word.
The resulting string $3 will

Example:

Input: store
PIGLATIN ORESTAY
Output as

Input olympics
Output as PIGLATIN : OLYMPICSAY

****k**************k****k**

You might also like