Thursday 28 February 2019

Java hands on programs

These  are  java hands on
Java EXTRA Hands on

TCS XPLORE PROGRAMS 28-2-2019

PRINT LEAST ASCII VALUE CHARACTER
Main.java
public class Main{
public static void main(String []args){
String string="heLlo";
char ascii='z';
char[] strarray=string.toCharArray();
for(int i=0;i<strarray.length;i++)
if(ascii>strarray[i])ascii=strarray[i];
System.out.println(ascii);
}
}
Output: L
FILE HANDLING IN JAVA
Main.java
public class Main
{
public static void main(String[] args) {
Document obj1=new Document(1,"intro","intro_details",10);
Document obj2=new Document(2,"contents","contents_details",3);
Document obj3=new Document(3,"history","history_details",25);
Document obj4=new Document(4,"war","war_details",38);
Document arr[]={obj1,obj2,obj3,obj4};
combineDocument(arr);
}
public static void combineDocument(Document[] arrayobj){
int id=0,pages=0,arrlen=arrayobj.length;
System.out.println("id: "+(arrayobj.length+1));
System.out.println("Titles: "+arrayobj[0].getTitle()+"#"+arrayobj[1].getTitle()+"#"+arrayobj[2].getTitle()+"#"+arrayobj[3].getTitl
e());
System.out.println("Folders: "+arrayobj[0].getFolderName()+"@"+arrayobj[1].getFolderName()+"@"+arrayobj[2].getFolderName()
+"@"+arrayobj[3].getFolderName());
for(int i=0;i<arrayobj.length;i++)pages=pages+arrayobj[i].getPages();
System.out.println("Pages: "+pages);
}
}
Document.java
public class Document{
private int id;
private String title;
private String folderName;
private int pages;
public Document(int id,String title,String folderName,int pages){
super();

this.id=id;
this.title=title;
this.folderName=folderName;
this.pages=pages;
}
public int getId(){
return id;
}
public String getTitle(){
return title;
}
public String getFolderName(){
return folderName;
}
public int getPages(){
return pages;
}
}
Output:
id: 5
Titles: intro#contents#history#war
Folders: intro_details@contents_details@history_details@war_details
Pages: 76

Wednesday 27 February 2019

Web Development

TCS Tech Web Development With Java 

What is the output of the following code
The value is <%=””%>
Ans: The value is

Which of the following is not an attribute of Page Directive
Ans: name

Select valid expression tag from the following
Ans: <%=new java.util.Date().toString()%>

Comments in Jsp file can be written by
Ans: <%--  ……….. --%> and <!--  ……….. -->

Why RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?
Ans:  The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state.
In JSP, how can you know that HTTP method (GET or POST) is used by client request?
Ans:  request.getMethod()

Select the correct scopes in JSp
Ans: page,request,session,application
What is a benefit of using JavaBeans to separate business logic from presentation markup within the JSP environment?      Ans:
Which of the following are correct. Select the one correct answer.
Ans:  To use the character %> inside a scriptlet, you may use %\> instead.

 What gets printed when the following JSP code is invoked in a browser. Select the one correct answer.
    <%= if(Math.random() < 0.5) %>
      hello
    <%= } else { %>
      hi
    <%= } %>
Ans: The JSP file will not compile.

What gets printed when the following is compiled. Select the one correct answer.
    <% int y = 0; %>
    <% int z = 0; %>

    <% for(int x=0;x<3;x++) { %>
    <% z++;++y;%>
    <% }%>
    <% if(z<y) {%>
    <%= z%>
    <% } else {%>
    <%= z - 1%>
    <% }%>

Ans: 3

Which of the following is not implicit object in JSP?
Ans: pageConfig

Which of the following code is used to set the session timeout in servlets?
Ans: session.setMaxInactiveInterval(interval)

What is the return type of getParameter(String name) in ServletRequest
Ans:  String

Which of the following code is used to set auto refresh of a page after 5 seconds?
Ans: response.setIntHeader(“Refresh”,5)

How to create a cookie in a servlet?
Ans: Use new Operator

Which of the following code retrieves the MIME type of the body of the request?
Ans: request.getContentType()

Which of the following code delete a cookie in servlet?
Ans: cookie.setMaxAge(0);
Select the right options which second.jsp can be included in first.jsp
Ans:  <%@include file=”second.jsp”%> , <jsp:include page=”second.jsp”/>

Which of the below methods returns a string containing information about the servlet, such as its author, version, and copyright.
Ans: getServletInfo()

A JSP page called test.jsp is passed a parameter name in the URL using “http://localhost:8080/projectName/test.jsp?
Ans:
Which of the following code used to get session in servlet?
Ans: request.getSession()
In HTTp request which asks for the loopbacks of the request message, for testing or troubleshooting?
TRACE
What is the return type of getAttribute(String name) in ServletRequest
Ans: Object
Select the right method to include welcome file in a web application
Which of the following code can be used to set the character encoding for the body of the response?
ANS: response.setCharacterEncoding(charset)
Which of the following package contains servlet classes?
ANS: javax.servlet, javax.servlet.http
Select a valid declaration from the following
Ans: <%! String orgName=”TCS”;%>
What is the return type of getAttribute(String name) in ServletRequest
ANS: Object
A JSP needs to generate an XML file. Which attribute of page directive may be used to specify that JSP is generating an XML file?
ANS: contentType
How can you make jsp page as error page
ANS: isErrorPage=”true”
String name = request.getAttribute(“name”); Select the correct option from below for this code statement.
Ans: It gives compilation error as we need to use the casting of (String)
Which of the following code can be used to clear the content of the underlying buffer in the response without clearing headers or status code.
Ans: response.resetBuffer()
Java Declaration tag is used to declare
ANS: both variables and methods
Which of the following is true about javax.servlet.error.exception_type?
Ans: This attribute gives information about exception type which can be stored and analyzed after storing in a java.lang.Class data type
Which of the following is legal JSP syntax to print the value of i.select the one correct answer
ANS: <%int i = 1;%>
<%= i %> (d)

Which method is used to retrieve a form values in a JSP or servlet?
ANS: request.getParameter(String)
Jsp is used for
ANS: Server Side Programming
Which is not a JSP directive ?
ANS: scriptlet
Which of the following code sends a cookie in servlet?
ANS: response.addCookie(cookie);
 Web Development With Java mcqs
1. Error Message displayed when the page is not found at current location?
Ans: 404

2. What is the output of the following code. The value is <%=""%>
Ans: The value is

3. What gets printed when the following JSP code is invoked in a browser. Select the one correct answer. <%=if(Math.random()<0.5%)>hello<%=}else{%>hi<%=}%>
Ans: The JSP file will not compile

4. Select the right option to set session expiry after 1 minute of inactiveness
Ans: <session-config><session-timeout>1</session-timeout></session-config>

5. JSP is used for
Ans: Server Side Programming

6. Which of the following is true about javax.servlet.error.exception_type?
Ans: This attribute gives information about exception type which can be stored and analyzed after storing in a java.lang.Class data type

7. Which is not a JSP directive
Ans: scriptlet

8. Which of the following package contains servlet classes?
Ans: (a) javax.servlet
         (b) javax.servlet.http

9. JSP is
Ans: Java Server Pages

10. Select the correct scopes in JSP
Ans: page, request, session, application

11. Select a valid declaration from the following
Ans: <%! String orgName="TCS";%>

12. How to create a cookie in servlet?
Ans: Use new operator

13. How many implicit objects are there in JSP
Ans: 9

14. In JSP, how can you know what HTTP method (GET or POST) is used by client request?
Ans: request.getMethod()

16. Comments in JSP can be written by
Ans: Both a and b (a. <%--comments--%>, b. <!--comments-->)



19. Which of the following tags can be used to print the value of an expression to the output stream?
Ans: <%=%>

20. Why use RequestDispatcher to forward a request to another resource, instead of using a sendRedirect?
Ans: The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state

21. A JSP needs to generate an XML file. Which attribute of page directive may be used to specify that JSP is generating an XML file?
Ans: contentType

