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.
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);
}
}
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?
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?
{
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
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 statement is not correct with respect to the following code snippet?
public class Box<T>
public class Box<T>
Anonymous Quiz
35%
T is a type variable that can be accessed anywhere in the class Box.
27%
T is a primitive variable.
26%
T is a format type parameter of class Box.
11%
T is the optional parameter of class Box.
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)
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
}
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.
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;
}
//Missing Statement
{
int customerID;
String customerName;
}