Sunday, 24 June 2018

TCS Tech Lounge JAVA Final-10


The type long can be used to store values in the following range:
ANS: -263 to 263-1

In BufferedOutputStream, the method clone is inherited from:
ANS: java.lang.Object

When the values in one or more attributes being used as a foreign key must exist in another set of one or more attributes in another table, we have created a(n)_ _ _ _
ANS: Referential integrity constraint

Public class Main {
   public static void main(String args[]) {
      try {
         throw 10;
      }
      catch(int ex) {
         System.out.print("Got the  Exception " + ex);
      }
  }
} What would be the output above program?
ANS: Compiler Error


Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
ANS:  do-while
                                                                                             
What is the Return type of newline() method in BufferedWriter Class?
ANS: void

The given below program will remove the given character from the String ?
Private static String removChar(String str,char c){
If(str==null)
Return null;
Return str.replaceAll)(Character.toStrng(c),””);
}                              
ANS: True

The life cycle of a servlet is managed by
ANS: Servlet Container

What is the numerical range of char?
ANS: 0 to 65535

EMPDET is an external table containing the columns EMPNO and ENAME. Which command would work on relation to the EMPDET table?
ANS: CREATE VIEW empvu AS SELECT 8 FROM empdept;


Which three are valid array declarations?
1.      Int [] myScores[]
2.      Char [] myChars;
3.      Int [6] myScores;
4.      Dog myDogs [];
5.      :Dog myDogs[7];
ANS: 1,2,4


Buffering speeds up IO and it is not the same as writing one character at a time to the network or disk?
ANS: TRUE

Which of the following methods does BufferedInputSrream inherit from java.lang.Object?
All(equals,finilize,getClass)


Which of these data type is returned by every method of OutputStream
ANS: None of the mentioned

Public class example {
Public static void main(String args[]){
Int x = 0;
If(x >0)
X=1;
Switch(x){
Case 1: System.out.println(1);
Case 0: System.out.println(0);
Case 2: System.out.println(2);
Break;
Case 3: System.out.println(3);
Default:System.out.println(4);
Break;
 }
}
}
ANS:  0 2

class Test1{
                                public static void main(String[]args){
                                    int arr[]=new int[5];
                                    arr[1]=10;
                                    arr[3]=20;
                                    for(int i=0;i<5;i++){
                                                System.out.println(arr[i]);
                                    }
                                }
}
ANS: 0100200
Map’s subinerface, SortedMap,maintains its key-value pairs in ascending order or in an order specified by a Comparator
ANS: True

What type of exceptions are thrown by readShort() of DataInputStrea?
ANS: IOException

Select the advantages of layered architecture
All ( Simplicity-ease of design, Flexibility-Ease to modify, Incremental changes –Add new layers functions etc, )

Public class Test1{
Enum eColors{
Black(5),
BLUE(10),
GREEN(15);
Int colorCode=0;
eColors(int colorCode){
this.colorCode=colorCode;
}
};
Public static void main(String args[]){
System.out.println(eColors.values()[1].colorCode);
}
}
What will be the output?

ANS: 10

1 comment:

  1. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
    icp-cat training

    ReplyDelete