Formatting page ...
THAKUR PUBLIC SCHOOL ZOOJ) (Affiliated 'o the the ISO New 2013 CEROFtED Computer Applications Maximum marks: 100 (Two Hours) Answers to this paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent in reading the question paper. The time given at the head of this paper is the time allowed for writing the answers. Attempt all questions from Section A and any four questions from Section B The intended marks for questions or parts of a question are given in the brackets [ ] SECTION -A 1 40 Marksl (Attempt all questions from this section.) Question 1. Choose the correct answer and write the correct option. are often interchangeable. The terms object and i) d) state c) attribute a) behaviour b) instance ii) What is the largest possible value that can be stored in short data type? a) 215 -1 c) 27 -1 b) 231- d) 263 -1 iii) Which of the following is not a valid method of Scanner class? d) nextNumber() b) nextlnt() c) nextLong() a) next() iv) Which package to import to display the date and time? c) java.Date.* a) java.util.* b) java.io.* v) What value will Math.abs(Math.ceil(-6.35))return? d) 6.0 c) 6.35 b) -6.0 a) 6.4 vi) vii) [201 d) java.lang.* program in JVM? Which method is preferable to terminate the currently running c) exit( ) a) break ( ) d) default ( ) b) Continue ( ) following code snippet? How many times does the inner loop executes for the for(int for(int System.out.print( 2 System.out.printlin("WIN"); a) The inner loop executes 3 times b) The inner loop executes 4 times [TPS-Std.10-Computer c) The inner loop executes I time d) Infinite loop Applications-Second Preliminary Examination-15/01/20241 This paper consists of 5 printed pages. 1/5 viii) If a method returns a value, then it must be a) Of the same data type as defined in its prototype b) void type c) double type d) boolean type ix) Convert a number stored in a string variable x to double data type. a) double a = Double.parseDouble(x); b) float a = Float.parseFloat(x); c) double a = x; d) double x; x) If: String x = "Computer"; String y = "Applications"; Which function returns the output? Applicationster b) System.out.println(x.indexOf(x.charAt(4))); c) System.out.println(y + x.substring(5)); d) System.out.println(x.equals(y)); xi) The output ofthe following code block: String strl = "Information Technology"; String str2 = "information technology"; boolean p = strl .equalsIgnoreCase(str2); System.out.println("The result is 't + p); a) false b) true c) Information Technology information technology d) information technology Information Technology xii) Give the prototype of a function search which receives a sentence sentc and a word wrd and returns 1 or 0. a) public float search(String sentc, String wrd) b) public int search(String sentc, String wrd) c) public char search(String sentc, String wrd) d) public String search(String sentc, String wrd) xiii) Which Conversion automatically performed by the Java compiler. a) Explicit xiv) xv) b) Wrapper Class c) Implicit d) Constructor for execution. Java uses a) Compilation and Interpretation b) Only Interpretation d) None of these c) Only Compilation Which among the following representsa syntax error? a) Dividing an integer by zero. b) Accessing an element that is out of bounds of an array. c) Trying to store a value which is incompatible to a certain data-type. d) Missing semicolon ITPS-Std.10-Computer Applications-Second Preliminary Examination-15/01/20241 This paper consists of 5 printed pages. 2/5 Consider the following code snippet and select the output of the same. chur opn = opn = opn = 'a'; switch (opn) break; case 'a': System.out.println("Platform Independent"); case 'b': System.out.println("ObjectOreinted"); case 'c': System.out.println("Robust and Secure"); default: System.out.println("Wrong Input"); a) Platform Independent c) Object Oriented Robust and Secure b) Platform Independent Wrong Input Object Oriented Robust and Secure and Wrong Input d) default in the actual parameter is The technique in which the change in the formal parameter gets reflected known as c) Call by Argument d) Call by Method a) Call by Reference b) Call by Value xvii) xviii) Which of the following is a Composite data type? d) String c) float b) char a) int xix) The number of bits occupied by the ASCII value A are: d) 16 bits c) 8 bits b) 4 bits a) 32 bits xx) Which'method is bound to class but not the instance? c) Static method b) Wrapper class a) Non-Static method Question 2. d) String method [2] (A2 + B2 + C2) i) Write down Java expression for: T = ii) What will be the result stored in x after evaluating the following expression? [2] int x = 4; iii) Convert following do-while loop into for loop. [2] int i = 1; int d = 5; do { System.out.println(d); i++ ; } while ( i<=5); iv) [2] Give the output of the following stored in the variable chr. a) To extract the last character of a word(wd) given b) To replace the word "old" with the word "new" in a String st = "old is always old" v) Rewrite the following program segment using if-else statements instead of the ternary operator: is possible"; T = (x + y < z Il x + z <= y Ify + z <= x) ? "Triangle is not possible": "Triangle ITPS-Std.10-Computer Applications-Second Preliminary Examination-15/01/20241 This paper consists of 5 printed pages. 3/5 [2] vi) Analyze the following program segment and determine how many times the body of the loop will be executed, also write down the code walk through. [21 while(x y) System.out.println(y); vii) What will be the output for the following: String nl "46", n2 = "64"; int total = Integer.parselnt(nl) + Integer.parseInt(n2); System.out.println("The sum of " + "46 " + "and" + " 64" + " is " viii) ix) x) + total); Declare and instantiate a one-dimensional int array named evenNums with five elements. Use an initialiser list that contains the first five even integers, starting with I I and print 4thelement. [2] Answer the following: a) A Keyword used to call a package in the program. b) What are the two ways of invoking functions? Write the output: [2] [2] char ch = 'F'; int m = ch; m=m+5; System.out.println(m + " " + ch); SECTION B 160 (Attempt any four questions from this Section.) The answers in this Section should consist of the Programs in either Blue J environment orany program environment with Java as the base. Each program should be written using Variabledescriptions/ 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 called ParkingLot with the following description: Class name : ParkingLot int vno : To store the vehicle number int hours To store the number of hours the vehicle is parked in the parking lot double bill To store the bill amount Methods void input() : To input the vno and hours void calculate( ) To compute the parking charge at the rate O for the first hour or the part thereof and ? I .50 for each additional hour or part thereof. void display() : To display the detail Write a main method to create an object of the class and call the above methods. (TPS-Std.10-Computer Applications-Second Preliminary Examination-15/01/20241 This paper consists of 5 printed pages. 4/5 Question 4. [151 Write a program to input 10 integer elements in an array and sort them in descending order using bubble sort technique. Question 5. Design a class to overload a method Number() as follows: (i) void Number(int num, int d) To count and display the frequency of a digit in a number. Example: num = 2565685 Frequency of digit 5 = 3 (ii) void Number(int nl) To find and display the sum of even digits of a number. Example: nl = 29865 Sum of even digits = 2 + 8 +6= 16 Write a main method to create an object and invoke the above methods. Question 6. Write a program to accept a string. Convert the string into upper case letters. Count and output the number of double letter sequences that exist in the string. Sample Input: "SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE" Sample Output: 4 Question 7. [15] Write a program to accept the names of 10 cities in a single dimensional string array and their STD (Subscribers Trunk Dialing) codes in another single dimension integer array. Search for the name of a city input by the user in the list. If found, display "Search Successful" and print the name of the city along with its STD code, or else display the message "Search unsuccessful, no such city in the list". Question 8. [15] Write a Java program to find the maximum and minimum value of an array. ITPS-Std.10-Computer Applications-SecondPreliminary Examination-15/01/20241 This paper consists of 5 printed pages. 5/5
|