Within a class a class method cannot refer to instance varia

Within a class, a class method cannot refer to instance variables.

True

False

1 points   

QUESTION 2

All methods in Java must be a member of a class.

True

False

1 points   

QUESTION 3

A static method is always a class method, and so can be used regardless of whether any objects of the class have been created.

True

False

1 points   

QUESTION 4

Braces encompass the header and body of a class definition.

True

False

1 points   

QUESTION 5

You cannot create an equivalent loop using a for() statement in place of a while() statement.

True

False

1 points   

QUESTION 6

Only the Java Virtual Machine (JVM) needs to be specific to an operating system. All class code can be moved to a different system and still execute.

True

False

1 points   

QUESTION 7

Java is an extension of HTML, as in JavaScript.

True

False

1 points   

QUESTION 8

Return data types are not allowed for constructors, not even void.

True

False

1 points   

QUESTION 9

In Java, the literal constant, 3.14159, would be stored as type float, just as with C/C++.

True

False

1 points   

QUESTION 10

The default access specifier for a class is public.

True

False

1 points   

QUESTION 11

You may not nest one block of code within another.

True

False

1 points   

QUESTION 12

Although usually not the case, an object may be referenced by more than one reference variables at the same time.

True

False

1 points   

QUESTION 13

Unlike C/C++, array bounds are checked in Java.

True

False

1 points   

QUESTION 14

To determine the size of a variable, use the sizeof() operator, just like C/C++.

True

False

1 points   

QUESTION 15

A char data type in Java is two bytes, not one.

True

False

1 points   

QUESTION 16

Both variables declared as parameters in a method header, and those declared within a method body, are local to the method and thus allocated temporarily.

True

False

1 points   

QUESTION 17

An int data type in Java, as with C/C++, may be 2 or 4 bytes.

True

False

1 points   

QUESTION 18

All arrays have a data member called length.

True

False

1 points   

QUESTION 19

In Jave, variables of type boolean have only the values true or false, not 0 or non-zero.

True

False

1 points   

QUESTION 20

Although not required, it is an accepted programming convention to name variables using all lowercase and only capitalizing the first character of concatenated words, as in initialPayRate.

True

False

Solution

QUESTION 1

Within a class, a class method cannot refer to instance variables.

Answer:     False

QUESTION 2

All methods in Java must be a member of a class.

Answer       : True

QUESTION 3

A static method is always a class method, and so can be used regardless of whether any objects of the class have been created.

Answer:      True

QUESTION 4

Braces encompass the header and body of a class definition.

Answer:      False

QUESTION 5

You cannot create an equivalent loop using a for() statement in place of a while() statement.

Answer      : False

QUESTION 6

Only the Java Virtual Machine (JVM) needs to be specific to an operating system. All class code can be moved to a different system and still execute.

Answer       : True

QUESTION 7

Java is an extension of HTML, as in JavaScript.

Answer:      False

QUESTION 8

Return data types are not allowed for constructors, not even void.

Answer       : True

QUESTION 9

In Java, the literal constant, 3.14159, would be stored as type float, just as with C/C++.

Answer       : true

Explanation : a literal constant can be stored in a float type but not directly. Either we have to write f or F at the end of literal or use type casting.

Ex: float a=3.14159;                      wrong

float a=3.14159f;                    correct

float a=(float)3.14159;             correct

QUESTION 10

The default access specifier for a class is public.

Answer       : False

Explanation: In this case, the class is called package access/private. It means the class can be accessible in any where within the same package.

QUESTION 11

You may not nest one block of code within another.

Answer      : False

QUESTION 12

Although usually not the case, an object may be referenced by more than one reference variables at the same time.

Answer       : True

QUESTION 13

Unlike C/C++, array bounds are checked in Java.

Answer       : True

QUESTION 14

To determine the size of a variable, use the sizeof() operator, just like C/C++.

Answer       : False

QUESTION 15

A char data type in Java is two bytes, not one.

Answer      :True

QUESTION 16

Both variables declared as parameters in a method header, and those declared within a method body, are local to the method and thus allocated temporarily.

Answer       : True

QUESTION 17

An int data type in Java, as with C/C++, may be 2 or 4 bytes.

Answer       : false

QUESTION 18

All arrays have a data member called length.

Answer       : True

QUESTION 19

In Jave, variables of type boolean have only the values true or false, not 0 or non-zero.

Answer       : True

QUESTION 20

Although not required, it is an accepted programming convention to name variables using all lowercase and only capitalizing the first character of concatenated words, as in initialPayRate.

Answer       : True

Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1
Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1
Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1
Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1
Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1
Within a class, a class method cannot refer to instance variables. True False 1 points QUESTION 2 All methods in Java must be a member of a class. True False 1

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site