Java Programming Questions and Answers Set 16

Java Programming OOPs

Questions 151 to 160



151.
Select the correct statement from among the following:
(a)   Java language was developed by  Micro Soft
(b)   Java language was developed in 1990
(c)   Java language was written by James Bond
(d)   The initial name given for Java is Oak
(e)   The project which developed Java is called Grand project.
152.
Consider the following program written in Java:
class Three{
public static void main(String three[])
{
System.out.println("Hello");
}
}
Select from among the following, a suitable name which can be used as the source file name.

(a) Hello.java           (b) three.java           (c) Three.java           (d) Three.class    (e) three.class.
153.
Java Bytecode is
(a)   the Java virtual machine version of machine code.
(b)   known as the Java interpreter or Java run time.
(c)   a set of programming statements entered into a text editor by a programmer.
(d)   similar to machine code which is  specific to any processor.
(e)   not an additional layer in-between the source code and the machine code.
154.
Breaking down a large complex procedure into a number of smaller procedures is referred to as
(a) data structures                                  (b) top down decomposition.
(c) structured programming.                   (d) lists.
(e) amateur programming.
155.
Consider the following statements on global data:
Global data
(i)    can be accessed by a number of procedures.
(ii)    is defined within an outer procedure and may then be shared by the inner procedure.
(iii)   encourages the need to pass the data from one procedure to another.
(iv)   causes inconsistencies when shared by procedures.
Choose the incorrect statement from among the above.
(a) Only (i) is incorrect                            (b) Both (i) and (ii) are incorrect
(c) Only (ii) is incorrect                           (d) Both (iii) and (iv) are incorrect
(e) Only (iii) is incorrect.
156.
Consider the following variable declarations:
int i;
float j;
boolean k;
Which of the following is correct initialization?
(a) i = 1; j = 1.0; k = true;                        (b) i = 1; j = 1.0f; k = true;
(c) i = 1; j = 1.0f; k = “true”;                     (d) i = 1; j = 1.0; k = “true”;
(e) i = 1; j = 1.0f; k = True;
157.
Use the following declarations and initializations to evaluate the Java expressions:
(Please note that each expression has been tested separately.)
int i=3, j=7, k=11;
7) j + k % i

(a) 9                        (b) 0                        (c) 7                        (d) 12                      (e) 10.
158.
Use the following declarations and initializations to evaluate the Java expressions:
(Please note that each expression has been tested separately.)
int i=3, j=7, k=11;
++k –i +i + i++

(a) 16                      (b) 17                      (c) 14                      (d) 13                      (e) 15.
159.
Use the following declarations and initializations to evaluate the Java expressions:
(Please note that each expression has been tested separately.)
int i=3, j=7, k=11;
j * k++ /2

(a) 38.5                   (b) 42                      (c) 38                      (d) 42.0                   (e) 42.5.
160.
Consider the following Java program:
public class MyClass {
private int myVlaue = 5;
public void printMyVlaue() {
System.out.println(myVlaue);
}
public void setMyVlaue(int myVlaue) {
System.out.println(myVlaue);
this.myVlaue = myVlaue;
}
public static void main(String[] args) {
MyClass myClass1 = new MyClass();
myClass1.setMyVlaue(10);
myClass1.printMyVlaue();
}
}
Which of the following will the output be?
(a)   5      10
(b)   10    10
(c)   10    5
(d)   5      5
(e)   15    5


Answers


151.
Answer : (d)
Reason : Remaining all are irrelevant as java was developed by sun,1991etc
152.
Answer : (c)
Reason : Source files are to stored using .java extension and Class Name would be preferably the source file name with case sensitivity.
153.
Answer : (a)
Reason : The virtual machine version of machine code is java byte code. It is not java interpreter or set of.
154.
Answer : (b)
Reason : According to OOPS it is termed as top down compostion. Remaining all relate to different concepts
155.
Answer : (e)
Reason : All are the properties of global data whereas the third statement is incorrect.
156.
Answer : (b)
Reason : is the appropriate form of initialization. remaining all are incorrect.
157.
Answer : (a)
Reason : k%i is 2 and j+2=9.
158.
Answer : (e)
Reason : Based on the hierarchy of operations (e) is the correct answer.
159.
Answer : (c)
Reason : Based on the hierarchy of operations 38 is the correct answer
160.
Answer : (b)
Reason : Based on the methods call the out put is 10 10.


<< Prev   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22  

 23   24   25   26   27   28   29   30  Next >>


No comments :

What you think about these Questions and Answers ? Let me know in comments.

Post a Comment