Formatting page ...
UNISON WORLD SCHOOL, DEHRADUN 2nd Preliminary Examination (2019-2020) Computer Applications Theory: X Time:2 hrs Max Marks: 100 Instructions: Reading Time is 15 min. 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 []. SECTION A (40 Marks) (Attempt all questions) Q.1 (a) (b) (c) (d) (e) Q.2 (a) (b) (c) (d) Q.3 (a) (b) State the differences between: method and constructor class variable and instance variable next( ) and nextLine( ) indexOf( ) and lastIndexOf( ) Math.floor( ) and Math.ceil( ) [2] [2] [2] [2] [2] State the method that: (i) Converts a string to a primitive double data type. (ii) Determines if the specified character (x) is an Upper case character. (iii) Find and display the position of the last space in a string s. (iv) Convert the second character of a string str in upper case. What is exception? Name 2 ways to handle exception. What is base class and derived class? Name the keyword used (i) to inherit a class and (ii) include a package in a class. [4] What will be the output of the following program segments? i) String s = "2.37058"; int n=s.indexOf( . ); int c = Integer.parseInt(s.substring(0, n)); int t = Integer.valueOf(s.substring(n+1)); System.out.println(c); System.out.println(t); ii) String s= Examination ; int a= s.length(); System.out.println(s.startsWith(s.substring(5, a))); System.out.println(s.charAt(2)==s.charAt(6)); iii) int a=20, b=15; if(a>10) {a++; b--; } System.out.println(a+ , +b); What will be the output of the following code? int a=1, b=2, c=3; switch(p) { case 1:a++; case 2: ++b; break; [2] [2] [2] [2] [2] [2] [3]
|