| 11. |
Which cause a compiler error?
|
||||||||
|
Answer:
Option (b) |
| 12. |
What is the widest valid returnType for methodA in line 3?
public class ReturnIt
{
returnType methodA(byte x, double y) /* Line 3 */
{
return (long)x / y * 2;
}
}
|
||||||||
|
Answer:
Option (d) |
| 13. |
Which one creates an instance of an array?
|
||||||||
|
Answer:
Option (a) |
| 14. |
Which two cause a compiler error?
1. float[ ] f = new float(3);
2. float f2[ ] = new float[ ];
3. float[ ]f1 = new float[3];
4. float f3[ ] = new float[3];
5. float f5[ ] = {1.0f, 2.0f, 2.0f};
|
||||||||
|
Answer:
Option (d) |
| 15. |
What will be the output of the program?
class Test
{
public static void main(String [] args)
{
Test p = new Test();
p.start();
}
void start()
{
boolean b1 = false;
boolean b2 = fix(b1);
System.out.println(b1 + " " + b2);
}
boolean fix(boolean b1)
{
b1 = true;
return b1;
}
}
|
||||||||
|
Answer:
Option (b) |
| 16. |
Which of these operators is used to allocate memory to array variable in Java?
|
||||||||
|
Answer:
Option (c) |
| 17. |
What will be the output of the following Java code?
int arr[] = new int [5];
System.out.print(arr);
|
||||||||
|
Answer:
Option (d) |
| 18. |
Which of these is an incorrect Statement?
|
||||||||
|
Answer:
Option (a) |
| 19. |
Which of these is necessary to specify at time of array initialization?
|
||||||||
|
Answer:
Option (a) |
| 20. |
What will be the output of the following Java code?
class array_output
{
public static void main(String args[])
{
int array_variable [] = new int[10];
for (int i = 0; i < 10; ++i)
{
array_variable[i] = i;
System.out.print(array_variable[i] + " ");
i++;
}
}
}
|
||||||||
|
Answer:
Option (a) |