Question: Q1.Which of the following do not require an object reference when referred in other classes and can be accessed by using class name only? a.

Q1.Which of the following do not require an object reference when referred in other classes and can be accessed by using class name only?

a. constants

b.instance variables and methods

c.static variables and methods

d.private attributes

Q2. Which of the following loops will execute at least one time, even if the condition is false?

a. while

b. do-while

c. for

Q3. What will be the output of the following code

String s;

System.out.println(s);

a. 0

b. null

c.0.0

d. 1

Q4. When a method calls another, which of the following is always pushed onto the system stack?

a.return address which is the address of the instruction following the method call

b. address of the call statement

c. callee's starting address

Q5 What is the problem with the following code

public class Test{

public void testMethod(){

MyObject obj;

obj.method1();

}

}

a. obj does not refer to a valid object in the memory as "new" was not used to create the object

b. there is no problem

c. Objects cannot be local members of a method

d. method1() is not defined in the class Test

Q6.What is the correct way of taking inputs in a java program from a file?

a. javac echo.java

b. java echo>input.txt

c. java echo

d. java echo "a" "b" "c"

Q7. Size of an array can be changed after the array has been intialized?

a. True

b.False

Q8.What will be the value of y in the following?

int y,a=13,b=8;

y=(a>b)?a++:--b'

a.7

b.8

c.14

d.13

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!