The document contains questions and answers about Java arrays. It discusses array declaration, initialization, element types, naming conventions, memory allocation, default element values, and element positions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views1 page
0 - Javamcq Part1 42
The document contains questions and answers about Java arrays. It discusses array declaration, initialization, element types, naming conventions, memory allocation, default element values, and element positions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
68-we should not specify the array size if declaration and initialization are done at the same
time. (true / false)
a) false b) true c) - d) – ans: b 69-if an index of an element is n, what is its actual position in the array? a) n-1 b) n c) n+1 d) n+2 ans: c 70-an array in java can be declared only of some predefined types. (true/false) a) false b) true c) - d) – ans: a 71-the name of an array variable or identifier can start with ___. a) a letter b) underscore ( _ ) c) dollar symbol ($) d) all ans: d 72-shorthand array initialization in java needs the keyword "new" to allocate memory to the array and elements. state true or false. a) false b) true c) - d) – ans: a 73-lazy initialization of array requires the keyword "new" to allocate memory to the array and its elements. state true or false. a) false b) true c) - d) – ans: b 74-what is the default value of an element of object type array? a) 0 b) null c) -1 d) garbage value ans: b 75-what is the default value of byte, short, int or long data type elements of an array in java? a) -1 b) 1 c) 0 d) garbage value