Wednesday, 27 May 2020

AsCEnD Advanced Java Programming

Java Advanced & Java Part 1 Advanced Assessment

Q1. Which of the following statements are correct?

Answer: Strings in java are immutable.
              Every string is an object of class String.
              StringBuffer class is used to store string in a buffer for later use.
              Java defines a peer class of String, called StringBuffer, which allows string to be altered.

Q2. Which of the following is not a wrapper class in java?

Answer: Char

Q3. Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?

Answer: java util ArrayList

Q4. Which of these are runtime exceptions in JAVA ?

Answer: NullPointerException
              ArrayIndexOutOfBoundsException

Q5. Why are generics used?

Answer: Generics add stability to your code by making more of your bugs detectable at compile time.

Q6. To explicitly throw an exception, the keyword _______ is used

Answer: throw

Q7. ArrayList is synchronized

Answer: false

Q8. Which of the following statement is incorrect?

Answer: FileNotFoundException is a runtime exception

Q9. Is it possible to do both of the following. Override protected method to public Override protected method to private

Answer: Only option 1 is possible. You can override protected to public, but not protected to private.

Q10. Which of these interfaces only store unique elements?

Answer: Set

Q11. Select one or more true statements

Answer: 
List implementation dynamically grow in size, allow duplicates and are implicitly not sorted
A set does not store duplicate values
HashMap and Hashtable both store key value pairs, Hashtable we would use in case of synchronization requirements.
All Set implementations are sorted

Q12. Which of these is a correct statement?

Answer: 
Abstract class can be inherited.
Abstract class defines only the structure of the class not its implementation.
Every class containing abstract method must be declared abstract.

Q13. A method can specify its ability to throw an exception by using the ______ keyboard.

Answer: Throws

Q14. Is it possible to define a class so that it cannot be subclassed?

Answer: Yes, by making the class final

Q15. Which of the following statement is incorrect?

Answer: final methods can be overridden

Q16. public class Test{
public static void main(String args[]){
int k=0;
try{
 int i=5/k;
}
catch (ArithmeticException e){
System.out println("1");
}
catch (RuntimeException e){
System out println("2");
return
catch (Exception e){
System.out.println("3");
}
finally{
System.out.println("4");
}
System.out println("5");
}
}
What would be the output of above program?

Answer: 145

Q17. Assume we have the following classes

class ParentClass
{
int id;
class ChildClass extends ParentClass
{
String name;
}
public class MainClass
{
{
//Withings go here
}
}
Which statements are valid to use in our main method?

Answer: ChildClass x = new ChildClass();
       ParentClass x = new ParentClass();
       ParentClass x = new ChildClass();

Q18. Would this program compile?

interface A{
public void method 1();
}
interface B{ 
public void method 1();
}
public class Test implements A, B{
public void method 1(){
}
}

Answer: Yes, It will compile successfully.

Q19. What will be the output?
try{
int x=;
int y = 5/x;
}
catch (Exception e){
System.out println("Exception");
}
Catch (ArithmeticException ae){
System.out.printin(" Arithmetic Exception
catch (ArithmeticException ae){
System.out.println(" Arithmetic Exception");
}
System.out println("finished");

Answer: Compilation fails

Q20. What will be the output?
import java.util.*;
class Output{
public static void main(String args[]){
ArrayList obj = new ArrayList();
obj.add("A");
obj.add("A");
System.out.println(obj.size());
}
}

Answer: 2

Q21. Map<String, String> obj = new HashMap<String, String>();
obi.put("City","Goa");
obj put("City","Shimla");
obj put("City","Pune");
obj put("CityName", "Shimla");

Select one or more true statements for above code

Answer: Values in a Map can be duplicated
       Following values will be stored in HashMap {CityName=Shimla, City= Pune}

Q22. What will be the output?

import java.util.HashMap;
import java.util.Map;
public class MapTest{
public static void main(String args[]) {
Map m = new HashMap();
m.put(null, "Test");
m.put(null, "Fest");
System.out.println(m);
}
}

Answer: {null=Fest}

Q23. What is the output of the below code:

public static void main(String args[])
{
ArrayList<String> myList = new ArrayList<String>();
myList.add("item I");
myList.add("Another Item");
myList.add("Last Item");
for(String s : mylist)
{
System.out.print(s.charAt(0));
}
}

Answer: IAL

Q24. What will be the output?

import.java.util.*;
class Output {
public static void main(String args])
{
ArrayList obj = new ArrayList();
obj add("A");
obj remove("A");
System.out.println(obj.size());
}
}

Answer: 0

Q25. What is the output of the below code:

public static void main(String args[]){
ArrayList myList = new ArrayList();
myList.add("item I");
myList.add("Another Item");
myList.add("Last Item");
for(String s : mylist)
{
System.out.print(s.charAt(0));
}
}

Answer: IAL

Q26. Consider the following class.
class Test
{
int x;
public static void main(String[] args)
{
this.x=5; // Currently shows an error
}
}

Answer: main cannot access this.x

Q27. What will be the output?

class exception_handling {
public static void main(String args[]){
try {
int a = args.length;
int b = 10 / a;
System.out.print(a);
try {
if (a == 1);
a = a/a-a;
if (a == 2){
int c = {1};
c[8]= 9;
}
}
catch (ArrayindexOutOfBounds Exception e) {
System.out.println("Type");
catch ArithmeticException e){
System.out.printin("TypeB");
}
}
}

Answer: Compilation error

Q28. public class Test{
public static void main(String args[]){
try{
int answer 20/0;
}
catch(ArithmeticException e) {
//some code
}
catch (Exception e) {
//some code
catch (NullPointerException e){
//some code
}
}

Answer: 
We will get a compilation error for an unreachable catch block because NullPointerException is already handled by the catch block for exception
A Try block can have multiple catch blocks but the most generalized catch block should be the last one

Q29. public class Test{
enum eColors{
Black (5),
BLUE (10),
GREEN (15),
int color Code=0;
eColors(int colorCode){
this.colorCode=colorCode;
}
}
public static void main(String args[]){
System.out.println(color.values()[1].colorCode);
}
}
What will be the output?

Answer: 10

Q30. What will be the output?
public class RTExcept
{
public static void throwit ()
{
System.out.print("throw it");
throw new RuntimeException();
}
public static void main(String (] args)
{
try
{
System.out.println("hello);
}
catch (Exception re)
{
System.out.println("caught");
}
finally
{
System.out.print("finally");
}
System.out.println("after");
}
}

Answer: hello throwit caught finally after

Friday, 22 May 2020

TCS Xplore Software Foundation SQL Final Assessment

SQL Final Assessment

Q1. Which SQL statement returns a numeric value?

Answer: SELECT sysdate-hire_date FROM EMP;

Q2. Which of the following is true with respect to Referential integrity ?

Answer: Every foreign key value must match a primary key value in the associated table ie Parent table.

Q3. We can use Transactional control statements in Database Triggers ? Select TRUE or FALSE

Answer: False

Q4. Select the suitable option from below to create an index on "job" column in emp table?

Answer: Create Index emp_id on emp(job);

Q5. Which of the below constraints will make sure to allow, only the values of a column (in a master) to the respective column of a child table?

Answer: foreign key

Q6. Select suitable option for Normalization importance on a Database?

Answer: To avoid redundancy
     Data would not lost
     To fetch the perfect and exact data, required
     Applying changes to the table data without effecting the other attributes

Q7. Which of the following is a type of constraint?

Answer: CHECK
     UNIQUE KEY
     DEFAULT
     PRIMARY KEY

Q8. DCL Commands are used to enforce database security in a multiple user environment.Select TRUE or False

Answer: TRUE

Q9. Which is the below statement is used to remove access or privileges on database object to users?

Answer: Revoke

Q10. Select the suitable option for SubQuery?

Answer: Inner query executes first and then based on the output of inner query the outer query executes

Q11. The formal classifications describing the level of database normalization in a data model are called Normal Forms. Select TRUE or False

Answer: TRUE

Q12. A column with reference to a record in a table should not have multiple values Which of the normal form, Talks about the above statement?

Answer: First

Q13. The DDL commands are

Answer: DROP
      ALTER
      CREATE

Q14. What is the grant statement to grant select, insert delete privileges on table: Emp to user: TestUser? Emp is the table Names; TestUser is the User Name.

Answer: Grant Select insert delete on Emp to TestUser

Q15. Types of SQL statements are

Answer: DML
       TCL
       DDL

Q16. In the below table: EmpId|EmpName|ProjId 1 a p1> 2 b p1 >> 3 c p2 >>> 4 d p1
By referring the above table, Select a suitable query which gets all employees whose project is same as project of 'd'?

Answer: SELECT * FROM EMP WHERE Projid=(SELECT Projid FROM EMP WHERE EMPNAME='d')

Q17. Table structure:
EmpId|EmpName|ProjId|MNGR-Id|Location|Designation
Assume that the respective data values / attributes referred in the options were exists in the table By referring to the above table structure, For which of the below questions, we would require to apply the concept of SubQuery?

Answer: Query to get employee whose designation is same of SWARNA'S designation
       Query to get employee details belonging to dept of RAJA

Q18. From the table below:
EmpId | EmpName | ProjId | Projname | No.ofHoursWorked
What are the probable and decomposed tables after performing second normal form?Let us assume that, an employee can work for multiple projects for the above scenario.

Answer: Table:EmpId | EmpNameTable2:ProjId | ProjNameTable3:EmpId | ProjId | No.of Hours worked

Q19. Table: Emp
EmpId | EmpName | ProjId > 1  a  p1 >> 2  b  p2 >>>3  c  p3
        Table2: Proj
Proj | ProjId | Projname > p  1  AAA >> p  2  BBB
By referring to the above table structure Select the Query which would letch EMPID EMPNAME Projld, ProjName for each employee?

Answer: SELECT EMPID.EMPNAME. B.Projld. B.ProjNAME FROM EMP A,Proj B WHEREA. PROTID=B.PROJID


Q20. From the table below:
EmpId | EmpName | ProjId | Projname | No.ofHoursWorked
Let us assume that, an employee can work for multiple projects for the above scenario. What would be the primary key to get unique record from the table?

Answer: EmpId and projId together

Tuesday, 19 May 2020

TCS Xplore Business Skills

Business Skills Final Assessment


Q1. Which statements are true with regard to 'customer' and 'client' ?

Answer: All options are correct.

Q2. Select the effective Statement

Answer: The manager's laissez-faire attitude has led to an efficient work culture in the team

Q3. You received the project requirements from the client you are not clear about a certain requirement what is the right way to respond?

Answer: Send an email to the client keeping your manager in the loop

Q4. It was Anjali's birthday one of a team members Prati sent her a birthday wish over an email . She had marked CC to all her team members and also to other team members Anjali was well known to many at the office. Therefore there are many who wanted to respnd to prati's email how should the other colleagues respond

Answer: Send a separate mail to Anjali conveying the wishes

Q5. Which is not a part of Pre-writing process?

Answer: Proof Reading

Q6. Amy a client partner from germany is having a discussion with the project team in india. Amy finds it uncomfortable speaking in their regional language amongst themselves. She feels a bit lost. What can the team do differently.

Answer: The Team lead should have stressed the usage of a common language that is English among team members.

Q7. When communicating with vendors which of the following statements is true?

Answer: We need to document every message between the vendor and TCS

Q8. How can one develop assertiveness?
A. By showing empathy
B. By showing sympathy
C. By ensuring that others agree with your points
D. By being open to feedback
E. By accepting everyone's views
F. By respecting everyone views

Answer: A, D, F

Q9. Amy a client partner from Germany is having a discussion with the project team in India. Amy finds it uncomfortable speaking in their regional language amongst themselves. She feels a bit lost. What can the team do differently.

Answer: Stereotypes help us identify different people and their backgrounds based on their attire, appearance or personality

Q10. Jalaja a saree to work. since she was sporting an ethnic look she wore big and bold accessories with flowers in her hair. makeup however was minimal.
Which of the following statements are correct.

Answer: She should not have women saree as it is not a formal wear. Flowers in the hair and bold accessories are also not acceptable. Minimum make-up is appropriate.

Q11. Cathy sends invitation to her team members for an unplanned meeting to discuss a new feature to be added in the project. Due to the shortage in time she sends the invitation without an agenda choose the right option 

Answer: An Agenda needs to be shared along with the meeting invite.

Q12. Agatha's team has been restructured. There are a number of associates who have joined from different parts of the country in the team now. Every member has certain stereotypes in their mind about the other members. What steps should the team take to resolve stereotyping?

Answer: Identify concepts that generate preconceived reactions. Unlearn these concepts and have a clean slate. Relearn these concepts in a neutral way

Q13. What is true about being Agile?
A. Agile teams can never fail.
B. Agile is driven by action.
C. Agile teams do not experiment
D. Agile teams do not believe in rationalism.

Answer: ONLY B

Q14. Please read the case study carefully and answer the question.

Chris Hurn stayed at the Ritz Carlton Hotel in Amelia Island on a vacation with his family, where his son accidentally left behind his dearest stuffed animal, Joshie. Chris told his son that Joshie decided to stay a little longer there. He called the hotel to enquire whether they have Joshie, as his son was feeling devastated without his little friend. Luckily, they found it and told Chris that they will send Joshie over.
To support Chris's little story, the hotel staff took a few pictures of Joshie having a massage, by the poolside, and taking a drive along the beach
Please choose the correct options which were followed by the hotel staff.

A. The staff was innovative
B. The staff identified the problem as an opportunity
C. The staff collaborated with the customer.
D. The staff believes in business value of fair-mindedness.
E. The staff was willing to experiment

Answer: A,B,C,F

Q15. It was Anjali's Birthday. One of her team members, Prati, sent her a birthday wish over an email. She had marked Cc to all her team members and also to a few other teams. Anjali was well known to many at the office and therefore there were many who wanted to respond to Prat's email. How should the other colleagues respond?

Answer: Send a separate mail to Anjali, conveying the wishes.

Q16. Select the appropriate statement while

Answer: "Hello Mr. Daniel Let's get this problem resolved for you. I'm going to transfer you to our specialist who is the best suited person to answer your question".

Q17. Mike wants to draft an e-mail to his client after his team came up with the rework of an application. The rework was asked to be done by the client due to some issues that the customers faced after the sample product was tested in the market. How should Mike start his email ?

Answer: Apologize to the client for not meeting his expectation.

Q18. How do you ask your Supervisor for a promotion in an assertive tone?

Answer: I would like you to consider my name for the promotion as I believe I have taken on many new responsibilities lately.

Q19. Daniel is planning on restructuring his team to make it more diverse. What are the possible challenges he will face in the process?

Answer: All of the above

Q20. Vivian had around 5 minutes before an important meeting. He found a client mail in his inbox that asked for an additional requirement. He is of the belief that emails need to be responded to promptly. Vivian wanted to be on time for the meeting and also wanted to reply to the client. What should he do?

Answer: Take time after the meeting and reply to the client, after analysis the requirement in detail.

Monday, 18 May 2020

AsCEnD Java MVC and Web Development

Java MVC and Web Development Assessment


Q1. Select all options which are true about the welcome-file-list

Answer: When the only specified item is welcome.html, the server still treats index.html as a backup
        lf not specified the default landing page is index html

Q2. GenericServlet class is encapsulated inside ____ package?

Answer: javax.servlet

Q3. Which method is used to retrieve a form value in a JSP or Servlet?

Answer: request.getParameter(String)

Q4. When doPost() method of servlet gets called?

Answer: Both of the above

Q5. Which class provide implementation for service() method ?

Answer: HttpServlet

Q6. The _____ object is used to forward the request processing from one servlet to another?

Answer: RequestDispatcher

Q7. When init() method of servlet gets called?

Answer: The init() method is called when the servlet is first created.

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

Answer: request getSession();

Q9. Which of the following attribute is used to have uncaught run-time exceptions automatically forwarded to an error processing page?

Answer: errorPage

Q10. What file specifies the default welcome page?

Answer: Web.xml

Q11. Which method of HttpServletResponse is used to redirect an HTTP request to another URL ?

Answer: sendRedirect()

Q12. Which of the following code is used to get a HTTP Session object in servlets?

Answer: request.getSession()

Q13. How do you switch between Java code and HTML code in a jsp file?

Answer: Java code is the default HTML code is kept inside <%> brackets.

Q14. What is javax.servlet.http.HttpServlet?

Answer: abstract class

Q15. JSP pages are processed on the server

Answer: TRUE

Q16. What are the different techniques for managing a session?

Answer: All of the above

Q17. what is the return type of getAttribute(String name) in ServletRequest

Answer: String

Q18. Which of the below methods returns a string containing information about the serviet, such as its author, version, and copyrigh.

Answer: getServletinfo()

Q19. Which of the following attribute is used to mark a page as error processing page?

Answer: isErrorPage

Q20. Which of the following statement is not correct about HTTP method ?

Answer: A POST request append data to the end of the URL

Q21. session is instance of which class?

Answer: HttpSession

Q22. Choose the statement that best describes the relationship between JSP and servlets:

Answer: Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage

Q23. Which tag in the jsp is used to define a page as an error page?

Answer: <%@page isErrorPage="true" %>

Q24. Which of these classes define the getWriter() method that returns an object of type PrintWriter ?

Answer: HttpServletResponse

Q25. Consider the following JSP page with an error in the Java code. What will happen when we try to access this jsp file on the server

Answer: The page will load normally, and the java errors which happen will be skipped.

Q26. Which of the following is not a implicit object?

Answer: cookie

Q27. Get is faster than POST method

Answer: TRUE

Q28. Which of the following is true about Initialization phase in JSP life cycle?

Answer: When a container loads a JSP it invokes the jsplnit() method before servicing any requests

Q29. The servlet-mapping element defines

Answer: a mapping between a servlet and a URL pattern

Q30. If in a form tag, no method attribute is specified, what function will be run?

Answer: doGet