JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
Choose the correct options

Which statement is true for the class First given below?

Package myPackage;
class First
{
/* Class body*/
}
1. import myPackage.TestClass
2. public class TestSubject
extends TestClass
3 .{
4. public TestSubject()
5. {
6. super();
7. }
8. public void getAllDetails()
9. {
10. super();
11. }
12. }
Identify the Error if any in the given code segment.
Refers the given pseudocode statements to print the sum of digits of number. What condition should be used in place of "?" to get desired output.
public class Program
{
public static void main(String[] args) {
int n=3678, j=0;
do
{
j=j+(n%10);
}while(?);
System.out.println(j);
}
}
interface Ink{
static void pen();//line 3
}
class Color implements Ink
{
public void pen(){
System.out.println("i can write");
}
}
public class Program{ //line 12
public static void main(String[] args) {//line 14
Color c = new Color();
c.pen();//line 17
}
}

Which line in the given code will generate error?
public class Program
{
public static void main(String[] args) {
try{
int c[]={1};
System.out.println(c.length);
c[1]=142;
System.out.println("c = "+c[1]);
int a=args.length;
System.out.println("a = "+a);
int b=8/a;
}
catch(ArithmeticException e){
System.out.println("Divide by 0: "+e);
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Array index oob: "+e);
}
System.out.println("After try/catch blocks");

}
}
Choose the correct option

What will be the output of the give code snippet after it's execution?
👍1
Choose the correct option

What will be the output of the given pseudocode? Integer x=5,y=4,z z=x>y?x-y:x print z
Anonymous Quiz
15%
0
47%
1
10%
9
28%
The code will generate error
Which JdbcTemplate method do you use to execute an SQL insert update or delete statement and capture the number of affected rows?
Anonymous Quiz
9%
call
17%
queryForObject
41%
update
13%
perform
20%
query
Choose the correct option

What will be the output of the given pseudocode?

Integer x=0, y= x- -/- -x
if(x=y)
print (x-y)
else if(y=x)
print(y-x)
else
print(2*x+y)
Choose the correct option.

How many times will the while loop executed for the given pseudocode?

Character c=125
while(c<128)
{
print c
c=c+1
}
public class MyClass {
public static void main(String args[]) {
class InnerTest
{
public String name;//Line 5
public InnerTest(String s){
name=s;//Line 7
}
}
Object c=new InnerTest("InnerTest");//Line 10
InnerTest t=(InnerTest)c;
System.out.println(t.name);
}
}

Choose the correct option.

What will be the output of the given code fragment.
A class CustomerDetails is required for storing customer details such as customerID and customerName. Also this class CustomerDetails should not be sub classed. Which option should be added in place of missing statement in the given code, such that the above mentioned condition satisfied?

//Missing Statement
{
int customerID;
String customerName;
}