22. Select the right method to include welcome file in a web application
Ans: <welcome-file-list><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file-list>

23. Select a valid expression tag from the following
Ans: <%=new java.util.Dat().toString()%>


25. What is the difference between doing an include or a forward with a RequestDispatcher?
Ans: The forward method transfers control to the designated resource, while the include method invokes the designated resource, substitutes its output dynamically in the display, and returns control to the calling page

26. Which of the following is true about javax.servlet.error.exception_type?
Ans: This attribute gives information about exception type which can be stored and analyzed after storing in a java.lang.Class data type

27. What are Servlets?
Ans: Both of the above (Java Servlets are programs that run on a Web or Application server. Java Servlets act as a middle layer between a request coming from a web browser or other HTTP client and databases or applications on the HTTP server)

28. Which of the following is true about servlets?
Ans: All of the above. ((a) Servlets execute within the address space of a Web server. (b) Servlets are platform-independent because they are written in Java. (c)The full functionality of the Java class libraries is available to a servlet.)

29.  Which of the following is the correct order of servlet life cycle phase methods?
Ans: init, service, destroy

30. When init method of servlet gets called?
Ans: The init method is called when the servlet is first created.

31. Which of the following is true about init method of servlet?
Ans: Both of the above. ((a) The init method simply creates or loads some data that will be used throughout the life of the servlet. (b) The init method is not called again and again for each user request.)

32. When service method of servlet gets called?
Ans:  The service method is called whenever the servlet is invoked.

33. Which of the following is true about service method of servlet?
Ans: All of the above ((a) The servlet container i.e.webserver calls the service method to handle requests coming from the client. (b) Each time the server receives a request for a servlet, the server spawns a new thread and calls service. (c) The service method checks the HTTP request type GET,POST,PUT,DELETE,etc. and calls doGet, doPost, doPut, doDelete, etc. methods as appropriate. )

34. When doGet method of servlet gets called?
Ans: Both of the above. ((a) A GET request results from a normal request for a URL. (b) The service method checks the HTTP request type as GET and calls doGet method.)

35. When doPost method of servlet gets called?
Ans: Both of the above. ((a) A POST request results from an HTML form that specifically lists POST as the METHOD. (b) The service method checks the HTTP request type as POST and calls doPost method.)

37. How can you make jsp page as error page
Ans: isErrorPage="true"

38. In JSP, how can you know what HTTP method (GET or POST) is used by client request?
Ans: request.getMethod()

39. Which of the following code can be used to set the character encoding for the body of the response?
Ans: response.setCharacterEncoding(charset)

40. Which of the following is not an implicit object in JSP?
Ans: pageConfig

41. Java declaration tag is used to declare
Ans: Both variables and methods

42. What is the return type of getParameter(String name) in ServletRequest?
Ans: String

What will be the output of the following code?
<% int x=5;%>; <%! Int x =10; %><%! Int y=50;%><%y*x%>
ANS: 250.0

how to get multiple values of selected checkboxes in a servlet?
ANS: String values[]=request.getParameterValues(“hobbies”);

which of the following code is used to get names of the parameters in servlet
ANS: request.getParameterNames()
JSP is
ANS: Java Server Pages
Which of the following code is used to set content type of a page to be serviced using servlet?

ANS: response.setContentType()

Materials of TCS ILP last year

These are some last year ILP questions
TCS Materials of TCS ILP

TCS XPLORE 1

These are some notes of TCS XPLORE 1 materials

TCS XPLORE MATERIALS

Monday 25 February 2019

TCS XPLORE MATERIALS

Please use link for tcs xplore materials
.....
TCS XPLORE1 materials

Know your TCS

TCS ASPIRE : Know your TCS test 2018 - 2019


 Question 1 of 10 10.0 Points
When and where was TCS founded?
A. 1968, Mumbai
B. 1954, Mumbai
C. 1968, Jamshedpur
D. 1954, Coimbatore

Answer Key: A
[ Tips: The correct answer is 1968, Mumbai. In 1968, TCS was formed as division of TATA Sons. It started as Tata Computer Center. Its main business was to provide computer services to other group companies. An electrical engineer from the Tata Electric Companies, Fakir Chand Kohli, was brought in as the first General Manager. Soon after, the company was named Tata Consultancy Services.TCS is headquartered in Mumbai, and operates in more than 42 countries and has more than 142 offices across the world.] 
# Question 2 of 10 10.0 Points
To how many industries does TCS provides its consultancy?
A. 12
B. 10
C. 20
D. 15

Answer Key: A
[ Tips: The correct answer is 12. 1) Banking and Financial Services 2) Energy, Resources and Utilities 3) Government 4) Healthcare 5) High-tech 6)Insurance 7)Life Sciences 8)Manufacturing 9)Media and Information services 10) Retail and Consumer products 11) Telecom and 12) Travel, transport and hospitality]
# Question 3 of 10 10.0 Points
What are the values of TCS?
A. Leading Change, Integrity, Responsibility, Excellence, Learning and propelling
B. Leading innovation, Integrity, Respect for the colleagues, Excellence, Mentoring and Sharing
C. Leading innovation, Integrity, Courteous, Certainty, Learning and Sharing Correct
D. Leading Change, Integrity, Respect for individual, Excellence, Learning and Sharing

Answer Key: D
[ Tips: The correct answer is Leading Change, Integrity, Respect for individual, Excellence, Learning and Sharing] 
# Question 4 of 10 10.0 Points
What is the name of the first research center established by TCS?
A. Tata Institute of Social Sciences (TISS)
B. Tata Research Development and Design Center (TRDDC)
C. Tata Institute of Fundamental Research (TIFR)
D. Indian Institute of Science (IISc)

Answer Key: B
[ Tips: The correct answer is Tata Research Development and Design Center (TRDDC)] 
# Question 5 of 10 10.0 Points
What was TCS’s first onsite project?
A. Automating Johannesburg Stock Exchange
B. Burroughs (the first business computer manufacturer)
C. Developing electronic depository, SECOM for SIS SegaInterSettle, Switzerland
D. Institutional Group and Information Company (IGIC)

Answer Key: D
[ Tips: The correct answer is Institutional Group and Information Company (IGIC). The company pioneered the global delivery model for IT services with its first offshore client in 1974. TCS’s first international order came from Burroughs, one of the first business computer manufacturers. TCS was assigned to write code for the Burroughs machines for several US-based clients. This experience also helped TCS bag its first onsite project – the Institutional Group and Information Company (IGIC), a data centre for ten banks, which catered to two million customers in the US, assigned TCS the task of maintaining and upgrading its computer systems.]
# Question 6 of 10 10.0 Points
TCS is ….. largest IT firm in the world?
A. 8th
B. 2nd
C. 4th
D. 6th

Answer Key: A 
# Question 7 of 10 10.0 Points
Who is TCS first General Manager?
A. JRD Tata
B. F.C Kohli
C. Ratan Tata
D. S. Ramadorai

Answer Key: B 

# Question 8 of 10 10.0 Points
TCS provides six major IT services
A. Customer Development, Application Management, Migration and Re-engineering, System Integration, Testing, Performance Engineering
B. Custom Application Development, Application Management, Migration and Re-engineering, Business Management, Testing, Performance Engineering
C. Custom Application Development, Application Management, Migration and Re-engineering, System Integration, Testing, Performance Engineering
D. Customer Development, Application Management, Migration and Re-engineering, Business Management, Testing, Performance Engineering

Answer Key: B 

# Question 9 of 10 10.0 Points
Which model does TCS follow?
A. Global Integrated Delivery Model
B. World Integrated Delivery Model
C. World Network Delivery Model
D. Global Network Delivery Model

Answer Key: D 

# Question 10 of 10 10.0 Points
Tata Consulting Services goes public in India’s private sector’s largest initial public offer in
A. 2006 
B. 1999 
C. 2004 
D. 2002 

Answer Key: C 

TCS ASPIRE : WEB TECHNOLOGY ASSIGNMENT




 


