Friday 10 November 2017

TCS Tech Lounge JAVA Final-1

import java.util.*;
class hashtable{
            public static void main(String args[]){
                        Hashtable obj = new Hashtable();
                        obj.put("A",new Integer(3));
                        obj.put("B",new Integer(2));
                        obj.put("C",new Integer(8));
                        obj.remove(new String("A"));
                        System.out.print(obj);
            }
}

Ans: {C=8, B=2}

Consider the following Schema?
STUDENTS(student_code, first_name,last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks); Which of the following query would display names and percentage of marks of all  students stored by honours subject,and then order by percentage of marks?
Ans: (a) Select first_name, lastname, hours_subject, percentage_of_marks from students order by honours_subject,percentage_of_marks.


Which of the following statements are incorrect?
Ans: Strings in java are mutable.


Which statements is true for request.getSession(true) method?
Ans:  getSession(true) method always returns a new session


In HTTP Request method Get request is secured because data is exposed in URL bar?
Ans: False



JDK stands for
Java Development Kit


import java.util.*;
public class Test{
            public static void main(String args[]){
                        System.out.println(new Test().mystery("DELIVER"));
            }
            public String mystery(String s){
                        String s1 = s.substring(0,1);
                        String s2 = s.substring(1,s.length()-1);
                        String s3=s.substring(s.length()-1);
                        if(s.length()<=3)
                                    return s3+s2+s1;
                        else return s1+mystery(s2)+s3;
            }
}

Ans: DEVILER


import java.util.*;
public class Test{
            public static int intValue;
            public static void main(String args[]){
            System.out.println(intValue);
            }
           
}
Ans: 0


FileOutputStream is meant for writing streams of_ _ _ _ _  _
Ans: raw bytes
                

What is the return type of reverse() method in StringBuffer class?
Ans: StringBuffer


Which of these is an incorrect array declaration?
Ans:  (d) int arr[] = int [5] new


_ _ _ _ is used to compare equality of two Strings
Ans: equals() method of Strong class


Which of these statements can skip processing remaining of code in this its body for a particular iteration?
Ans: continue

New drivers can be plugged-in to the JDBC API without changing the client code.
Ans: TRUE


What exception is thrown by read() method of InputStreamReader?
Ans: IOException

JAVA_HOME points to which directory?
Ans: JDK Installation directory.

In which package can we found DataInputStream class?
Ans: java.io

Is write() method in BufferedWriter Class overloaded?
Ans: TRUE

Which of the following is implemented by OutputStream class?
Ans: All of the mentioned. (closeable, flushable,autocloseable)

import java.util.*;
public class Test{
            public static void main(String args[]){
            int num=10;
            switch(num);
            }
           
}
Ans: Compiler Error

JDk7 introduced a new version of the try statement known as____
Ans: try-with-resources statement

Which of these exception is thrown in cases when the file specified for writing it not found?
Ans: FileNotFoundExcepion

public void foo(boolean a, boolean b){
                        if(a)
                        {
                                    System.out.println("A"); // line 5
                        }else if(a&&b){ //line 7
                                    System.out.println("A&&B");
                        }else{ // line 11
                                    if(!b){
                                                System.out.println("notB");
                                    }else{
                                                System.out.println("ELSE");
                                    }
                        }
            }
ANS: If a is false and b is true then the output is “ELSE”
                                                                                                                                           

7 comments:

  1. It was really a nice post and i was really impressed by reading this Ruby on Rails Online Training Hyderabad

    ReplyDelete
  2. We are impressed by the details that you have on your site.we Bookmarked this website . keep it up and again thanks. Thank you so much for sharing such a superb information's with us. Your website is very cool. climge.com | isshpath.com

    ReplyDelete
  3. 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
  4. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities.
    Product owner certification
    CSPO certification

    ReplyDelete
  5. Thanks for sharing this post. Very informational blog.

    We are one of the best website designing company in delhi

    ReplyDelete
  6. This is the perfect webpage for everyone who hopes to understand this topic. You know a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a brand new spin on a topic that's been written about for ages. Excellent stuff, just wonderful! Webinfotechsolution

    ReplyDelete