YPCC ICSE 10th COMP 100 - MCQ File
YPCC ICSE 10th COMP 100 - MCQ File
JMD HGGM
ICSE Class 10th Semester 2
Section A
1
Array → 25Q
Encapsulation → 25Q
Q17→ Write a set of statements that would find and print the size of array.
ar[] = {2,5,6,7,8,9,10};
a. Int len = ar.length;
System.out.println(“The size of array =”+len);
b. int len = ar.length();
System.out.println(“The size of array =”+len );
c. int len = ar.len;
System.out.println(“The size of array =”+len);
d. None of these
Q18→ The first value in the initializer list of an array corresponds to index :
a. 0 b. 1 c. Length -1 d. Length
6 Q22→ If the element 0 an array hold a float, the rest of the pockets will be
of type :
a. int b. float only c. Object d. Any data type
Q26→ The string “Hello boy“ contains …………… characters: Rough work Area
a) 10 b) 9 c) 11 d) None of these
Q28→ A string
a) begins with a null character b) ends with a null character
c) Both of the above d) None of these
Q29→ Which of these operators can be used to concatenate two or more
String objects?
a) + b) += c) & d) ||
Q33→ Which of these method of class String is used to compare two String Rough work Area
objects for their equality?
a) equals() b) Equals() c) isequal() d) Isequal()
8
Q39→ What will s2 contain after following lines of code? Rough work Area
String s1 = "one”;
String s2 = s1.concat("two”)
9 a) one b) two c) onetwo d) twoone
Q46→ Which of the following methods of String class can be used to test to
strings for equality ?
a) isequal() b) isequals()
c) equal() d) equals()
11
Q60→ In the given code, what is the value of res? int res = ‘b’;
a) 97 b) 66 c) 65 d) 98
Q66→ What is the purpose of the below function? Rough work Area
Character. isWhiteSpace ()
a) Checks whether the input is a space
15 b) Checks whether the input is a whitespace
c) Checks whether the input is empty
d) None of these
Q70→ What is the output of the following code? Rough work Area
char c = ‘B’;
int i = 4;
16 System.out.println(c+i);
System.out .println( (int) c + i)
a) 70 b) 102 c) f d) F
70 102 102 70
Q78→ Read the following class and answer the question that follow:
class Calc {
int rno = 10;
String name=“arti jain”;
void display () {
Calc ob1= new Calc();
System.out.println(ob1.rno);
Calc ob2 = new Calc();
System.out.println(ob2.rno);
}
}
Will the objects ob1 and ob2 store different values for rno & name?
Q90→ This type of variable can be used anywhere within a package but
not in the subclasses or outside the package.
a) Local Variable b) Class Variable
c) Default Variable d) Public variable
Q93→ The package that contains Scanner class and its methods :
a) Java.io b) java.lang
c) java.Math d) java.util
Q98→ The function that changes the state of an object is known as:
a) Pure function b) impure function
c) mix function d) Replace function
Q100→ Which of the following type can be used for a not returnable
functions.
a) int b) float c) double d) void