Class 10 Practice 8
Class 10 Practice 8
3) What is the result produced after the following statements are executed:
int a = 2,b, c;
a = a+4;
b = 3*a;
c = a-b;
System.out.println(2+c+c);
(a) 2cc (b) -22 (c) 200 (d) 22
5) The access specifier, return type and function signature together is known as: Function ________
(a) Prototype (b) Signature (c) Definition (d) Call
7) With respect to the input “This is a cat”, what will be the values in ‘x’ and ‘y’ after the execution
of the
following statements:
String x = sc.next();
String y = sc.nextLine();
(a) x=This , y=is (b) x=This , y=is a cat (c) x=This is a , y=cat (d) None of the above
8) What is the return type of the following method: x.equals(y)
(a) yes or no (b) right or wrong (c) All of the above (d) None of the above
12) More than one java statements together is called block/compound statements. They are
enclosed in:
(a) Parenthesis (b) Braces (c) Square brackets (d) /* and */
15) The property of OOP which is implemented through the concept of function overloading
(a) Encapsulation (b) Abstraction (c) Polymorphism (d) Modularity
16) The Java compiler translates Java programs to intermediate level language called:
(a) Machine Language (b) Byte Code (c) System Language (d) Native Executable Code
20) Which of the following can be used when you know the number of times we have to perform a
task:
(a) for loop (b) while loop (c) do-while loop (d) All of the above
22) Which of these coding types is used for data type characters in Java?
a) ASCII b) ISO-LATIN-1 c) UNICODE d) None of the mentioned
24) Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?
a) ASCII b) ISO-LATIN-1 c) None of the mentioned d) Both a & b
26) What is the stored in the object obj in following lines of code?
box obj;
a) NULL
b) Any arbitrary pointer
c) Garbage
d) Memory address of allocated memory of object.
31) What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
a) Integer b) Floating – point numbers c) Boolean d) None of the mentioned
32) Which of the below method of the String class can be used to test string equality?
a) equals()
b) isEqual()
c) isequals()
d) equal()
33) Which of the below method of the String class can be used to find the total number of characters
in the String?
a) chars()
b) size()
c) len()
d) length()
34) 6. What would be the output of the below code related to String equality?
String s = new String("PraBhu");
String p = new String("PraBhu");
System.out.println(s == p);
a) true
b) false
35) Choose the correct output of the below code about String – Character Equality?
Character c = 'A';
String s = "A";
System.out.println(c.equals(s));
a) true
b) false