MCQOPTIONS
Bookmark
Saved Bookmarks
→
Engineering
→
C Programming in Engineering
→
Which three are legal array declarations?
<..
1.
Which three are legal array declarations?
int [] myScores [];
char [] myChars;
int [6] myScores;
Dog myDogs [];
Dog myDogs [7];
A.
1, 2, 4
B.
2, 4, 5
C.
2, 3, 4
D.
All are correct.
Answer» B. 2, 4, 5
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
<p></p><pre><code class="java">class HappyGarbage01 { public static void main(String args[]) { HappyGarbage01 h = new HappyGarbage01(); h.methodA(); /* Line 6 */ } Object methodA() { Object obj1 = new Object(); Object [] obj2 = new Object[1]; obj2[0] = obj1; obj1 = null; return obj2[0]; } } </code></pre> Where will be the most chance of the garbage collector being invoked?
<p>What will be the output of the program? </p><pre><code class="java">public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( "Finally" ); } } } </code></pre>
<p>Which one is a valid declaration of a boolean?</p>
<p>Which one of the following will declare an array and initialize it with five numbers?</p>
<p>Which three are valid declarations of a float? </p><ol class="java-ol-1234"> <li>float f1 = -343;</li> <li>float f2 = 3.14;</li> <li>float f3 = 0x12345;</li> <li>float f4 = 42e7;</li> <li>float f5 = 2001.0D;</li> <li>float f6 = 2.81F;</li> </ol>
<p>Which is a valid declarations of a String?</p>
<p>Which three are legal array declarations? </p><ol class="java-ol-1234"> <li>int [] myScores [];</li> <li>char [] myChars;</li> <li>int [6] myScores;</li> <li>Dog myDogs [];</li> <li>Dog myDogs [7];</li> </ol>
<p>Which three are valid declarations of a char? </p><ol class="java-ol-1234"> <li>char c1 = 064770;</li> <li>char c2 = 'face';</li> <li>char c3 = 0xbeef;</li> <li>char c4 = u0022;</li> <li>char c5 = ' iface';</li> <li>char c6 = ' uface';</li> </ol>
<p>Which is the valid declarations within an interface definition?</p>
<p></p><pre><code class="java">public interface Foo { int k = 4; /* Line 3 */ } </code></pre> Which three piece of codes are equivalent to line 3? <ol class="java-ol-1234"> <li>final int k = 4;</li> <li>public int k = 4;</li> <li>static int k = 4;</li> <li>abstract int k = 4;</li> <li>volatile int k = 4;</li> <li>protected int k = 4;</li> </ol>
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply