Questions – Exam Papers – Computer Sir Ki Class Exam Paper: ICSE2018 (JAVA) No. of Q.26 SECTION A (40 marks)
Attempt all questions

Define abstraction.

Differentiate between searching and sorting.

Write a difference between the functions isUpperCase() and toUpperCase().

How are private members of a class different from public members?

Classify the following as primative or non-primative datatypes:
(i) char
(ii) arrays
(iii)int
(iv) classes

(1) int res = ‘A’;
What is the value of res?

(ii) Name the package that contains wrapper classes.

State the difference between while and do while loop.

System.out.print(“BEST”);
System.out.println(“OF LUCK”);
Choose the correct option for the output of the above statements
(i)
BEST OF LUCK
(ii)
BEST
OF LUCK

Write the prototype of a function check which takes an integer as an argument and returns a character.

Write the return data type of the following function.
(i) endsWith()
(ii)log()

Write a Java expression for the following: What is the value of y after evaluating the expression given below?
y+=++y + y– + –y;  when int y=8

Give the output of the following:
(i) Math.floor(-4.7)
(ii)Math.ceil(3.4)+Math.pow(2,3)

Write two characteristics of a constructor.

Write the output for the following:
System.out.println(“Incredible”+”n”+”world”);

Convert the following if else if construct into switch case
if( var==1)
System.out.println(“good”);
else if(var==2)
System.out.println(“better”);
else if(var==3)
System.out.println(“best”);
else
System.out.println(“invalid”);

Give the output of the following string functions:
(i) “ACHIEVEMENT”.replace(‘E’,’A’)
(ii)”DEDICATE”.compareTo(“DEVOTE”)

Consider the following String array and give the output
String arr[]= {“DELHI”, “CHENNAI”, “MUMBAI”, “LUCKNOW”, “JAIPUR”};
System.out.println(arr.length()>arr.length());
System.out.print(arr.substring(0,3));

Rewrite the following using ternary operator:
if (bill>10000)
discount=bill*10.0/100;
else
discount = bill*5.0/100;

Give the output of the following program segment and also mention how many times the loop is executed:
int i;
for (i=5;i>10;i++)
System.out.println(i);
System.out.println(i*4);

SECTION B (60 marks)
Attempt any four questions from this Section

Design a class RailwayTicket with following description:

Instance variables/data members :
String name : To store the name of the customer
String coach : To store the type of coach customer wants to travel
long mobno : To store customer’s mobile number
int amt : To store basic amount of ticket
int totalamt : To store the amount to be paid after updating the original amount
Member methods :
void accept () – To take input for name, coach, mobile number and amount.
void update() – To update the amount as per the coach selected
(extra amount to be added in the amount as follows)

Type of Coaches Amount
First_AC 700
Second_AC 500
Third_AC 250
sleeper None

void display() – To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.

Write a program to input a number and check and print whether it is a Pronic number or not. (Pronic number is the number which is the product of two consecutive integers)
Examples: 12 = 3 x 4
20 = 4 x 5
42 = 6 x 7

Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World

Design a class to overload a function volume() as follows:

(i) double volume (double R) ¡V with radius (R) as an argument, returns the volume of sphere using the formula.
V = 4/3 x 22/7 x R^3
(ii) double volume (double H, double R) ¡V with height(H) and radius(R) as the arguments, returns the volume of a cylinder using the formula.
V = 22/7 x R^2 x H
(iii) double volume (double L, double B, double H) ¡V with length(L), breadth(B) and Height(H) as the arguments, returns the volume of a cuboid using the formula.
V = L x B x H

Write a menu driven program to display the pattern as per user’s choice.
Pattern 1 Pattern 2
ABCDE       B
ABCD         LL
ABC            UUU
AB              EEEE
A
For an incorrect option, an appropriate error message should be displayed.

Write a program to accept name and total marks of N number of students in two single subscript array name[ ] and totalmarks[ ].
Calculate and print:
(i) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students)/N]
(ii) Deviation of each student’s total marks with the average.
[deviation = total marks of a student – average]
{"ft_lang_label":"__label__en","ft_lang_prob":0.74902135,"math_prob":0.94532055,"size":4487,"snap":"2021-43-2021-49","text_gpt3_token_len":1149,"char_repetition_ratio":0.13250056,"word_repetition_ratio":0.025210084,"special_character_ratio":0.25852463,"punctuation_ratio":0.12885463,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99366236,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-20T16:14:41Z\",\"WARC-Record-ID\":\"<urn:uuid:c9f00b83-e5f2-46fb-9ba1-06711d7006e0>\",\"Content-Length\":\"77327\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c07a7919-215f-4dcc-a7d0-7e0a837ab996>\",\"WARC-Concurrent-To\":\"<urn:uuid:0606afb7-0238-4c2a-8ad7-79a85fc12feb>\",\"WARC-IP-Address\":\"198.38.82.90\",\"WARC-Target-URI\":\"https://computersirkiclass.com/?page_id=4085&examy=ICSE2018&examcat=3&paper=4077\",\"WARC-Payload-Digest\":\"sha1:Y622TEWOA3CT77ME6ZPGT2XI5DJUZ7FP\",\"WARC-Block-Digest\":\"sha1:B3V3Y6IKSN7U6RIXSQB5ECDU4BYYRTRO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585322.63_warc_CC-MAIN-20211020152307-20211020182307-00569.warc.gz\"}"}