Live Help (Start Chat)
View Count: 0
Duration: 49 mins
Accessed date:
Not Yet Viewed
Post your comment / feedback here
 
 

Be the first one to comment about this video

Question No: 1 of 23
1.Interface contains what type of variables? 
Options:
  1. public, private, default
  2. public, protected, private
  3. default, protected, static
  4. public, default, static
View Answer/Explanation:
d
Explanation:

Question No: 2 of 23
2. What is the output of this program?

interface calculate
{
  void cal(int item);
}
class display implements calculate 
{
int x;
public void cal(int item)
{
x = item * item;            
}
}
class interfaces 
{
public static void main(String args[]) 
{
display arr = new display;
arr.x = 0;      
arr.cal(2);
System.out.print(arr.x);
}
} 
Options:
  1. 0
  2. 2
  3. 4
  4. None of the mentioned
View Answer/Explanation:
c
Explanation:

Question No: 3 of 23
3.What is the output of this program?

interface calculate 
{
void cal(int item);
}
class displayA implements calculate
 {
int x;
public void cal(int item) 
{
x = item * item;            
}
}
class displayB implements calculate
 {
int x;
public void cal(int item) 
{
x = item / item;            
}
}
class interfaces 
{
public static void main(String args[]) 
{
displayA arr1 = new displayA;
displayB arr2 = new displayB;
arr1.x = 0;
arr2.x = 0;      
arr1.cal(2);
arr2.cal(2);
System.out.print(arr1.x + " " + arr2.x);
}
} 
Options:
  1. 0 0
  2. 2 2
  3. 4 1
  4. 1 4
View Answer/Explanation:
c
Explanation:

Question No: 4 of 23
4. What is the output of this program?

interface calculate 
{
int VAR = 0;
void cal(int item);
}
class display implements calculate
 {
int x;
public  void cal(int item) 
{
if (item<2)
x = VAR;
else
x = item * item;            
}
}
class interfaces 
{
public static void main(String args[]) 
{
display[] arr=new display[3];
for(int i=0;i<3;i++)
arr[i]=new display();
arr[0].cal(0);    
arr[1].cal(1);
arr[2].cal(2);
System.out.print(arr[0].x+" " + arr[1].x + " " + arr[2].x);
}
} 
Options:
  1. 0 1 2
  2. 0 2 4
  3. 0 0 4
  4. 0 1 4
View Answer/Explanation:
c
Explanation:

Question No: 5 of 23
5.what will be the output of the program?

public class Foo 
{  
public static void main(String[] args) 
{
try 
{ 
return; 
} 
finally 
{
System.out.println( "Finally" ); 
} 
} 
} 
Options:
  1. Finally
  2. Compilation fails.
  3. The code runs with no output.
  4. An exception is thrown at runtime.
View Answer/Explanation:
a
Explanation:

Question No: 6 of 23
6. What will be the output of the program?

try 
{ 
int x = 0; 
int y = 5 / x; 
} 
catch (Exception e) 
{
System.out.println("Exception"); 
} 
catch (ArithmeticException ae) 
{
System.out.println(" Arithmetic Exception"); 
} 
System.out.println("finished"); 
Options:
  1. finished
  2. Exception
  3. Compilation fails.
  4. Arithmetic Exception
View Answer/Explanation:
c
Explanation:

Question No: 7 of 23
7. What will be the output of the program?

public class X 
{  
    public static void main(String [] args) 
    {
        try 
        {
            badMethod();  
            System.out.print("A"); 
        }  
        catch (Exception ex) 
        {
            System.out.print("B");  
        } 
        finally 
        {
            System.out.print("C"); 
        } 
        System.out.print("D"); 
    }  
    public static void badMethod() 
    {
        throw new Error(); /* Line 22 */
    } 
} 
Options:
  1. ABCD
  2. Compilation fails.
  3. C is printed before exiting with an error message.
  4. BC is printed before exiting with an error message.
View Answer/Explanation:
c
Explanation:

Question No: 8 of 23
8.at will be the output of the program?

public class X 
{  
    public static void main(String [] args) 
    {
        try 
        {
            badMethod();  
            System.out.print("A");  
        } 
        catch (RuntimeException ex) /* Line 10 */
        { 
            System.out.print("B"); 
        } 
        catch (Exception ex1) 
        { 
            System.out.print("C"); 
        } 
        finally 
        {
            System.out.print("D"); 
        } 
        System.out.print("E"); 
    } 
    public static void badMethod() 
    { 
        throw new RuntimeException(); 
    } 
} 
Options:
  1. BD
  2. BCD
  3. BDE
  4. BCDE
View Answer/Explanation:
c
Explanation:

Question No: 9 of 23
9. program on to throw a new user define exception

class x
{
public static void  exception()
{
 System.out.print(“throw”);
 throw new RuntimeException();
}
 public static void main(String args[]){
try
{
 System.out.print(“hello”);
  exception();
 }
  catch(Exception ex)
 {  
  System.out.print(“caught”);
 }
finally
{
System.out.print(“this is finally block”);
}
System.out.print(“end”);
}
} 
Options:
  1. hellothrow Exception caught
  2. compile error
  3. hellothrow caught finally after
  4. runtime error
View Answer/Explanation:
a
Explanation:

Question No: 10 of 23
10.given program is used to write contents in a file if no file found using exception handling to control the code.

class y
{
 public static void main(String args[])
{
 FileOutputStream out=null;
 try
{
   out=new FileOutputStream(“test.text”);
   out.write(“abc”);
 }
 catch(Exception e)
{
 System.out.println(“Exception”);
 }
 finally
{
out.close();
}
}
} 
Options:
  1. compiler error
  2. Exception caughtfinally
  3. its prints “abc”
  4. it returns value count value in a file in a file
View Answer/Explanation:
a
Explanation:

  1