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/ 2
QUESTIONS
Maximum Marks : 50 (vii)A single dimensional array
Time Allowed : One and a half hours willbe the last subscript? contains N Answers tothis Paper must be written on the paper (a) N provided separately. (c) N-2 You will not be allowed to write during the first (b) N-1 (d) N+1 10minutes. (viii) The access modifier that gives Thís time is to be spent in reading the question least The time given at the head of this Paper is the paper. time (a) private ac es ibrlity (c) protected s allowed for writing the answers. (b) public (d) package Attempt all questions from SectionA and any four (ix) Give the output of the following code: questions from Section B. String A="56.0", B="94.0"; The marks intended for questions are given in brackets I1. double C= Double .parseDouble( A); SECTION-A (40 Marks) double D= Double .parseDouble B); (Attempt all questions) Question 1. System.out.printn(C+D); (a) 100 (c) 100.0 Choose the correct answers to the questions from the (b) 150.0 given options. (Do not copy the (d) 150 Correct answer only.) question. Wrte the (x) What will be the output of (10) the following code? (i) Returndata type of (a) Boolean isLetter(char) is (c) boo! System.out.println( "Lucknow"substring(0,4); (a) Lucknow (c) Luck (b) boolean (d) char (b) Luckn (d) luck (ii) Method that converts a character to uppercase is_ SECTION-B (a) tollpper() (b) TollyperCase() (Aftempt any four questions from this Section) Question 2. (c) tollppercase() (d) tollpperCaselchar) Define a class to perform binary search on alist (iii) Give the output of the following String integers given below, to search for an element input methods: the user, if it is found displaythe "SUCESS".indexOf(S)+ "SUCESS".lastíndexOf('S') is position, element along u (a) 0 (c) 6 otherwise display the message "Serch (b) 5 element not found". (d) -5 2, 5,7, 10, 15, 20, 29, 30, 46, (iv) Corresponding wrayper class of float data type is 50 Question 3. (a) FLOAT (c) Float Define a class todeclare a character array of size (b) float (d) Floating accept the characters into the array and display the (v) class is used to convert a primitive data type to characters with highest and lowest ASCII(Americat its corresponding object. Standard Code for Information Interchange) value. (a) String (c) System EXAMPLE: (b) Wrapper (d) Math INPUT: (vi) Give the output of the following code: 'R,'z','q', 'A', 'N, p', 'm', u,'Q, F System.out,printn("Good".concat("Day")); OUTPUT: (a) GoodDay (c) Goodday Character with highest ASCIl value =z (b) Good Day (d) goodDay Character with lowest ASCII value =A Solved Papers 583 Ouestion 4. Example: Define a class to declare an array of size twenty of Input : Hari, Anita, Akash, Amrita, Alina, Devi, double datatype, accept the elements into the array and Rishab, John, Farha,AMITHA perform the following: [10] Output: Anita Calculate and print the product of allthe elements. Amrita Print the square of each element of the array. Alina Question 5. AMITHA Define a class to accept a string, and print the characters Question 7. with the uppercase and lowercase reversed, but all the other characters should remain the same as before. [10] Define a class to accept two stringsof same length and EXAMPLE: INPUT WelCoMe_2022 form a new word in such a way that, the first character OUTPUT : wELCOmE_2022 of the first word is followed by the first character of the second word and so on. [10] Question 6. Define a class to declare an array to accept and store Example: Input string 1 - BALL ten words. Display only those words which begin with Input string 2 WORD the letter 'A' or 'a' and alsoend with the letter 'A' or [10] Output : BWAOLRLD 'a'.