MCQOPTIONS
Bookmark
Saved Bookmarks
→
Java Programming
→
Exceptions
→
What will this code print?
1.
What will this code print?
int a[] = new int [10];
System.out.print(a);
A.
Garbage value
B.
00000
C.
value stored in arr[0].
D.
0
E.
None of these
Answer» B. 00000
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the output of this program?<br><pre class="prettyprint lang-c">import java.util.*;<br> public class ArrayExample <br> {<br> public static void main(String args[]) <br> {<br> int arr[] = new int [10];<br> for (int k = 10; k > 0; k--)<br> arr[10 - k] = k;<br> Arrays.sort(arr);<br> for (int k = 0; k < 7; ++k)<br> System.out.print(arr[k]);<br> }<br> }<br></pre>
What will this code print?<br><pre class="prettyprint lang-c"><br>public class array <br> {<br> public static void main(String args[]) <br> {<br> int arr[] = new int [7];<br> System.out.print(arr);<br> } <br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class arr_output <br> {<br> public static void main(String args[]) <br> {<br> char arr_var [] = new char[10];<br> for (int i = 0; i < 5; ++i) <br> {<br> arr_var[i] = 'K';<br> System.out.print(arr_var[i] + " ");<br> }<br> } <br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class output <br> {<br> public static void main(String args[]) <br> {<br> int array[] = new int[] {0 , 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};<br> int num = 10;<br> num = array[array[num] / 2];<br> System.out.println(array[num] / 2);<br> } <br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class multidimention_arr<br> {<br> public static void main(String args[])<br> {<br> int array[][] = new int[5][5];<br> array[0] = new int[1];<br> array[1] = new int[2];<br> array[2] = new int[3]; <br> int sum = 0;<br> for (int i = 0; i < 5; ++i) <br> {<br> for (int j = 0; j < i + 1; ++j)<br> {<br> array[i][j] = j + 1;<br> }<br> }<br> for (int i = 0; i < 5; ++i) <br> {<br> for (int j = 0; j < i + 1; ++j)<br> {<br> sum = sum + array[i][j];<br> }<br> }<br> System.out.print(sum); <br> } <br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class arr_output <br> {<br> public static void main(String args[]) <br> {<br> int arr_var [] = new int[20];<br> for (int j = 0; j < 20; ++j) <br> {<br> arr_var[j] = j;<br> System.out.print(arr_var[j] + " ");<br> j++;<br> }<br> } <br> }<br></pre>
What is the output of below snippet?<br><pre class="prettyprint lang-c"><br>Obj[] names = new String[10];<br>name[0] = new Integer(0);<br></pre>
What will this code print?<br><pre class="prettyprint lang-c"><br>int a[] = new int [10];<br>System.out.print(a);<br></pre>
What is the type of variable b and d in the below snippet?<br><pre class="prettyprint lang-c"><br>int a[], b;<br>int []c, d;<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c"><br>public class arr_output <br> {<br> public static void main(String args[]) <br> {<br> int arr_var[][] = {{ 1, 2, 3, 4}, { 4 , 5, 6, 7}, { 7, 8, 9, 10}};<br> int sum = 0;<br> for (int i = 0; i < 3; ++i)<br> {<br> for (int j = 0; j < 3 ; ++j)<br> {<br> sum = sum + arr_var[i][j];<br> }<br> }<br> System.out.print(sum / 2);<br> } <br> }<br></pre>
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply