Sunday, 24 June 2018

TCS Tech Lounge JAVA Final-12

What stream type provides input from a disk file?
ANS: FileReader

Read() method of FileInputStream returns -1 when end of the file is reached
ANS: TRUE

Public class Test1{
Public static void main(String args[]){
Try{
Int answer =20/0;
}
Catch(ArithmeticException e){
//some code
}
Catch(Exception e){
//some code}
Catch(NullPointerEception e){
//some code
}
}
Select one or more true statements for above code
ANS: we will get unreachable catch block for NullPointerException, as it is already handled by the catch block for Exception

public class TestDemo{
                                public static void main(String[] args){
                                    TestDemo testObj = new TestDemo();
                                    testObj.start();
                                }
                                void start()
                                {
                                    long[] a1 = {3,4,5};
                                    long[] a2 = fix(a1);
                                    System.oit.print(a1[0]+a1[2]+"");
                                    System.out.println(a2[0]+a2[1]+a2[2]);
                                }
                                Long[] fix(long[] a3){
                                    A3[1] = 7;
                                    Return a3;
                                }
}
ANS:  15 15

What Is the main difference between the JRE and the JDK?
ANS:  The JRE includes the virtual machine


One class has an attribute which refers to another class. The relationship will be termed as _ _ _ _
ANS: Asscociation


Public class Test1{
                                Public static void main(String args[]){
                                    Try{
                                                Int answer =20/0;
                                    }
                                    /** Enter code here line 6 **/
                                    }
                                }what code can we enter at line 6? Select all that apply.
ANS: ALL the above


class Demo{
                                public static void main(String[]args){
                                    String s1=new String("hello");
                                    String s2=new String("hellow");
                                    System.out.println(s1=s2);
                                }
} What would be the output of the code mentioned above?
ANS: hellow

What is the return type of readBoolean() in DataInputstream?
ANS: Boolean

Which of the following statements are true?
ANS: Unicode characters are all 16-bits.

String Objects are mutable objects?
ANS: FALSE

_ _ _ _ _ class is called as the super class of all classes
Ans: java.lang.Object

The StreamReader can use the platform default encoding only
Ans: false                       

Is readBoolean() method of DataInputStream final?
ANS: True

What is used by executables to locate class files?
ANS: Class Path

Which of these ways used to communicate from an applet to servlet?
ANS: All mentioned above( RMI Communication, HTTP Communication, Socket Communication )

Every statement in java programming language ends wih
ANS: semicolon




public class Exam1{
                                public static void main(String[] args){
                                    int arr[] = new int[-3];
                                    for(int i=0;i<arr.length;i++){
                                                System.out.println(arr[i]);
                                    }
                                }
}
ANS: NegativeArrayException RuntimeError

2 comments:

  1. Thanks for sharing this informative content , Great work
    Creative Thinking for creating an impact!
    Product Thinking Community introduces PT Labs powered by Leanpitch
    Product thinking conference

    ReplyDelete
  2. Vdohr vdohr - videoodl.cc
    Vdohr - Vdohr vdohr videos Vdohr - Vdohr youtube mp3 - Vdohr. Vdohr. Vdohr Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr. Vdohr.

    ReplyDelete