Font size
WorksheetsJava _TalentNext_2
Total questions: 85
Worksheet time: 44mins
JUnit is used for what type of software testing for the Java language?
Functional Testing
System Testing
Unit Testing
Integration Testing
Which annotation implies that a method is a JUnit test case?
@org.junit.Test
@org.Test
@testcase
@junit
JUnit test files are written in files with which file extension?
.unit
.java
.test
.junit
Which methods cannot be tested by the JUnit test class?
protected methods
methods with void return type
private methods
public methods
JUnit test methods must compulsorily return what value?
void
Object
String
int
To use JUnit in a project we need to add which JAR files on our test classpath?
java-junit.jar
junit.jar and hamcrest-core.jar
hamcrest-core.jar
junit.jar
Which of the following method of Assert class checks that a condition is false?
void assert(boolean condition)
void assertFalse(boolean condition)
void assertCheck(boolean condition)
void assertChecks(boolean condition)
Which of the following class is used to bundle unit test cases and run them together?
JUnitCore
TestCase
TestSuite
TestResult
Which of the following describes Testing correctly?
Testing is the process of checking the functionality of the application whether it is working as per requirements.
Testing is the testing of single entity (class or method).
Both of the above.
None of the above.
Which of the following method of Assert class checks that a condition is true?
void assert(boolean condition)
void assertTrue(boolean condition)
void assertCheck(boolean condition)
void assertChecks(boolean condition)
How many ways a thread can be created in Java multithreading?
1
2
5
10
Which method is used to make main thread to wait for all child threads
Join ()
Sleep ()
Wait ()
Stop ()
Which will contain the body of the thread in Java?
Start()
Run()
Main()
Execute()
The life cycle of a thread in java is controlled by
JRE
JDK
JVM
None
Which method is used to get current running thread object?
runningThread()
currentThread()
runnableThread()
None
Synchronized static methods acquire lock on
Class
Object
Interface
None
Thread priority in Java is?
Integer
Float
Double
Long
In JAVA multi threading, a thread can be created by_______
Extending class
Implementing Runnable Interface
both
none
Which statements is/are correct
On calling Thread start ( ) method a new thread is created
Thread start( ) method call run( ) method internally
Thread run( ) method can also be called directly to create thread
both a & b
Q) What is maximum thread priority in Java
10
12
5
8
Q) Number of threads in below java program is
public class ThreadExtended extends Thread {
public void run() {
System.out.println("\nThread is running now\n");
}
public static void main(String[] args) {
ThreadExtended threadE = new ThreadExtended();
threadE.start();
}
}
0
1
2
3
Q) Execution of a java thread begins on which method call?
Start ()
Run ()
Execute ()
Launch ()
Q) Which method is used to check if a thread is running?
isAlive()
run ()
alive ()
keepAlive()
Q) Min and Max priority of a thread in Java multithreading are
1, 10
0,10
0,255
1,256
___________distributing task across multiple computing cores
data parallelism
implicit threading
task parallelism
identifying task
Execution of a java thread begins on which method call?
Run ()
Start ()
Execute ()
Launch ()
Choose THREE(3) benefits of multithreaded processing
scalability
resource sharing
privacy
responsiveness
Thread is _____________process that can run independently
heavyweight
lightweight
compaction
compression
Which driver is efficient and always preferable for using JDBC applications?
Type-4
Type-3
Type-2
Type-1
Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
Type 1
Type 2
Type 3
Type 4
Which packages contain the JDBC classes?
java.jdbc and javax.jdbc
java.jdbc and java.jdbc.sql
java.sql and javax.sql
java.rdb and javax.rdb
Which type of Statement can execute parameterized queries?
PreparedStatement
ParameterizedStatement
ParameterizedStatement and CallableStatement
All kinds of Statements (i.e. which implement a sub interface of Statement)
How can you retrieve information from a ResultSet?
By invoking the method get(…, String type) on the ResultSet, where type is the database type
By invoking the method get(…, Type type) on the ResultSet, where Type is an object which represents a database type
By invoking the method getValue(…), and cast the result to the desired Java type.
By invoking the special getter methods on the ResultSet: getString(…), getInt (…), getDouble(…),…
How can you execute a stored procedure in the database?
Call method execute() on a CallableStatement object
Call method executeProcedure() on a Statement object
Call method execute() on a StoredProcedure object
Call method run() on a ProcedureCommand object
Which method is used to perform DML statements in JDBC?
execute()
executeQuery()
executeUpdate()
executeResult()
In order to transfer data between a database and an application written in the Java programming language, the JDBC API provides which of these methods?
Methods on the ResultSet class for retrieving SQL SELECT results as Java types.
Methods on the PreparedStatement class for sending Java types as SQL statement parameters.
Methods on the CallableStatement class for retrieving SQL OUT parameters as Java types.
All mentioned above
The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.
True
False
Which method is used to establish the connection with the specified url in a Driver Manager class?
public static void registerDriver(Driver driver)
public static void deregisterDriver(Driver driver)
public static Connection getConnection(String url)
public static Connection getConnection(String url,String userName,String password)
Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?
JDBC-Net
JDBC-ODBC bridge
Native API as basis
Native protocol as basis
Which is used to call the stored procedures and functions?
CallableStatement Interface
PreparedStatement Interface
All the above
None of the above
What is used to execute parameterized query?
Statement interface
PreparedStatement interface
ResultSet interface
None of the above
Which models do the JDBC API support for the database access?
Two-tier models
Three-tier models
Both A & B
None of the above
Which of the following is used to rollback a JDBC transaction?
rollback()
rollforward()
deleteTransaction()
RemoveTransaction()
Which method is used to perform DML statements in JDBC?
execute()
executeQuery()
executeUpdate()
executeResult()
This method is used to extract data from result set
next()
getString()
This provides the application-to-JDBC Manager connection
JDBC Driver API
JDBC API
What is the body of a Thread
Run
Begin
Execute
Start
Resume
Select DDL commands from among the options...
SELECT
ALTER
DROP
DELETE
Choose the correct query
SELECT * FROM EMP WHERE NAME=NULL
SELECT * FROM EMP WHERE NAME IS NULL;
SELECT FROM EMP WHERE NAME IS NULL;
SELECT *FROM EMP WHERE NAME IS 'NULL';
Which is the correct query to delete the rows of employees whose exp is less than 10.
DELETE * FROM EMP WHERE EXP<10;
DELETE FROM EMP;
DELETE FROM EMP WHERE EXP<10;
DELETE FROM EMP WHERE EXP>10;
Atomicity, Consistency, Isolation, and Durability − commonly known as ........... properties
AID
ADIC
ACID
DBMS
.......... is the process of organizing the data in the database.
Schema
Normalization
Instance
Transaction
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
SELECT * FROM Persons WHERE FirstName='a'
SELECT * FROM Persons WHERE FirstName LIKE 'a%'
SELECT * FROM Persons WHERE FirstName='%a%'
SELECT * FROM Persons WHERE FirstName LIKE '%a'
With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'
SELECT FirstName='Peter', LastName='Jackson' FROM Persons
With SQL, how can you insert a new record into the "Persons" table?
INSERT ('Jimmy', 'Jackson') INTO Persons
INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'
UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
With SQL, how can you return the number of records in the "Persons" table?
Next ❯
SELECT NO(*) FROM Persons
SELECT COLUMNS(*) FROM Persons
SELECT COUNT(*) FROM Persons
SELECT LEN(*) FROM Persons
The NOT NULL constraint enforces a column to not accept empty values.
Next ❯
TRUE
FALSE
Which operator is used to search for a specified pattern in a column?
GET
FROM
LIKE
CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);
INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);
Some of these insert statements will produce an error. Identify the statement.
Insert into employee values (1005,Rach,0);
Insert into employee values (1002,Joey,335);
Insert into employee values (1007,Ross, );
None of the mentioned
In the given query which of the keyword has to be inserted?
INSERT INTO employee _____ (1002,Joey,2000);
Table
Values
Relation
Field
SELECT * FROM employee WHERE salary>10000 AND dept_id=101;
Which of the following fields are displayed as output?
Salary, dept_id
Employee
Salary
All the field of employee relation
Consider the following code snippet: what will be the output?
DECLARE
a number(2) ;
BEGIN
FOR a IN REVERSE 10 .. 20 LOOP
END LOOP;
dbms_output.put_line(a);
END;
20
29
10
30
What will be the output of the following code snippet?
21
21, 10
10
error
What is wrong in the following code snippet?
DECLARE
x number := 1;
BEGIN
LOOP
dbms_output.put_line(x);
x := x + 1;
IF x > 10 THEN
exit;
END IF;
dbms_output.put_line('After Exit x is: ' || x);
END;
Code is correct.
IF statement is not required.
END LOOP is missing.
Every IF must have ELSE statement.
_____cursor is declared by ORACLE for each UPDATE, DELETE and INSERT SQL commands.
Internal
External
Implicit
Explicit
Which of the below options is correct to load the Oracle JDBC driver?
Class.forName("oracle.jdbc.driver.OracleDBDriver");
Class.forName("Oracle.Jdbc.Driver.OracleDriver");
Class.forName("jdbc.oracle.driver.OracleDriver");
Class.forName("oracle.jdbc.driver.OracleDriver");
Which of the below queries is correct to display the Employee details such as empno, ename, sal from emp table whose empno contains 77 in it?
select empno,ename,sal from emp where empno is 77;
select empno,ename,sal from emp where empno like '_77%';
select empno,ename,sal from emp where empno like '%77%';
select empno,ename,sal from emp where empno like '_77_';
Which refers to connecting entities of different types when identifiers are different?
HAS-A relationships
IS-A relationships
Binary relationship
None
Relationships among entities of a single class are called_______?
IS-A relationships
Recursive relationships
HAS-A relationships
None
An attribute which consists of a group of attributes is called ______?
Composite attributes
Multi-valued attributes
Composite identifiers
Identifiers
An SQL query to delete a data from the table and memory while keeping the structure of the table intact?
a)TRUNCATE TABLE table_name;
b)DELETE FROM TABLE table_name;
c)DROP TABLE table_name;
d)DROP FROM TABLE table_name;
Which of the following are the five built-in aggerate functions provided by SQL?
a)SUM, AVG, MIN, MAX, MULT
b)COUNT, SUM, AVG, MAX, MIN
c)SUM, AVG, MULT, DIV, MIN
d)SUM, AVG, MIN, MAX, NAME
Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
So, What the below SQL statement will return: SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
A.10
B.9
C.5
D.0
The SQL statement - SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL; Prints
A.gh
B. 23
C.bc
D. ab
To define what columns should be displayed in an SQL SELECT statement:
A. use FROM to name the source table(s) and list the columns to be shown after SELECT.
B. use USING to name the source table(s) and list the columns to be shown after SELECT.
C. use SELECT to name the source table(s) and list the columns to be shown after USING.
D. use USING to name the source table(s) and list the columns to be shown after WHERE.
Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER WHERE STATE = 'VA';
A. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');
B. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
C. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
D. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');
SQL query and modification commands make up a(n) ________ .
A. DDL
B. DML
C. HTML
D. XML
1. Which of the following Statement will cancel the SAVEPOINTS
iNSERT
UPDATE
DELETE
COMMIT
The union of primary keys of the related entity sets becomes a -------------------------- of the relation ?
Super Key
Candidate key
Foreign key
Primary key
