Solved MCQ on Fundamental of Java Language set-14


1) Which of the following statement is/are true?
i) The name of a java program file must match the name of the class with the extension .java
ii) Two methods cannot have the same name in java

A. i- only

B. ii- only

C. Both i and ii

D. None of the above


2) Which of the following represent(s) of a hexadecimal number?

A. 570

B. (hex)5

C. 0X9F

D. 0X5


3) ........ can appear only where in the body of a java method.

A. definition

B. declaration

C. determine

D. package


4) State whether the following statement are True or False?
i) The modulus operator(%) can be used only with integer operands
ii) Declarations can appear anywhere in the body of a java method

A. i-True, ii-False

B. i-False, ii-True

C. i-True, ii-True

D. i-False, ii-False


5) Which of the following will produce a value of 22 if x=22.9?

A. ceil(x)

B. round(x)

C. rint(x)

D. abs(x)


6) ........ is passed to a method by use of call by reference.

A. Variables

B. Objects

C. Methods

D. Operators


7) Using the keyboard interface you can fully abstract a ...

A. Method

B. Keyword

C. Class

D. Variables


8) State True or False for the following statements in java.
i) All the bitwise operators have same level of precedence in java
ii) The default can is always required in the switch selection structure.

A. i-True, ii-False

B. i-False, ii-True

C. i-True, ii-True

D. i-False, ii-False


9) Java is designed for .......... environment of the Internet.

A. Development

B. Deduction

C. Distributed

D. Web Design


10) Which of the following will produce a value of 10 if x=9.7?

A. floor(x)

B. abs(x)

C. rint(x)

D. round(x)

11) Variable declared as ......... do not occupy on a per instance basis.

A. Static

B. Final

C. Abstract

D. Code


12) Which of the following is not keyword?

A. NULL

B. implements

C. protected

D. switch


13) The ...... statement is used to terminate a statement sequence.

A. Break

B. Switch

C. Continue

D. Wait


14) Multidimensional arrays are actually ......

A. Arrays of element

B. Arrays of variable

C. Arrays of arrays

D. Arrays of variable


15) Which of the following keywords are used to control access to a class member?
i) default ii) abstract iii) protected iv) interface v) public

A. i, ii and iii only

B. ii, iii and iv only

C. iii, iv and v only

D. ii, iii and v only


16) ....... is used for initialize the value to the string object.

A. Character literals

B. String literals

C. String group literals

D. Group literals


17) Which of the following methods can be used to remove a component from the display?

A. delete()

B. remove()

C. disappear()

D. hide()


18) Which of the following statements are valid array declaration?
i) int number(); ii) float average[ ];
iii) double[]marks; iv) counter int[];

A. i and ii

B. ii and iii

C. iii and iv

D. All i, ii, iii and iv


19) Which of the following methods belong to the String class?

A. length()

B. CompareTo()

C. equals()

D. substring()

E. All of the above


20) Which of the following in NOT represent legal flow control statements?

A. break;

B. break();

C. continue outer;

D. return;


Answers:

1) A. i- only
2) A. 570
3) B. declaration
4) B. i-False, ii-True
5) C. rint(x)
6) B. Objects
7) C. Class
8) D. i-False, ii-False
9) C. Distributed
10) D. round(x)
11) B. Final
12) A. NULL
13) A. Break
14) C. Arrays of arrays
15) D. ii, iii and v only
16) B. String literals
17) D. hide()
18) B. ii and iii
19) E. All of the above
20) B. break();

Related Posts: