Thursday, 28 February 2019

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

ASP.NET Core: How to implement Azure Active Directory (AAD) Authentication in ASP.NET Core

  In this tutorial, we will implement security for ASP.NET Core Application using Azure Active Directory (AAD).  In this tutorial, I will co...