Computer Important One Words
Computer Important One Words
Page 1 of 5
(xv)Assertion (A): To call abs() method no object or class name is
required. Reason (R): All methods of Math class are class methods.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation
explanationof Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation
ofAssertion (A)
(xvi) Go through the following text and choose the correct answer:
Selection statements help in selecting one alternative
alternative out of more than one options. They are also
called decision-making statements as the computer needs to take a decision while executing
these statements as per the conditions provided. The output of the program depends upon the
statement selected by the computer based on the validity of the condition.
Page 2 of 5
[20]
2. Choose the correct
correct answers
answers
(i)
(b) Float-->4,Double-->8
(c) Float-->8,Double-->16
(d) None of these
(d) .doc
(c) 6.0
(d) 9.0
(viii) Assertion(A): The base class and
and derived class are the terms used in abstraction.
Reason(R): the concept of extending a class to obtain another class is called inheritance.
(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
Reason (R) is false
(d) Assertion (A) is false and Reason (R) is true
(xi) Which of the following data types can have only one value at a time?
(a) Primitive
(b) Reference
(c) Abstract
(d) Import
Page 4 of 5
(c) return(s,p);
(d) return (4);
(xiii) What makes the two or more functions having the same name different?
(a) Number of arguments
(b) Type of arguments
(c) a&b
(d) All of the above
(xiv) Which of the following is a correct prototype of a function check which receives a
character ch and integer n and returns true or false?
(a) pubic int check( char ch,int n);
(b) public boolean chk(char ch, int n);
(c) public boolean check(char ch, integer n);
(d) public boolean check( char ch, int n);
(xv) Which type of the function increases the value of its return type b
byy 1, each time the
function is called:
(a) Non-static function
(b) Static function
(c) Impure function
(d) None of the above
(xviii) The statement that converts the string object s=”400” to integer “s_int” is
................
(a) s_int=Integer.parse(s);
(b) s_int=Integer.Int(s);
(c) s_int=Integer.parseInt(s);
(d) s_int=integer.parseInt(s);
Page 5 of 5
(xix) The second last element
element of an array of size 100, has index:
(a) 97
(b) 99
(c) 98
(d) 100
(a) 40
(b) 30
(c) 39
(d) 29
3. Choose the correct
correct answers
answers
(a) Encapsulation
(b) Inheritance
(c) Abstraction
(d) Polymorphism
(ii) How many bytes of memory will the following array use? double b[ ] = new double[6];
(a) 48 bytes
(b) 24 bytes
(c) 48 bits
(d) 24 bits
(iii) Give the output of the following statements:
String x[ ] = {"Apple", "Blueberry", "Grapefruit", "Tomato", "Watermelon
"Watermelon"};
"};
System.out.println(x[3].length());
(a) 10
(b) 5
(c) 6
(d) 9
Page 6 of 5
(iv) The output of Math.roun
Math.round(6.6)
d(6.6) + Math.ceil(3.4)
Math.ceil(3.4) is:
(a) 9.0
(b) 11.0
(c) 10.0
(d) 11
(v) Which of the following
f ollowing is a valid Integer constant:
1. 4
2. 4.0
3. 4.3f
4. “four”
(a) Only 1
(b) 1 and 4
(c) 2 and 4
(d) 1 and 2
(vi) The _________ are the words which have special meaning
(c) Methods
(d) Package
(vii) What is true about do while looping statement?
(c) do while statement checks the condition at the beginning of the loop
(d) do while statement executes the code more than once always
(a) int
(b) void
(c) float
(d) null
(ix) Name the search algorithm
algorithm which compares the sought key value with the key value of middle
element of the array at each stage.
(a) Bubble sort
(b) Linear search
(a) Red
(b) Orange
Blue
(c) White
(d) Blue
(a) Orange
Blue
(b) OrangeBlue
(c) Orange
(d) Blue
(xii) Which of the followin
f ollowing
g statement contains an error?
(a) 0
(b) 1
(c) 2
Many
(d)
(xiv) What will be the output of the following program?
int count = 1; while (count
(count <= 15) {
System.out.println(count
System.out.printl n(count % 2 == 1 ? "***" : "+++++"); ++count;
} // end while
(a) 15 times ***
(c) 8 times *** , 7 times +++++ (d) both will print only once
Page 8 of 5
(xv) Consider the following class: class Test { public static voidvoid swap(int i, int
int j) {
int temp=i;
i = j; j = temp;
}
public static void
void main(String[]
main(String[] args) { int i=10,j=20;
i=10,j=20;
swap(i, j);
System.out.println("i
System.out.printl n("i = " + i + ", j = " + j);
}}
(a) i=10,j=20
(b) i=20,j=10
(c) i=10,j=10
(d) i=20,j=20
(xvi) Which of these jump statements can skip processing the remainder of the code in its body for a
particular iteration?
(a) break
(b) return
(c) System.exit(0)
(d) continue
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a
correct explanation of Assertion (A)
(c) Assertion (A) is false
false and Reason (R) is true
Page 9 of 5
(xix) Assertion(A): do while
while loop is executed atleast
atleast once ev
even
en if it’s condition
condition is false.
Reason(R): A do while loop tests condition before entering the loop body.
(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)
Page 10 of
(vii) Which of the following is a keyword?
(a) token (b) continue (c) constant (d) all of these
(viii) Name the method u
(viii) used
sed to convert String va value
lue into int?
(a) ParseInt() (b) parseInt() (c) parseInteger (d) none of
these
(ix) The ……… allows a class to use property of another class.
(a) Encapsulation (b) Abstraction (c) inheritance (d) None of these
(x) The ……… operator is used to access method of a class.
(a) Object (b) new (c) (.)dot (d) import
(xi) The statement System.out.println(1+2+“four
System.out.println(1+2+“four ”+2+3); gives the output………
(a)3 four 5 (b)(b)3
3 four 23 (c) 12 four 23 (d) error
(xii) x + = x++ + --x + --x + x; [ x = 5 ]
(a) 23 (b) 20 (c) 18 (d) none of these
(xiii) Math.pow(Math.ceil(4.22), Math.cbrt(8));
(a) 16 (b) 25 (c) 25.0 (d)16.0
(xiv) Consider the following String array and give the output:
String arr[ ]={"Java", "PHP", "Python", ".Net", "HTML"};
System.out.print( arr[2].charAt(2)+”
arr[2].charAt(2)+” “+arr[3].indexOf(‘N
“+arr[3].indexOf(‘N’));
(a) h -1 (b) H 1 (c) t 1 (d) Runtime Error
(xv) Predict the output of the following statement:
String wd[ ] = {"INDIA", "USA", "NEPAL", "GERMANY", "MEXICO"};
System.out.println(wd[2].substring(0,3) + wd[4].substring(4));
(a) USANY (b) MEXPAL (c) NEPCO (d) INDNY
(xvi) The return data type of Integer.parseInt( ) method is ________ .
(a) String (b)) int
(b (c) void (d) Integer
(xvii) Which of the following is not a type of inheritance?
(a) multiple (b) double (c) hybrid (d) single
(xviii) Corresponding wrapper class of the char data type is?
(a) String (b) Character (c) Char (d) CHARACTER
(xix) The process to change one data type value to another data type is known as
(a)Declaration (b)Type
(b)Type conversion (c) Converting data type (d)Initialising data type
(a ) a) Encapsulation
Encapsulation (b) Data Abstraction (c) Polymorphism
Polymorphism (d) Inheritance
(ii) The code that operates on the data of an object is termed as:
(a) a) Member function (b) Class (c) Object program (d) Message
(b) (iii) Which of the following is not a token ?
(a) Keyword (b) Identifier (c) Procedure (d) Operator
Page 11 of
(iv) Which operator among the following is unary ?
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 false and Reason (R) is true
(d) Assertion (A) is true and Reason (R) is false
A default constructor
constructor can be defined by:
(a) Java system only (b) programmers only
Page 12 of
(xvi) Assertion (A): All relational operators are binary in nature.
Reason (R): Logical Not (!) operates on only one boolean value.
(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)
Page 13 of