Sunday, 24 June 2018

TCS Tech Lounge JAVA Final-9


95. What will be the output of the below code:

public class Test{

public static void main(String args[])
{
String a="1";
String b="2";

System.out.println(a+b);

}
}
Ans: 12

96. A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?
Ans: Do not declare with any accessibility modifiers

97. close() method have integer return type in BufferedReader class
Ans: false

98. Which two statements are true regarding constraints?
Ans: A column with the UNIQUE constraint can contain NULL

99. Java is a_______level programming language
Ans: high

100. Which of these classes defined in java.io and used for file-handling are abstract: 
A) InputStream
B) PrintStream
C) Reader
D) FileInputStream
E) FileWriter
Ans: A and C

101. You want to calculate the sum of commissions earned by the employees of an organisation. If an employee doesn't receive any commission, it should be calculated as zero. Which will be the right query to achieve this?

Ans: select sum(nvl(commission,0))from employees

102. Which class does not override the equals() method, inheriting them directly from class object?
Ans: java.lang.StringBuffer

103.
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;
}}
What is the output of the above program?
Ans: (b )DEVILER

104. What data type does FileReader.readLine() return?
Ans: String
2.        
106. A part located in the central processing unit that stores data and information is known as
Ans: Core memory

107. FileInputStream class extends_____class
Ans: InputStream

108. mark() method have void return type in BufferedReader class.
Ans: True

109. _______is a special type of integrity constraint that relates two relations and maintains consistency across the relations
Ans: Referential integrity constraints

110. BufferedWriter is_______
Ans: Class

111. FileReader class inherits from the InputStreamReader class
Ans: True

112. What are all false about ENUMS?

Ans: Enums can extend any other type

113. What is the return type of readDouble() of DataInputStream class?
Ans: double

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

Ans: request.getSession();

116. Which of these method of FileReader class is used to read characters from a file?
Ans: read()

117. Which method is used to access the cookies that are added to response object?
Ans: getCookies()

118. _________joins two or more tables based on a specified column value not equaling a specified column value in another table
Ans: NON-EQUIJOIN

What is the return type of ready() method in BufferedReader class?
ANS: Boolean

skip() method have long returntype in Bufferedreader class.
ANS: TRUE

1 comment:

  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