WEB TECHNOLOGY ASSIGNMENT
hello..friends.I am giving a link to download web-Technology assignment i.e Online Shopping Portal Case Study..
I did it in the way I like using  HTML, Javascript, PHP, CSS…
Hope it will be useful for you.
I suggest you people to modify if you need better designs..All the best :) enjoy..


Solution
Download The Zip file Here Download


OR


Download winamp server
If you have any doubts regarding what I have done or something else ,leave a comment or send  mail to alisayed172@gmail.com

TCS Basic Programming

TCS Basic Programming questions & Answers |2018

1. True or false? Software development is a discipline in the computer science field that focuses on the creation of programs that control computer hardware?
Ans: True
2. Which of the following need to be assessed during unit testing?
Ans: Error handling and execution paths
3. Quick and dirty test to determine quickly the status of a system is called----
Ans: smoke testing
4. Test scope is dependent on the budget for project.
Ans: False
5. The HTML content elements make use of _____to contain or express content.
Ans: Tags
6. Which type of report have Function/Test matrix in it?
Ans: interim test report
7. A collection of techniques for planning and writing of program that increases
programmer productivity__________
Ans: Modular programming
8. Memory allocation pattern can be testing in:
Ans: whitebox testing
9. In Html, the image tag specifies_____as an attribute.
Ans: File name of the image
10. Automation Testing should be done starting manual testing.
Ans: False
11. Project design is the process of translating a task into aseries of commans that a
computer will use perform that task.
Ans: False
12. Beta testing will be done by
Ans: user
13. HTML is a mark-up language.
Ans: true
14. What is the normal order of activities in which traditional software testing is
organized? Integration testing system testing unit testing validation testing.
Ans: unit testing, Integration testing, validation testing, system testing
15. The main focus and scope of the approach tells you the various optimization
techniques that can be applied at the ____ level.
Ans: Source code
16. CVS is used in the analysis phase.
Ans: false
17. How much software testing cost accounts for in the software development cost?
Ans: 40-50
18. Design is the process that brings all the software components together to create the
complete software system. True or False?
Ans: false
19. Functional testing is carried out to make sure that the software is doing exactly what
it is supposed to do.
Ans: True
20. Assuring that the organization has the experience and expertise to work effectively
with recommended technology is done in the implementation step of the traditional
SDLC.
Ans: false
21. Is software verification and software validation are the different process.
Ans: True
22. Translating the problem statement into a series of sequential steps describing what
the program must do is known as dubbing.
Ans: False
23. Phase of testing is/are ________
Ans: Desk-checking, translating, Debugging
24. Assuring that the organization has the experience and expertise to work effectively
with recommended technology is done in the planning step of the traditional SDLC.
25. Ans: True
26. Understanding the problem fully and detailing the requirements of an information
system is one of the tasks conducted during the development phase.
27. Ans: False
28. Understanding the problem fully and detailing the requirements of an information
system is one of the tasks conducted during the implementation phase.
Ans: False
29. Testing of computer system by client to verify if it adhered to the provided
requirements is called acceptance testing.
Ans: True
30. HTML, the bold element may be embedded within a paragraph element.
Ans: true
31. Testing carried out to ensure that changes made during testing or any enhancement
changes are not impacting the previously working functionality is called.
Ans: regression testing
32. Which of the following is True about a compiler? Translating program into a form
that the computer can understand.
Ans: gives the syntax and logic related errors in the program
33. The translator program used in assembly language is called _____
Ans: assembler
34. ____ manage the system development, assign staff, manage the budget and
reporting, and ensure that deadlines are met.
Ans: Project Managers
35. A software company built a website with a lot of features spread all over the
webpage, with very less blank space on the page. But, the users did not receive the
design very well. What could this website be lacking?
Ans: Do not create crowded interfaces
36. This process is a specific part of the QA procedure, it measures the quality of a
product and is applied for a particular product. The process is
Ans: Quality Assurance and Quality control
37. The acronym Fs stands for functional solution.
Ans: False
38. CVS is used in implementation an coding phase.
Ans: True
39. In desk-checking you simply sit down and mentally check or trace, the logic of the
program in an attempt to ensure that it is error-free and workable condition. True or
false?
Ans: True
40. Which type of report have Function/Test matrix in it?
Ans: Project status report
41. Pre-written programs from a system library are added during the compilation
phase.True or False?
Ans: False
42. Alpha testing is also called as live testing and product is tested by users.
Ans: False
43. The best reason for using independent software test teams is that
Ans: Testers do not get involved with the project until testing begins
44. The acronym BS stands for Business Specification.
Ans: False
45. A software company designed a website with blue text written on purple
background. The website contained a lot of information, But did not turn out to be
successful. What could be the mistake in the website?
Ans: colour
46. A test case is a set of preconditions steps tobe followed with input data and
expected behaviour to validate a functionality of a system.
Ans: True
47. Does white box testing requires detailed programming skills?
Ans: true
48. Mnemonic codes are used in _ _ _ _ _ language.
Ans: Assembly
49. COBOL is a simple language used for education and business.
Ans: True
50. The _ _ _ _ _ _languages shield users from needing an awareness of complex ware
and program structure.
Ans: Fouth generation
51. High –level languages are sometimes referred to as knowledge-based languages.
True or false?
Ans: False
52. A computer program that converts an entire program into machine language is
called_ _ _ _ _ _.
Ans: compiler
53. The evolution of computer languages depends on hardware maintenance costs as
characteristic to be considered.
Ans: False
54. When a computer follows the instructions, we say it _ _ _ _ _ the program.
Ans: executs
55. Planning the solution is the first step in the programming process.
Ans: False
56. _ _ _ _ is need to supplement human memory and to help organize program
planning.
Ans: Documenting the program
57. _ _ _ _ language converts data and program instructions as is and Os, or the binary
digits corresponding to the on and off electrical states in the computer.
Ans: Machine level
58. _ _ _ _ _ are called as knowledge based languages.
Ans: Natural language
59. Very high level language can be used to retrieve information from databases.
Ans: True
60. The organized process or set of steps that needs to be followed to develop an
information system is known as the program specification.
Ans: False
61. Unit testing is recommended for solving bugs related to memory leakage.
Ans: False
62. Regression testing is recommended for solving bugs related to memory leakage.
Ans: True
63. Analysing implies gathering information.
Ans: True
64. The _ _ _ _ include a group of buttons that perform related functionality.
Ans: Toolbar
65. An important role in deciding a product’s acceptance or rejection in the
marketplace?
Ans: User interface design
66. Text User interface is one of the common types of user interfaces.
Ans: False
67. The structure chart is often referred to as _ _ _ _ _
Ans: Hierarchical program organization
68. Modular programming is implemented by
Ans: Subroutine
69. The principal of selection implies that instruction may be executed selectively IFTHEN and/or IF-THEN-ELSE statements.
Ans: True
70. What is full form of SPICE
Ans: Software process improvement and capability determination
71. Boundary value analysis belong to
Ans: Black Box Testing
72. The output of a load/link phase?
Ans: object and load module

TCS ASPIRE : Communication Quiz

TCS ASPIRE : Communication Quiz/question answers


# Question 1 of 20 10.0 Points
What does this Body language symbolize? 
A. Intuitive
B. Anger
C. Irritated
D. Questioning
E. Insulting

Answer Key: D
[Tips:Questioning]
# Question 2 of 20 10.0 Points
Choose the right phrase of the word. I’ll be with you in ___________ 
A. A quarter of an hour.
B. A quarter of hour.
C. One quarter of an hour.
D. A quarter of one hour.

Answer Key: A 
[Tips:A quarter of an hour]
# Question 3 of 20 10.0 Points
Choose the right vocabulary which matches its meaning. “Expressing one self readily, clearly, effectively”
A. Eloquence
B. Understanding
C. Effective
D. Comprehensive

Answer Key: A 
[Tips:Eloquence]
# Question 4 of 20 10.0 Points
Select the right option which indicates MTI ( Mother tongue influence) in the below given statement. What is your good name? 
 A. Your good
B. Your
C. Name
D. Good name

Answer Key: D 
[Tips:Good name]
# Question 5 of 20 10.0 Points
Identify the tense used in the following sentence: We built a tree house last week.
A. Present continuous
B. Past Perfect
C. Present Perfect
D. Simple Past

Answer Key: D
[Tips:Simple Past]
# Question 6 of 20 10.0 Points
Pick the correct option(past progressive tense): While Aaron_________ in his room, his friends________ in the pool. 
A. was working………………were swimming
B. was working……………………are swimming
C. was working………………was swimming
D. is working……………………are swimming

Answer Key: A 
[Tips:was working………………were swimming]
# Question 7 of 20 10.0 Points
Choose the correct verb form to complete the sentence. I ______ on my sofa all day yesterday. 
A. lying
B. lay
C. lie
D. laid

Answer Key: B
[ Tips:lay ] 
# Question 8 of 20 10.0 Points Identify the incorrect part of the sentence: She don’t understand / didn’t understands / didn’t understand/didn’t understanding the question yesterday.
 A. didn’t understanding
B. don’t understand
C. didn’t understand
D. didn’t understands
Answer Key: C 
[ Tips:didn’t understand ] 
# Question 9 of 20 10.0 Points
Please rewrite the following statement: We are simply loving it here. 
A. We are simply loving.
B. We simply love it here.
C. We are simply here.
D. We love it here.

Answer Key: B
[ Tips: We simply love it here.] 
# Question 10 of 20 10.0 Points
What is the right response for the phrase “ How do you do?”
A. I am fine,how about you?
B. I am fine thank you
C. How do you do?
D. I am not fine, by the way how are you?

Answer Key: C 
[Tips: How do you do?] 
# Question 11 of 20 10.0 Points
Arrange the following sections of a presentation in the correct order:
a. overview
b. introduction
c. start new section
d. analyse a point
e. give examples
f. finish section
g. paraphrase and clarify
h. summarize and conclude
i. inviting audience to ask questions/ discuss
A. a,d,b,c,e,f,h,g,i
B. a,b,d,c,e,f,h,g,i
C. a,b,c,d,e,f,g,h,i
D. b,a,c,d,e,f,h,g,i

Answer Key: D 

# Question 12 of 20 10.0 Points
In the business arena:
A. It is not necessary for men or women to stand for handshaking and all introductions
B. Both men and women should stand for handshaking and all introductions
C. Only men should stand for handshaking and all introductions
D. Only women should stand for handshaking and all introductions

Answer Key: B 

# Question 13 of 20 10.0 Points
Fill in the blanks with appropriate articles: At ____ (1) beginning of ____(2) twentieth century, East Los Angeles became ____(3) popular immigrant destination.
A. the,a,the
B. the,an,a
C. the,the,the
D. the,the,a

Answer Key: D 

# Question 14 of 20 10.0 Points
State whether this is true or false: Every presentation has its own target audience.
- True
- False

 Answer Key: True 

# Question 15 of 20 10.0 Points
Read the passage and answer the following:
FINDING A JOB 
            Not so long ago almost any student who successfully completed a university degree or diploma course could find a good career quite easily. Companies toured the academic institutions, competing with each other to recruit graduates. However, those days are gone, even in Hong Kong, and nowadays graduates often face strong competition in the search for jobs. 
                 Most careers organizations highlight three stages for graduates to follow in the process of securing a suitable career: recognizing abilities, matching these to available vacancies and presenting them well to prospective employers. 
              Job seekers have to make a careful assessment of their own abilities. One area of assessment should be of their academic qualifications, which would include special skills within their subject area. Graduates should also consider their own personal values and attitudes, or the relative importance to themselves of such matters as money, security, leadership and caring for others. An honest assessment of personal interests and abilities such as creative or scientific skills, or skills acquired from work experience, should also be given careful thought. The second stage is to study the opportunities available for employment and to think about how the general employment situation is likely to develop in the future. To do this, graduates can study job vacancies and information in newspapers or they can visit a careers office, write to possible employers for information or contact friends or relatives who may already be involved in a particular profession. After studying all the various options, they should be in a position to make informed comparisons between various careers. 
                   Good personal presentation is essential in the search for a good career. Job application forms and letters should, of course, be filled in carefully and correctly, without grammar or spelling errors. Where additional information is asked for, job seekers should describe their abilities and work experience in more depth, with examples if possible. They should try to balance their own abilities with the employer’s needs, explain why they are interested in a career with the particular company and try to show that they already know something about the company and its activities. When graduates are asked to attend for interview, they should prepare properly by finding out all they can about the prospective employer. Dressing suitably and arriving for the interview on time are also obviously important. Interviewees should try to give positive and helpful answers and should not be afraid to ask questions about anything they are unsure about. This is much better than pretending to understand a question and giving an unsuitable answer. There will always be good career opportunities for people with ability, skills and determination; the secret to securing a good job is to be one of them. 

Question: In paragraph 3, ‘three stages for graduates’ refers to: 
A. all of the above
B. stages in the assessment of personal interests
C. stages in the process of securing a suitable career
D. stages for the completion of a university degree or diploma course .

Answer Key: C 

# Question 16 of 20 10.0 Points
Read the passage and answer the following: 
FINDING A JOB 
                Not so long ago almost any student who successfully completed a university degree or diploma course could find a good career quite easily. Companies toured the academic institutions, competing with each other to recruit graduates. However, those days are gone, even in Hong Kong, and nowadays graduates often face strong competition in the search for jobs. 
                   Most careers organizations highlight three stages for graduates to follow in the process of securing a suitable career: recognizing abilities, matching these to available vacancies and presenting them well to prospective employers. 
                       Job seekers have to make a careful assessment of their own abilities. One area of assessment should be of their academic qualifications, which would include special skills within their subject area. Graduates should also consider their own personal values and attitudes, or the relative importance to themselves of such matters as money, security, leadership and caring for others. An honest assessment of personal interests and abilities such as creative or scientific skills, or skills acquired from work experience, should also be given careful thought. The second stage is to study the opportunities available for employment and to think about how the general employment situation is likely to develop in the future. To do this, graduates can study job vacancies and information in newspapers or they can visit a careers office, write to possible employers for information or contact friends or relatives who may already be involved in a particular profession. After studying all the various options, they should be in a position to make informed comparisons between various careers. 
                   Good personal presentation is essential in the search for a good career. Job application forms and letters should, of course, be filled in carefully and correctly, without grammar or spelling errors. Where additional information is asked for, job seekers should describe their abilities and work experience in more depth, with examples if possible. They should try to balance their own abilities with the employer’s needs, explain why they are interested in a career with the particular company and try to show that they already know something about the company and its activities. When graduates are asked to attend for interview, they should prepare properly by finding out all they can about the prospective employer. Dressing suitably and arriving for the interview on time are also obviously important. Interviewees should try to give positive and helpful answers and should not be afraid to ask questions about anything they are unsure about. This is much better than pretending to understand a question and giving an unsuitable answer. There will always be good career opportunities for people with ability, skills and determination; the secret to securing a good job is to be one of them. 

Question: ‘each other ‘ in paragraph 2 refers to: 
 A. available vacancies
B. career organizations
C. three stages
D. job seekers

 Answer Key: B 

# Question 17 of 20 10.0 Points
Choose the correct option. We_________ around the parking lot for 20 minutes in order to find a parking space. 
A. driven
B. drive
C. drove
D. drived

Answer Key: C 
# Question 18 of 20 10.0 Points
Choose the correct option: 
a)While I was writing the email, the computer suddenly went off. 
b) When I write letters, the computer goes off. 
c) Writing letters make my computer go off 
A. None of the above
B. c
C. b
D. a

Answer Key: D 
# Question 19 of 20 10.0 Points
Identify the tense: A rhinoceros was swatting flies with his tail when suddenly a fly bit him 
A. Past Progressive 
B. Past Simple
C. Past perfect continuous
D. Past perfect

Answer Key: A 
# Question 20 of 20 10.0 Points
Choose the correct option: Not again! This is the third time that I ……. my keys since I …….. home this morning. 
A. had lost/left
B. am losing/was leaving
C. will lose/have left
D. lose/had left
E. have lost/left

Answer Key: E 

TCS Tech JAVA Final

