Page 492 - CA_Blue( J )_Class10
P. 492
vi. The output of the following code is:
System.out.println(Math.ceil(6.4)+Math.floor(-1-2));
a. 3.0 b. 4
c. 3 d. 4.0 [Analysis]
Ans. d. 4.0
vii. Which of the following returns a String?
a. length() b. charAt(int)
c. replace(char, char) d. indexOf(String) [Understanding]
Ans. c. replace(char, char)
viii. Which of the following is not true with regards to a switch statement?
a. checks for an equality between the input and the case labels
b. supports floating point constants
c. break is used to exit from the switch block
d. case labels are unique [Understanding]
Ans. b. supports floating point constants
ix. Consider the array given below:
char ch[]={ 'A', 'E', 'I', 'O', 'U'};
Write the output of the following statements:
System.out.println(ch[0]*2); [Analysis]
a. 65 b. 130
c. 'A' d. 0
Ans. b. 130
x. To execute a loop 10 times, which of the following is correct?
a. for (int i=11;i<=30;i+=2) b. for (int i=11;i<=30;i+=3)
c. for (int i=11;i<20;i++) d. for (int i=11;i<=21;i++) [Analysis]
Ans. a. for (int i=11;i<=30;i+=2)
xi. A single dimensional array has 50 elements, which of the following is the correct statement to initialize the last element to
100.
a. x[51]=100 b. x[48]=100
c. x[49]=100 d. x[50]=100 [Analysis]
Ans. c. x[49]=100
xii. Method prototype for the method compute which accepts two integer arguments and returns true/false.
a. void compute (int a, int b) b. boolean compute (int a, int b)
c. Boolean compute (int a,b) d. int compute (int a, int b) [Understanding]
Ans. b. boolean compute (int a, int b)
xiii. The statement that brings the control back to the calling method is:
a. break b. System.exit(0)
c. continue d. return [Recall]
Ans. d. return
xiv. The default value of a boolean variable is:
a. False b. 0
c. false d. True [Recall]
Ans. c. false
xv. The method to convert a lowercase character to uppercase is:
a. String.toUpperCase( ) b. Character.isUppercase ( char )
c. Character.toUpperCase( char ) d. toUpperCase ( ) [Recall]
Ans. c. Character.toUpperCase( char )
xvi. Assertion (A): Integer class can be used in the program without calling a package.
Reason (R): It belongs to the default package java.lang.
a. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
b. Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion(A)
c. Assertion (A) is true and Reason (R) is false
d. Assertion (A) is false and Reason (R) is true [Application]
490490 Touchpad Computer Applications-X

