| 1. |
When does method overloading is determined?
|
||||||||
|
Answer:
Option (b) |
| 2. |
When Overloading does not occur?
|
||||||||
|
Answer:
Option (d) |
| 3. |
What will be the output of the following Java code?
class average {
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);
}
}
|
||||||||
|
Answer:
Option (c) |
| 4. |
What will be the output of the following Java program?
class array_output {
public static void main(String args[])
{
char array_variable [] = new char[10];
for (int i = 0; i < 10; ++i) {
array_variable[i] = 'i';
System.out.print(array_variable[i] + "" );
i++;
}
}
}
|
||||||||
|
Answer:
Option (a) |
| 5. |
What will be the output of the following Java program?
class evaluate
{
public static void main(String args[])
{
int a[] = {1,2,3,4,5};
int d[] = a;
int sum = 0;
for (int j = 0; j < 3; ++j)
sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
System.out.println(sum);
}
}
|
||||||||
|
Answer:
Option (c) |
| 6. |
What will be the output of the following Java program?
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/2;
array_variable[i]++;
System.out.print(array_variable[i] + " ");
i++;
}
}
}
|
||||||||
|
Answer:
Option (b) |
| 7. |
What will be the output of the following Java program, if we run as “java main_arguments 1 2 3”?
class main_arguments
{
public static void main(String [] args)
{
String [][] argument = new String[2][2];
int x;
argument[0] = args;
x = argument[0].length;
for (int y = 0; y < x; y++)
System.out.print(" " + argument[0][y]);
}
}
|
||||||||
|
Answer:
Option (d) |
| 8. |
Which will legally declare, construct, and initialize an array?
|
||||||||
|
Answer:
Option (d) |
| 9. |
Which three are legal array declarations?
1. int [] myScores []; 2. char [] myChars; 3. int [6] myScores; 4. Dog myDogs []; 5. Dog myDogs [7];
|
||||||||
|
Answer:
Option (a) |
| 10. |
Which one of the following will declare an array and initialize it with five numbers?
|
||||||||
|
Answer:
Option (b) |