Sunday 24 June 2018

TCS Tech Lounge JAVA Final-6

26. What is the output of this program?
import java.util.*;
class Array
{
public static void main(String args[])
{
int array[]=new int[5];
for(int i=5;i>0;i--)
array[5-i]=i;
Arrays.sort(array);
for(int i=0;i<5;++i)
System.out.println(array[i]);
}
}
Ans: 12345.0

27. Java platform consists of below components

Ans: Java API, JVM

28. Return type of newLine() in BufferedWriter class is Boolean

Ans: False

29. What is the return type of read function in DataInputStream class?

Ans: int

30. public class StringExam{

public static void main(String args[])
{
String s1="Arun";
String s2="Arun";
String s3=new String("Arun");
String s4=new String("Arun");
System.out.println(s1.equals(s2));
System.out.println(s1==s2);
System.out.println(s3.equals(s4));
System.out.println(s3==s4);
}
}
Ans: true true true false

31._____is a collection of objects with similar properties

Ans: class

32. Which of these keywords must be used to monitor for exceptions?

Ans: try

33. Is readShort() of DataInputStream final?

Ans: True

34. The FileReader assumes that you want to_____the bytes in the file using the default character encoding for the computer your application is running on

Ans: decode

35. The way a particular application views the data from the database that the application uses is a

Ans: Sub schema

36. InputStreamReader(InputStream) creates an InputStreamReader that uses______

Ans: default character encoding

37. An object of which is created by the web container at time of deploying the project?

Ans: ServletContext

38. How many parameters does the read() accept in DataInputStream class?

Ans: 1,3

39. Given request is an HttpServletRequest, which code snippets will create a session if one doesn't exist?

Ans: request.getSession();

40. Java programs should be compiled for each type of platform

Ans: false

41. How many parameters does the skipByte() accept in DataInputStream class?

Ans: 1

42. What is the return type of read() method in BufferedInputStream?

Ans: int

43. What command is used to remove the directory?

Ans: rmdir

44. java.util.Properties class extends________class

Ans: java.util.Hashtable

45. Which of the following describes the correct sequence of the steps involved in making a connection with a database. 

      1. Loading the driver
      2. Process the results
      3. Making the connection with the database
      4. Executing the SQL statements
Ans: 1,3,4,2

46. Writer class is for processing Character streams

Ans: True

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