0% found this document useful (0 votes)
30 views

Java Assessment

Uploaded by

s14anj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Java Assessment

Uploaded by

s14anj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Java Assessment Total points 42/60

Core Java

Email *

s14anjana@gmail.com

0 of 0 points

Name *

sanjana Reddy

Answer for the all questions 6 of 6 points

For Switch we cannot pass ____________ data types. * 1/1

long, float, double, String

boolean, float, double, String

long, float, boolean, String

long, float, double, boolean


Which among the following is not a primitive data type in Java? * 1/1

char

String

byte

short

In switch, we can write duplicate cases * 1/1

Yes

No

Can we overload main method in java * 1/1

Yes we can

No we can't

Inside Non-static context * 1/1

can call only Non-static variables directly by its name.

can only call static variables directly by its name.

can call Non-static and static variables directly by its name.

none
what is the output for the given code * 1/1

CTE

205

206

207

10 of 12 points

Non static method will be stored in? * 1/1

Heap Area

Class Static Area

Method Area

Stack Area

None of the above


Choose the syntax to create a Object? * 1/1

Classname obj.ref = classname();

Classname obj.ref = new classname;

Classname obj.ref = new classname();

All of the above

Which is the correct syntax for declaring static data member? * 1/1

a. memberName static dataType;

b. dataType static memberName;

c. static dataType memberName;

d. static mamberName dataType;

What is the extension of file generated by the compile? * 1/1

.class file

.java file

.javac file

.txt
In which area of memory, the system stores parameters and local *1/1
variables whenever a method is invoked?

Heap

Storage Area

Stack

Array

What is the purpose of new keyword? * 1/1

Create a constructor

Create a new class

Create a Object

None of these

How many maximum numbers of objects can be created from a single *1/1
Class in Java?

a. 32

b. 64

c. 128

d. any number of objects


How many primitive data types are there in Java? * 1/1

can you use static variable inside a method block ? * 0/1

Yes

No

The main method should be static for the reason * 1/1

It can be accessed easily by the class loader.

It can be accessed by every method or variable without any hindrance.

It can be executed without creating any instance of the class.

None of the above


Which component is used to compile, debug and execute java program? * 1/1

JVM

JDK

JIT

JRE

When are static variables loaded in memory ? * 0/1

a. during compile time

b. during object creation

c. during the constructor loading

d. None of these

1 of 3 points

12. The default values for float, boolean and string. * 1/1

a. 0.0f, true, 0

b. 0.0, false, null

c. 0.0f, false, null

d. 0, true, bull
14. What is the Output? * 0/1

a. 50.2

b. 10.8

c. 10.8f

d. 50.2f

11. Where will the memory be allocated for static variables * 0/1

a. Class static area and inside the frame in stack area.

b. Inside the Frame in stack area and class static area.

c. Both inside class static area.

d. Both inside stack area.

Section 1 25 of 39 points
Trace the code * 1/1

true

res : True

res : false

res : true

CTE
Trace the code: * 1/1

Be safe

Invalid

Compile Time Error

none of the above

Nested for-loop is possible in java? 1/1

Yes

No
Trace the code: * 1/1

s2 is greater

Both are equals

no output

s1 is greater

What is the minimum iteration of while loop and do while loop * 1/1

0 and 1

1 and 0

1 and 1

0 and 0
Break statement can be used only inside * 1/1

loops

switch

loops and swtich

none of the above

What is the output of the below Java program? * 0/1

localVariable

Compile Time Error

some other output


Trace the code... * 0/1

Class A
{
public static void main (String []args)
{
int i=1;
while (i!=5)
{
if(i%2==0) continue;
System.out.println(i);
i++;
}
}
}

1,3,5

2,4

CTE

5
Choose the correct syntax of the DO WHILE loop in Java below * 1/1

Option 1 Option 2

Option 3 none
What is the output? * 1/1

13579

2 4 6 8 10

2468

output will be from 1 to 10

Choose the correct syntax for the method signature. * 1/1

<methodName>

<methodName>(actual args)

<methodName>(formal args)

All the above


What is the output for the below code * 0/1

10 16

10 15

9 16

9 15
What's the output of given code..? * 0/1

Class A
{
public static void main (String []args)
{
System.out.println(true);
}
}

true

false

CTE

None

which is not an access modifier * 1/1

private

final

protected

default
Trace code * 1/1

CTE

1
Trace the code: * 0/1

value cannot be passed to switch statement

variable cannot be passed to case statement

WORLD

hello
Trace the code: * 1/1

Compiled Successfully, but runtime error

Compiled Successfully, No output

Compile time error

none of the above


Trace the code: * 0/1

Distinction Failed

First Class

Distinction

Just pass

Every loop in Java has a condition that should be __ in order to proceed *1/1
for execution.

true

false
What is the output of the following code snippet? * 0/1

Opp

CTE

4
Trace the code * 1/1

false

true

Error

CTE
What is the output of the Java program with IF-ELSE statements? * 0/1

GO

STOP

COMPLILE TIME ERROR

NONE OF THE ABOVE

What are the keywords used to implement a SWITCH case in Java *1/1
language?

switch, case

default

break

All of the above


Methods are : * 0/1

Block of instruction which are used to perform a specific task.

Transfer the data

both a and b

None of the above

In for loop if the condition is not provided, by default what it will take * 1/1

true

false

Depends on the last executed output

Null

Once the break statement is executed then.... * 1/1

the control will be transfered out of the loop.

the program will be terminated.

the program will continue to execute.

none of the above.


when will the method execute * 1/1

If it is not called

Only if it is called

Both a and b

none of the above

Trace the code * 0/1

10

Compile Time Error

A
Trace the code * 0/1

Infinite loop

CTE

None of the above

What's the output for given line * 1/1


System.out.println(0.1 + 0.2 == 0.3);

true

false

CTE

None
What is the output for the following code * 0/1

11

12

13

10
Trace the code: * 1/1

123

1234

CTE

Choose the Java-Code below with a never-ending loop. * 1/1

while(true);

for(;true;);

do{ }while(true);

All
Is main method is user defined method or pre defined method * 0/1

User defined method

Pre defined method

Is java platform dependent language * 1/1

A. NO

B. option A

I don't know...

Which type of loop is guaranteed to have the body execute at least once? * 1/1

while loop

for loop

do while loop

none
Trace the code: * 1/1

no output

compile time error

JAVA

none of the above


What is the output of the following code * 0/1

630

63

30

In Java language, BREAK or CONTINUE statements can be implemented *1/1


inside a Loop only with the help of _ statements to avoid never-ending
loops.

if else

switch

None

This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy

Forms

You might also like