Sunday 24 June 2018

TCS Tech Lounge JAVA Final-15

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

2 comments:

  1. Thanks for sharing this informative content , Great work
    Creative Thinking for creating an impact!
    Product Thinking Community introduces PT Labs powered by Leanpitch
    Product thinking conference

    ReplyDelete
  2. Thanks for sharing this informative content , Great work
    Read this PSM vs CSM blog from Leanpitch to get a better conclusion : PSM vs CSM

    ReplyDelete