TCS Tech JAVA Final | 2018

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”
           

class Base{
            public int varOne = 1000;
            public int varTwo = 2000;
            public int varThree;
            void display(){
                       
            }
}
class Derived extends Base{
            public int varThree = 10;
            void display(){
                        System.out.println("varOne:"+varOne);
            }
            void disp(){
                        int varThree = 100;
                        System.out.println("varTwo:"+varTwo);
                        System.out.println("varThree:"+varThree);
                        System.out.println("varThree:"+super.Three);
            }
}
class Demo{
            public static void main(String s[]){
                        Derived ob1 = new Derived();
                        ob1.display();
                        ob1.disp();
            }
}

Ans: ( b ) varone: 1000varTwo: 2000varThree:100varThree:0


Value return on reaching end of file in Writer class?
Ans: -1

Which of the following statements about array is syntactically wrong? Assume that in the options, datatype is any valid datatype in java
Ans: datatype p[5];

What command is used to remove the directory?
Ans: rmdir

TRIM function in oracle will trim off unwanted characters from both sides of string.
Ans: TRUE.


Is readFloat() of DataInputStream static?
Ans: True

class Test{
            public static void main(String[]args){
                        int x = 20;
                        String sup = (x<15)?"small":(x<22)?"tiny" : "huge";
                        System.out.println(sup);
            }
}
What is the output of above code snippet?
Ans: tiny

These methods doGet(), doPost(),doHead,doDelete(),doTrace() are used in ?
Ans: HttpServlets


What is the return type of skip() method of InputStreamReader?
Ans:  long


Compile time exception is when the compiler gives error for improper syntax in code like forgetting a semicolon.
Ans: True


What is the return type reset() methd in BufferedInputStream?
Ans: void


String s ="hello";
String t=s;
t=s+"world";
System.out.println(s);
Ans: hello


public class Test{
            public static void main(String[]args){
                        String a = "1";
                        String b = "2";
                        System.out.println((a+b).length());
            }
}
Ans: 2


How to declare that age is a variable of type integer with initial value 20 in java?
Ans: int age=20;


CREATE SEQUANCE seq_testing MINVALUE 3 START WITH 2 INCREMENT BY 5
Select the true statement based on the above code:
Ans:  On trying to create it will give error. STARTWITH cannot be less than MINVALUE


Which of the following are valid array declarations?
Ans: double []arr=new double[10];
Select the checked exception from the following options:
Ans: ParseException

public class Example{
            public static void main(String args[]){
            Object error=new Error();
            Object runtimeException = new RuntimeException();
            System.out.print((eror instnaceofException)+",");
            System.out.print(runtimeExceptioninstnaceofException);
           
            }
           
}

Ans: Prints: false,true


How many numeric data types are supported In java?
Ans: 6


public class Bank{
            public void getBankName(){
                        System.out.println("Bank");
            }
}
public class Icici extends Bank{
            public void getBank(){
                        System.out.println("ICICI");
            }
            public static void main(String args[]){
            Bank bank = new Icici();
            bank.getBankName();
            bank.getBank();
           
            }
           
}          

Ans: CompilerError


Which method is used to remove leading and trailing whitespaces in String?
Ans: trim();




Class A inherited by classes B and C. Assume we have a method in class A which both class B & C overrides. Now if Class D is extending both B & C and d wants to override the same method an ambiguity will result. This problem is called_ _
Ans: diamond problem


Which of the following is TRUE regarding Abstraction?
Ans: Abstraction exposes essential details while hiding the non-essential details


Which of the following method is used to return a Set that contains the entries in a map?
Ans: entrySet()


When a method can throw an exception then it is specified by _ _ _ keyword
Ans:  Throws


Which of these interface handle sequences?
Ans: List

                                                                                  
Java source code is case _ _ _ _ ?
Ans: sensitive


Which of these is an incorrect Statement?
Ans: It is necessary to use new operator to initialize an array


Which of the following are the five built-in functions provided by SQL?
Ans: COUNT, SUM, AVG, MAX, MIN



Which of the following is a valid declaration of an object of class Box?
ANS: Box obj = new Box();


class Demo{
            Demo(char status){
                        System.out.println("Parameterized constructor");
            }
            public static void main(String[]args){
                        Demo ob = new Demo('A');
            }
}
Ans: This code will compile as the default constructor is not used in main()


In BufferedOutputStream, the method notify is inherited from:
Ans: java.lang.Object


What is the return type of read() method in BufferedReader class?
Ans: Boolean


Generics, enumerations supported by
Ans:  java SE2


Which of the following is not true about modifying rows in a table?
Ans: You can update more than one row at a time.


_ _ _ _ in java identifies and discards the objects that are no longer needed by a program so that their resources can be reclaimed and reused.
ANS: Garbage collection

_ _ _ _ _ is also known as static variable
ANS: Class variables


FileReader is meant for reading streams of characters. For reading streams of raw bytes, use FileInputStream.
Ans: True


Which exception does close() method throw in BufferedReader class?
Ans: IO Exception


What type of exception can readLine() of DataInputStream throws?
Ans: IOException


What is the return type of write() method in BufferedWriter Class?
Ans: void()


In which Package Writer classes are defined?
Ans: java.io

When three or more AND and OR conditions are combined, it is easier to use the SQL keywords:
Ans: Both IN and NOT IN


Emp_Bonus table has the following data.
Employee bonus
A 1000
B 2000
A 500
C 700
B 1250
What is the SQL query to get the employees who received bonus more than $1,000?
Ans:  c select employee, sum(bouns) from emp_bonus group by employee having sum(bonus)>1000;


What does write(int x) of BufferedOutputStream do?
Ans: Writes the specified bytes to output stream


Which of he following is not true about the database objects?
Ans: Views give alternative names to objects.


The method forward(request,response) will
Ans: Return back to the same method from where the forward was invoked


Which method returns a string containing the unique session id?
Ans: getId()


Which of these classes is used for input operation when working with bytes?
Ans: InputStream


Which of the following is true?
Ans: all of the above
a.    Enum in java is a data type
b.    Enum can have fields, constructors and methods
c.    Enum may implement many interfaces but cannot extend any class because it internally extends Enum class



Which of the following is statements are true?
Read(byte[] b)



What is the exception thrown by write() of DataOutputStream class?
Ans: IOException


public class Sample{
            public static void main(String args[]){
            Employee[] e1=new Employee[10];
            Employee emp = new Employee(1,"A");
            System.out.println(e1[0].id);
           
            }          
}
class Employee{
            int id;
            String name;
            Employee(int i, String s)
            {
                        id=i;
                        name=s;
            }
}

Ans: Runtime Error

The expected signature of the main method is public static void main(). What happens if we make a mistake and forget to put the static void keyword? Assume that we are executing using command prompt?
Ans: The JVM fails at runtime with NoSuchMethodError


1.      Which interface does DataInputStream implements?
Ans: DataInput

3. Will this code compile?

class Demo
{
Demo(char status)
{
System.out.println("Parameterized constructor");
}
public static void main(String args[])
{
Demo ob=new Demo('A');
}
}
Ans: This code will compile as the default constructor is not used in main()

4. Which method is used to print the description of the exception?

Ans: printStackTrace()

5. The method forward(request,response) will

Ans: return back to the same method from where the forward was invoked

6. Select a query that retrieves all of the unique coursename from the student table?

Ans: SELECT DISTINCT coursename FROM studentinfo;

7. Which of the following is true?

Ans: all of the above (Enum in java is a data type, enum can have fields, constructors and methods, enum may implement many interfaces but cannot extend any class because it internally extends Enum class)

8. ON UPDATE CASCADE ensures which of the following?

Ans: Data Integrity

9. public class Test{

public static void main(String args[]){
String obj="I LIKE JAVA";
System.out.println(obj.charAt(5));
}
}
What is the output of above program?
Ans: E

10. class Equals

{
public static void main(String args[])
{
int x=100;
double y=100.1;
boolean b=(x=y); /*Line 7*/
System.out.println(b);
}
}
What is the output of above code snippet?
Ans: Compilation fails

