Find a Language Amigo
Guaranteed to help you learn a new language without years of studying.
![]() |
![]() |
|
Java Programming : Language Basics : True or False
| Answer the following questions about basics of the Java programming language. These include concepts like operators, variables, declarations, basic language structures such as if, for, switch, etc. |
1. False The modulus operator (%) may be used with floating-point as well as integer types. It returns the remainder of a division operation, e.g., 10 % 6 will return 4.
2. False They can appear anywhere within the body of the method.
3. False All operations in Java, including the bitwise operations, are carried out with a definite precedence.
4. True The shift operation "y1 >>> y2" is identical to "y1 >> y2" for all positive values of y1. It shifts the bits in y1 to the right by y2 positions.
5. True the statement is equivalent to: if (a > b) x = a; else x = b;
6. True If the first expression is false, the result of the "&&" operation will always be false regardless of the second expression. The "&" operator on the other hand forces the evaluation of the second expression even if the first expression is false.
7. False If y >= z is false, then there is no need to evaluate the second expression.
8. False The default case in a switch structure is optional and only used when none of the other cases match.
9. False For the result of a "&&" operation to be true, both operands must be true.
10. False The break statement, which brings the computation out of the "switch" selection structure, is not required for the defalut case.
11. False Any variable declared within a block statement such as a for or if cannot be referenced outside the block.
12. False All elements of an erray must be of the same type. However, it is possible to declare an array of objects, which may of instances of different classes.
13. True Individual elements of an array of this type are passed by value as a parameter to a method. Any changes to them in the method will not change the value of the array element.
14. False Objects of a subclass may be assigned to a super class reference. Food for thought: is there a loss in functionality when this is done?
15. True Objects of a super class may not be assigned to a sub class reference. Food for thought: why is it so?
16. False String objects must be compared using the "equals" method of one of the objects. Food for thought: will the == operator ever return true when two string objects are compared using it?
Related Keywords :-
java programming language , javascript programming , java applets sample , java applets examples , java , java dynamic arrays , javascript arrays , arraylist , java api , flash , java operations , java methods , java game programming , javascript array length , javascript multidimensional arrays , javascript array functions
|
|
Syvum in other languages: French, Spanish, Portuguese
|