Computer Applications
Class-X
Total Mark-40
Time-60 min Section-A [1X20=20]
1. Name the below structure: 5. Which of the following data type cannot be
used with switch case construct?
i. int
ii. char
iii. String
iv. double
6. Method which reverses a given number is:
i. One dimensional array i. Impure method
ii. Two Dimensional array with 4 rows and 5 ii. Pure method
columns
iii. Constructor
iii. Three dimensional array
iv. Destructor
iv. Two Dimensional array with 5 rows and 4
columns
7. Which of the following mathematical methods
returns only an integer?
2. The output of the statement
"CONCENTRATION".indexOf('T') is: i. Math.ceil(n)
i. 9
ii. Math.sqrt(n)
ii. 7
iii. Math.floor(n)
iii. 6
iv. Math.round(n)
iv. (-1)
8. Method that converts a character to uppercase is
3. The output of the statement ............... .
"talent".compareTo("genius") is:
i. 11
i. toUpper()
ii. –11
ii. ToUpperCase()
iii. 0
iii. toUppercase()
iv. 13
iv. toUpperCase(char)
4. The extension of a Java source code file is:
9. A single dimensional array contains N elements.
What will be the last subscript?
i. exe
ii. obj i. N
iii. jvm ii. N-1
iv. java iii. N-2
iv. N+1
10. The keyword used to call package in the program: 16. Ternary operator is a:
i. extends i. logical operator
ii. export ii. arithmetic operator
iii. import iii. relational operator
iv. package iv. conditional operator
11. The absence of which statement leads to fall 17. The output of "Remarkable".substring(6) is:
through situation in switch case statement?
i. continue i. mark
ii. break ii. emark
iii. return iii. marka
iv. System.exit(0) iv. able
12. The String class method to join two strings is: 18.Name the package that contains wrapper
i. concat(String) classes:
ii. <string>.joint(string)
i. java.lang
iii. concat(char)
ii. java.util
iv. Concat() iii. java.io
iv. java.awt
13. int x = (int)32.8;
is an example of ............... typecasting.
19.The method compareTo() returns ...............
i. implicit
when two strings are equal and in lowercase :
ii. automatic
iii. explicit i. true
iv. coercion ii. 0
iii. 1
14. When an object of a Wrapper class is converted to iv. false
its corresponding primitive data type, it is called
as ............... . 20. Assertion (A): In Java, statements written in
i. Boxing lower case letter or upper case letter are treated
ii. Explicit type conversion as the same.
iii. Unboxing
Reason (R): Java is a case sensitive language.
iv. Implicit type conversion
i. Both Assertion (A) and Reason (R) are
15. Method which is a part of a class rather than an true and Reason (R) is a correct explanation of
instance of the class is termed as: Assertion (A).
i. Static method
ii. Non static method ii. Both Assertion (A) and Reason (R) are true
iii. Wrapper class and Reason (R) is not a correct explanation
iv. String method of Assertion (A).
iii. Assertion (A) is true and Reason (R) is
false.
iv. Assertion (A) is false and Reason (R) is
true.
Section-B [2X10=20]
1. Evaluate the given expression when the value of 7. String x[] = {"Artificial intelligence", "IOT",
a=2 and b=3. "Machine learning", "Big data"};
b*=a++ - ++b + ++a; Give the output of the following statements:
System.out.println("a= "+a); a) System.out.println(x[3]);
System.out.println("b= "+b); b) System.out.println(x.length);
2. Write the output of the following String methods:
8. Convert the following if else if construct into
String x= "Galaxy", y= "Games"; switch case
(a)System.out.println(x.charAt(0)==y.charAt(0)); if( var==1)
System.out.println("good");
(b) System.out.println(x.compareTo(y));
else if(var==2)
3. Consider the following program segment and System.out.println("better");
answer the questions given below: else if(var==3)
int x[][] = { {2,4,5,6}, {5,7,8,1}, {34, 1, 10, 9}}; System.out.println("best");
else
(a) What is the position of 34? System.out.println("invalid");
(b) What is the result of x[2][3] + x[1][2]?
9. Consider the following String array and give the
4. The following code segment should print "You output
can go out" if you have done your homework (dh)
and cleaned your room (cr). However, the code has String arr[]= {"DELHI", "CHENNAI",
errors. Fix the code so that it compiles and runs "MUMBAI", "LUCKNOW", "JAIPUR"};
correctly. System.out.println(arr[0].length() > arr[3].length());
boolean dh = True; System.out.print(arr[4].substring(0,3));
boolean cr= true;
if (dh && cr)
10. State the output when the following program
System.out.println("You cannot go out"); segment is executed:
else
System.out.println("You can go out"); String a ="Smartphone", b="Graphic Art";
5. Give the output of the following String class
methods: String h=a.substring(2, 5);
(a) "COMMENCEMENT".lastIndexOf('M')
String k=b.substring(8).toUpperCase();
(b) "devote".compareTo("DEVOTE")
System.out.println(h);
6. a) Write the return data type of the following
System.out.println(k.equalsIgnoreCase(h));
functions: startsWith() & random()
b) Arrange the following primitive data types in
an ascending order of their size:
(i) char (ii) byte (iii) double (iv) int