11. Which of the following interprets html code and renders webpages to user?

Ans: browser

12. Which normal form is considered adequate for relational database design?

Ans: 3NF

13. What type of exception can readLine() of DataInputStream throws?

Ans: IOException

14. Which of these is method is used for writing bytes to an OutputStream?

Ans: write()

15. Is Java an open source software language?

Ans: Yes, Its an open source

16. Which of these are the subclasses of InputStream class?

Ans: All of the mentioned (AudioInputStream, ByteArrayInputStream, FileInputStream)

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

Ans: int

18. Every statement in java programming language ends with

Ans: Semicolon

19. All the methods in an interface are_______and________by default

Ans: Public, abstract

20. A stream that is intended for general purpose IO, not usually character, data, is called..

Ans: ByteStream

21. Parameter of______datatype is accepted by skipBytes()?

Ans: int

22. Which of these interface is not a member of java.io package?

Ans: ObjectFilter

23. Is the read function of DataInputStream class overridden?

Ans: True

24. Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?

Ans: append()

25. The reset method of BufferedInputStream accepts parameters

Ans: False

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

47. How many numeric data types are supported in Java?

Ans: 6

48. java.exe can be found at which 2 places in JDK directory?

Ans: JAVA_HOME\jre\bin

49. public void write(int b) of FileOutputStream implements the write method of OutputStream

Ans: True

50. The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resource, it may be servlet, jsp or html file?

Ans: True

51. Arrays when passed to a method they are always passed by refernce. Is this true or false?

Ans: True

52. JVM is available for:

Ans: All popular Operating Systems

53. Which of these can be thrown using the throw statement?

Ans: All the above (a) Error, b) Throwable, c) Exception)

54. Which of the following is the data query statement in QUEL?

Ans: SELECT

55. How many techniques are used in Session Tracking?
Ans: 4.0

56. is write() method in BufferedWriter class overloaded?
Ans: True

57. Fork is 
Ans: The creation of a new process

58. JDK7 introduced a new version of try statement known as____
Ans: try-with-resources statement

59. How many parameter does the readBoolean() of DataInputStream accepts?
Ans: 0

60. Java is a______independent language
Ans: Platform

61. What is the return type of close() method in BufferdReader class?
Ans: void

62. What is the output of the code

public class test{

public static void main(String args[]){
int i=1,j=1;
try{
i++;
j--;
if(i/j>1)
i++;
}
catch(ArithmeticException e){
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println(1);
}
catch(Exception e){
System.out.println(2);
}
finally{
System.out.println(3);
}
System.out.println(4);
}
}
Ans: 0,3,4

63. A file containing relatively permanent data is
Ans: Master File

64. Which of the following are the five built-in functions provided by SQL?
Ans: COUNT, SUM, AVG, MAX, MIN

65. It is a good practice to put the cleanup code(like closing Connection or PrintWriter object) in______block, even when no exceptions are anticipated.
Ans: finally

66. Which life cycle method make ready the servlet for garbage collection
Ans: destroy

67. reset() have boolean return type in BufferedReader class
Ans: True

68. Subclass of Writer class is?
Ans: StringWriter

69. Development tools are
Ans: Both A and B ( a) compiler, b) java application launcher )

70. The expected signature of the main method is public static void main(). What happens if we make a mistake and forget to put the static keyword? Assume that we are executing using command prompt.
Ans: The JVM fails at runtime with NoSuchMethodError

71. Which of these class is used to read characters in a file?
Ans: FileReader

72. readLine() method have integer return types in BufferedReader class.
Ans: False

73. Java is an interpreter that interprets the byte code into machine dependent code and executes program
Ans: True

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

75. What checks the code fragments for illegal code that can violate access right to objects?
Ans: Bytecode verifier

76. What MySQL property is used to create a surrogate key in MySQL?
Ans: AUTO_INCREMENT

77. Program counter register is a type of area allocated by_____
Ans: none of these

78. What is the output of the below code?
class MyClass
{
int i;
float j;
public static void main(String[] args)
{
System.out.println("i="+i+"j="+j);
}
}
Ans: i=0 j=0.000000

79. Both Primary key and unique key allows NULL
Ans: false

80. What is the return type of read() method of InputStreamReader?
Ans: int

81. Which of the following require large computer memory?
Ans: All of the mentioned (Imaging, Graphics, Voice)

82. The tracks on a disk which can be accessed without repositioning the R/W heads is
Ans: Cylinder

83. Which will legally declare, construct and initialize an array?
Ans: int myList[]={4, 3, 7};

84.______in Java identifies and discards the objects that are no longer needed by a program so that their resources can be reclaimed and reused
Ans: Garbage Collection

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

86. A non-correlated subquery can be defined as____
Ans: A set of one or more sequential queries in which generally the result of the inner query is used as the search value in the outer query

87. What is the fullform of WORA?

Ans: Write Once Run Anywhere

88. Is readByte() of DataInputStream final?
Ans: True

89. When three or more AND and OR conditions are combined, it is easier to use the SQL keyword(s):

Ans: Both IN and NOT IN

90. What type of exceptions can readFloat() of DataInputStream throws?
Ans: IOException

91. Arrays when passed to a method they are always passed by reference. Is this true or false?

Ans: true

92. A______file contains bytecodes
Ans: .class

93. Servlets handle multiple simultaneous requests by using threads?
Ans: True


94. In BufferedOutputStream, the method notify is inherited from:
Ans: java.lang.object

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

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

In BufferedOutStream, the method finalize is inherited from:
ANS: java.lang.Object

Subclass of Outputstreamwriter is _ _ _ -
ANS: FileWriter

LIKE operator is used for pattern matching?
Ans: true

Which of the following is FALSE Regarding String methods?
ANS:  Object equals(object another) (bcz equals returns Boolean)

If a statement tries to divide by zero which exception is thrown?
ANS: ArithmeticException

Java.io.FileOutputStream extends from which class?
ANS: java.io.OutputStream


Which of the following is not true in case of an interface?
i.                    Interface cannot be instantiated
ii.                  All methods in interface are abstract
iii.                An interface can inherit multiple interfaces are abstract
iv.                 An interface contains instance fields
ANS:  I, ii, iii are correct

public class Test1{
                                public static void main(String[]args){
                                    int i=1;
                                    do{
                                                i++;
                                    }while(i<10);
                                                System.out.println(i);
                                }
}
ANS: 10

Using mail API we cannot send mail from a servlet?
ANS:  false

Which statement will return true if atleast one condition is true?
ANS: (condition1 | | condition2)

Public static void main(String args[])
{
Int acsii[] = {65,66,67,68};
String s  = new String(ascii,1,3);
System.out.println(s);
}
}
ANS: BCD

What will be the output of the below program?
Public class Test{
Public static void main(String[] args){
String value = “abc”;
changeValue(value);
System.out.println(value);
}
Public static void changeValue(String a){
A=”xyz”;
}
}
ANS: abc

Byte Stream Classes support input/output operations on _ _ _ _ bytes:
ANS: 8 bit byte

Public static void main(String args[]){
Int I,j,k,l=0;
K=l++;
J=++k;
I=j++;
System.out.println(i);
}
}
ANS: 1

The close method of BufferedInputStream accepts parameters.
ANS: false

The relational model is based on the concept that data is organized and stored in two-dimensional tables called _ _ _
ANS: Relations

Objects are stored on stack
ANS: false

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

Which of the following is true?
Ans: all of the above ( Enum in java a data type, Enum can have fields, constructors and methods, enum may implement many interfaces but cannot extend any class because it internally Enum class)

 On UPDATE CASCADE ensure which of the following?
ANS: Data integrity

A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer he input and to support thre mark and reset methods. True/False?
ANS: TRUE

If parent class method is public, Child class can override the method if visibility of the method is _ _ __
ANS: only public

Enum can extend other Enum
ANS: False

Which of these class is not related to input and output stream in terms of functioning?
ANS: File

Available() method throws IOException
ANS: True

public class Test{
                                public static void main(String[] args){
                                    try{
                                                throw new Exception();
                                    }catch(Exception e){
                                                System.out.println("Hello");
                                    }finally{
                                                System.out.println("No Error");
                                    }
                                   
                                }
}
ANS: Hello No Error

How many servlet context is available for an application
ANS: 1.0

Which of these classes can return more than one character to be input stream
ANS:  PushbachReader

_ _ _ _ are declare in a class, but outside method, constructor or any block.
ANS: Instance variables

What is the return type of readLine() method in Bufferedreader class?
ANS:  String

public class test{
                                public static void main(String[] args){
                                    int numValue = 5;
                                    System.out.println(++numValue);
                                    System.out.println(numValue++);
                                }
}

ANS: 6,6

Public InputSreamReader(InputStream in, String enc) throws _ _ _ _
ANS: UnsupportedEncodingException

Binary numbers need more places for counting because
ANS: Binary base is small

The parameter of the PreparedStatement object are _ _ _ _ when the user clicks on the Query button.
ANS: Initilized

Create domain YearlySalary numeric(8.2) constraint salary value test _ _ _ _; In order to ensure that an instructor’s salary domain allows only values greater than specified alue use:
ANS: check(value >= 29000.00)

Wallet has money but money doesn’t need to have Wallet necessarily. Which class relationship better explains this scenario?
ANS: Aggregation
The SELECT command, with its various clauses, allows users to query the data contained in the tables and ask many different questions or ad hoc queries.
ANS: True

JDBC is a _ _ _ _ interface, which means that it is used to invoke SQL commands directly
ANS: low-level

public class precedence{
                                public static void main(String[] args){
                                    int i = 0;
                                    i= i++;
                                    i= i++;
                                    i= i++;
                                    i= i++;
                                    System.out.println("The value of is"+i);
                                    int arr[] = new int[5];
                                    int index = 0;
                                    arr[index] = index = 3;
                                    System.out.println("The value of first element is"+arr[0]);
                                    System.out.println("The value of fourth element is"+ arr[3]);
                                }
}
ANS: all of the above
The value of i is 0
The value of first element is 3
The value of fourth element is 0

Which of the following has child class?
ANS: FilterReader

Which of these operator is used to allocate memory to array variable in java
ANS: new

What are the key elements of Problem Solving?
ANS:  ALL of these ( declarative & Imperative Knowledge, Good analytical Skills)

public class Exam1{
                                public static void main(String[] args){
                                    int a=5;
                                    int b=2;
                                    int c=a-b;
                                    if(c=3){
                                                System.out.println("Thats correct");
                                    }else{
                                                System.out.println("thats worng");
                                    }
                                }
}
ANS: Compile error

JRE stands for java _ _ _Environment
ANS: Runtime

Which statement is true?
1.      Serialization applies only to OBJECTS
2.      Static variables are NEVER saved as part of the objet state.So static variables are not Serializable.
ANS: Both statements 1&2

Issuing commit command does which of the following
ANS: Release all savepoints

Which of the following is the weakest relationship
ANS: Dependecy

Which of these contain heterogenous objects
ANS: ArrayList

How many parameter does readBoolean() of DataInputStream accepts?
Ans: 0

Which is not method of InputStreamReader
ANS: open()

For a static field, regardless of the number instances created, will hold the same data across all objects
ANS: TRUE

Single line comment starts with _ _ _ in java
ANS: //

What is the name of the stream that connects two running programs?
ANS: Pipe

Hotspot is an implementation of the JVM concept.It provides
ANS: garbage collector


Which method returns the time when the session was created?
ANS: getCreateTime()

public class precedence{
                                public static void main(String[] args){
                                int num = 10;
                                switch(num){
                                    case 8: System.out.println("The selection is 9");
                                    break;
                                    case 20: System.out.println("The selection is 20");
                                    break;
                                    case 30: System.out.println("The selection is 30");
                                    break;
                                    case 40: System.out.println("The selection is 40");
                                    break;
                                    default: System.out.println("Invalid Selection");
                                }
                                }
}
ANS: Invalid selection

To execute a stored procedure <??totalStock>?? in a database server, which of the following code snippet is used?
ANS: CallableStatement clbstmnt = con.prepareCall("{call totalStock}"); cs.executeQuery();

What class is extended by DataOutputStream class?
ANS: FilterOutputStream

Which of these class is used to read and write bytes in a file
ANS: FileInputStream

Evaluate the following command:
CREATE TABLE employees(employee_id NUMBER(2) PRIMARY KEY, last_name VARCHAR2(25) NOT NULL, department_id NUMBER(2), job_id VARCHAR2(8), salary NUMBER(10,2));

You issue the following command to create a view that displays the last names of the sales staff in the organization:
CREATE OR REPLACE VIEW sales_staff_vu AS SELECT employee_id, last_name,job_id FROM employees WHERE job_id LIKE ‘SA_%’ WITH CHECK OPTION;
Which two statements are true regarding the above view? (Choose two.)
A. It allows you to insert rows into the EMPLOYEES table .
B. It allows you to delete details of the existing sales staff from the EMPLOYEES table.
C. It allows you to update job IDs of the existing sales staff to any other job ID in the EMPLOYEES table.
D. It allows you to insert IDs, last names, and job IDs of the sales staff from the view if it is used in multitable INSERT statements.
ANS: B,D
What type of exception can all the function of DataInputStream throws?
ANS: IOException
BufferedWriter class Extends_ _ _ _
ANS: Writer

Why we use array as a parameter of main method
ANS: both of the above( for taking input to the main method, can store multiple values)

public class Exam1{
                                public static void main(String[] args){
                                for(int j=0;j<3;j++){
                                    for(int i=0;i<3;i++){
                                                if(i<2){
                                                            break;
                                                }
                                    }
                                    System.out.println("i="+i);
                                    System.out.println("j="+j);
                                }
                                }
}
ANS: Compile time error

Which of these keywords is used to refer to member of base class from a sub class?
ANS: super

Which of these method of String class is used to obtain character at specified index?
ANS: charAt()

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


Close() method closes this input stream and releases any system resources associated with the stream
ANS: YES

The _  _ _ _ method sets the query parameters of the PreparedStatement Object.
ANS: setString()

Which command deletes all information about relation from the database?
ANS: drop table

Java.io.FileInputStream extends from which class?
ANS: java.io.InputStream

Which servlet interface contain life cycle methods
ANS: Servlet

Find the SQL statement below that is equal to the following:
SELECT NAME FROM CUSTOMER WHERE STATE =’VA’;
ANSSELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');
What interface is implemented by DataOutputStream class?
ANS: DataOutput

class output{
                                public static void main(String[] args){
                                String a = "hello i love java";
                                System.out.println(a.indexOf('i')+" "+a.indexOf('o')+" "+a.lastIndexOf('i')+" "+a.lastIndexOf('o'));
                                }
}
ANS: 6 4 6 9

The webserver that executes the servlet creates an _ _ _ _ and passes this to servlets service method(which inturn passes to doget and dopost)
ANS: HttpServlet


public class Sample
{
                                public static void main(String[] args){
                                int[] myArray = new int[3];
                                for(int x:myArray)
                                {
                                    System.out.print(x);
                                }
                                }
}

Ans: 000


Java platform consists of below components.
ANS: Java API, JVM


An InputStreamReader is a bridge from byte streams to ……………………streams.
ANS: Character


What can be appended to Writer class using append() ?
ANS: Character

When you create a FileOutputStream you can decide if you want to overwrite any existing file with the same name, or if you want to append to any existing file.
ANS: True

Reader class is a final class ?
ANS: False

What command is used to compile a Java program eg. Test.java
ANS: javac Test.java

Which method of Writer class is not implemented by subclass ?
ANS: read()

What value does readLine() return upon encountering end-of-file ?
ANS:  null

Can a stream act as a data source for another stream?
ANS:  Yes. Some streams can be connected together.

What is a stream that transforms data in some way called ?
ANS: Processing stream

SELECT * FROM Table1 HAVING Column1 > 10
ANS: The result will be all rows from Table 1 which have Column1 values greater than 10.

Which of the following invokes function in SQL
ANS: Callable statements

The equals method only takes Java objects as an argument , and not primitives, passing primitives will result in a compile time error.
ANS: True

Which of these keywords is not a part of Java exception handling ?
ANS: thrown

A floppy disk contains
ANS: Both circular tracks and sector


public class StringComp{
                       public static void main(String[] args){
                      
                       String s1= "rahul";
                       String s2= "rahul";
                       String s3= new String("459029");
                       String s4= new String("459029");
                       System.out.print(s1.equals(s2));
                       System.out.print((s1==s2));
                       System.out.print(s3.equals(s4));
                       System.out.print((s3==s4));
                      
                      
                       }
}
ANS: true true true false


In BufferedReader what method is used to notify the operating system that a file is no longer needed ?
ANS: close()

In Servlet Terminology what provides rentime environment for JavaEE(j2ee) applications. It performs many operations that are given below: 1. Life Cycle Management 2.Multithreaded support 3. Object Pooling 4.Security etc
ANS: Container

The DTD defines the structure of XML documents
ANS: True

Choose the incorrect one among the following choices:
ANS: List<int> I = new ArrayList<int>();

Select the equivalent answers for the code given below ?

Boolean b=true;
If(b){
x=y;
}else
{ x=z;}
                                            
ANS: x=b ? x=y : x=z;

Which one of the following will declare an array and initialize it with five numbers
ANS: int [] a={23,22,21,20,19};

Which statement about HttpSession is not true ?
ANS: A session will become invalid as soon as the user close all the browser window


What are the methods declared by the Iterators
ANS: All of the above  [ Boolean hasNext(), Object next(), void remove();

…………….. are the list of arguments that come into function.
ANS: Parameters

public class Test{
                                             public static void main(String[] args){
                                             display(null);
                                             }
                                             private static void display(String str)
                                             {
                                                if(str==null)
                                                            throw new NullPointerException();
                                                else
                                                            System.out.println("String is :"+str);   }
}
ANS: Null Pointer exception will occur if the program is run.



CREATE TABLE product
(pcode NUMBER(2),
pnameVARCHAR2(10));
INSERT INTO product VALUES(1, 'pen');
INSERT INTO product VALUES (2,'penci');
SAVEPOINT a;
UPDATE product SET pcode = 10 WHERE pcode = 1;
SAVEPOINT b;
DELETE FROM product WHERE pcode = 2;
COMMIT;
DELETE FROM product WHERE pcode=10;
ROLLBACK TO SAVEPOINT a;
ANS: Both the DELETE statements and the UPDATE statement would be rolled back




CREATE TABLE CUSTOMER(customerid NUMBER(3,2),customername VARCHAR2(10));
INSERT INTO CUSTOMER VALUES(1,’a’);
ALTER TABLE CUSTOMER ADD constraint chk_lenght_5 CHECK (length(customername)>5);
ANS: It will add the constraints to check that customername should have minimum 5 characters

The_ _ __ __ _ __ method executes a simple query and returns a single Result Set object.
ANS: executeQuery
How many constructors are there in DataInputStream class?
ANS: 1
public class precedence{
            public static void main(String[] args){
           
            StringBuffer stb = new StringBuffer("yadroh");
            // line4 //
            System.out.println(stb.toString());
            }
}
ANS: stb.replace(3,4,”li”).reverse();

You need to create a table for a banking application with the following considerations:
1.      You want a column in the table to store the duration of the credit period
2.      The data in the column should be stored in a format such that it can be easily added and substracted with
3.      Data type data without using the conversation functions
4.      The maximum period of the credit provision in the application is 30 days
5.      The interest has to be calculated for the number of days an individual has taken a credit for.
Which  data type would you use for such a column in the table?
ANS: INTERAL DAY TO SECOND


Which of these method of InputStream is used to read integer representation of next available byte input?
Ans: read()

FileWriting class ___ from the InputStreamWiter class
ANS: inherits

Which method is not present in HttpServlet class
Ans: service

JDK consists of
ANS: all of the above(tools for development, JRE, JVM)

How many copies of a JSP page can be in memory at a time?
ANS: one


If the client has disabled cookie in the browser, which session management mechanism could the web container employ?
ANS: Session Management using URL Rewriting

class Super{
            void show(){
                        System.out.println("parent");
            }
}
public class Sub extends Super{
            void show()throws IOException{
                        System.out.println("Child");
            }
            public static void main(String[]args){
                        Super s = new Sub();
                        s.show();
            }
}
ANS: compile error

StringBuffer Objects are mutable objects?
ANS: True


public class Operators1{
            public static void main(String[]args){
                        double x=6;
                        int y=5,z=2;
                        x=y++ + ++x/z;
                        System.out.println(x);
            }
}
ANS: 8.5

Automatically when the view is dropped.
E. The OR REPLACE option is used to change the definition of an existing view without dropping and recreating it.
F. The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view.

Which of the following must be true of the object thrown by a thrown statement?
ANSIt must be assignable to the Throwable type

What will this code print?
Int arr[] = new int[5];
System.out.print(arr);
ANS: Garbage Value

What does read(char[] cbuf, int off, int len) of InputStreamreader do?
ANS: Reads characters into a portion of an array

The default initial values of the data members in Employee class for string name and int id are
ANS: null, 0

Which class handle any type of request so it is protocol-independent?
ANS: GenericServlet

Java is a_ _ __ independent language.
Ans: Platform

 What is the return type of skipByte() func in DataInputStream class?
ANS: int

Aceess modifier can beused for local variables
Ans: false


Which of the following languages is more suited to a structured program?
Ans: Pascal

What is the limit of data to be passed from HTML when doGet() method is used?
ANS: 2k

Switch(x){
Default: System.out.println(“Hello”);
}
Which two are acceptable types of for x?
1.      byte
2.      long
3.      char
4.      float
5.      Short
6.      Long
ANS: 1 and 3

For a 2 tier architecture
1.      Presentation layer in one machine and Business & Resource layer is available in different machine.
2.      Presentation & Business layer in one machine and Resource layer in another machine. Which of the below statements Is true.
ANS: Both statements are true

An Input device which can read characters directly from an ordinary piece of paper is
Ans: OCR

parseInt() and parseLong() method throws__ ___  _ _ _ ?
Ans: NumberFormatException

To explicitly throw an exception, _ _ _ _ keyword is used.
Ans: throw

How many parameters does the skipByte() accept in DataInputStream class?
Ans: 1

Is the skipByte() of DataInputStream final
Ans: false




Public class Exam1{
Private int a;
Public static void main(Strings[]arg){
/* complete the code using the options so that O is printed in console*/
}           }
ANS: System.out.println(new Exam1().a);
class AccountHolder{
            public AccountHolder(int count){
                       
            }
}
class Account{
            Account(){
                       
            }
}
class Demo{
            public static void main(String[]args){
                        AccountHolder accountholder;
                        accountholder = new AccountHolder();
                        Account accountOne = new Account();
                        Account accountTwo = new Account();
                        Account accountThree = accountTwo;
                        accountThree = accountOne;            
            }
}           while executing the above code, how many reference variable and objects will be crrated
Ans: 3 Objects and 4 references

InputStream class has one constructor.
Ans: True

Java has the characteristic
Ans: All of the above( Portable, Robust, Architecture neutral)

A deployment descriptor describes
Ans: web component settings

What data type does readLine() return?
Ans: String

Which among the following is wrong?
Ans: abstract class can have only static final(constant) variable i.e, by default

What is the result of x when the following loop exists?
Int x=0;
For(in i=0;i<10;i++){
if(i==5){
Continue; }
X++;
}
Ans: 9

String s =”kolkatta”.replace(‘k’,’a’) ?
What would the string “s” would contain after successful execution of the above statement?
Ans: aolaata

The below query returns the students whose age is between 20 to 24 including 20 and 24 also. Select * from Student where Age BETWEEN 20 AND 24
Ans: TRUE

Which life cycle method is called only once in the serbvlet life cycle
Ans: init()

FAQs of BCG

These are the some FAQS of BCG PLEASE USE BELOW LINK Details and FAQS of BCG