Font size
Worksheets(Early Placement Assessment)JAVA, DBMS, DATA STRUCURE SET A
Total questions: 60
Worksheet time: 3600secs
Which of these allows you to read elements in the order you have inserted ?
1. LinkedList
2. ArrayList
3. LinkedHashSet
1 2 3
1 2
1
2
Predict the output
List<Integer> list = new ArrayList<Integer>();
list.add(10);
list.add("10");
System.out.println(list);
Prints
[10,10]
Prints
[10]
Compile time error : cannot add String data
Runtime Error : Cannot add String data
Fill the Code:
Map<Integer,String> map=new HashMap<Integer,String>();
map.put(1,"One");
map.put(4,"Four");
map.put(2,"Two"); Set<Map.Entry<Integer,String>> set=map.______________
iterator()
setEntry()
enterySet()
enteries()
Which one of the following classes implements Set interface and maintains the insertion order of elements?
HashSet
TreeSet
LinkedHashSet
None of the above
Predict the output :
ArrayIndexOutOfBoundsException
null
0
1
Which of the following is NOT used while writing main() function in Java?
public
static
void
private
class Demo
{
class_body;
main() function body;
}
By which name above program should be saved?
Demo.java
Demo.class
class.Demo
java.Demo
Which is a correct way of compiling Demo.java program?
javac Demo.java
java Demo.java
java Demo
javac Demo
Identify the CORRECT parent class of Exception
Package Lang
Package Util
Class Throwable
Class Error
Choose the CORRECT mechanism of exception handling.
try block --> catch block --> finally block
try block --> catch block --> throws exception
try block --> catch block --> finally --> throws exception
try block --> throws exception--> catch block --> finally block
Identify in which block should handling statements are written for any exception caught?
try
catch
Throws
throws
Identify the CORRECT need of Exception handling
It allows multiple users and requests can be served at the very same time.
It helps and report early exceptional happen thus necessary action can be taken.
It avoid system crashes and abnormal program termination
It allows the same method name to be used but carry out different task implementation.
Occurs when you try to convert a string, which is not in the form of a number into numeric.
Identify the type of Exceptions for the above description.
ArithmeticException
ArrayIndexOutOfBoundsException
NumberFormatException
StringBufferException
What is an exception
Error occurred during the execution of a program
Bug occurred during the compile time of a program
Simply an Error
It is related to input values
Exception classes belongs to following package
import java.io.*
import java.lang.*
import java.util.*
import java.lang.Exception.*
Choose an exception if attempt to divide number by zero
int number = 89 / 0;
System.out.println("The answer is " + number);
ArithmeticException
NullPointerException
NumberFormatException
ArrayIndexOutOfBoundException
Which of this keyword must be used to inherit a class?
super
this
extend
extends
Which of the following OOP concept binds the code and data together and keeps them secure from the outside world?
Polymorphism
Inheritance
Abstraction
Encapsulation
The total number of elements in the array is called...............
index
length
subscript
memory
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;
Which is not an aggregate function?
SUM()
POW()
AVG()
COUNT()
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
What does DML stand for?
Data Manipulation Language
Data Modeling Language
Data Markup Language
Data Migration Language
Which of the following can add a row to a table?
Add
Insert
Update
Alter
The _________ statement is used to delete a table.
DROP TABLE
DELETE TABLE
DEL TABLE
REMOVE TABLE
Which one of the following sorts rows in SQL?
SORT BY
ALIGN BY
GROUP BY
ORDER BY
Which SQL statement is used to return only different values?
SELECT DISTINCT
SELECT UNIQUE
SELECT DIFF
SELECT DIFFERENT
In a LIKE clause, you can ask for any 6 letter value by writing
LIKE ______ (that's six underscore characters)
LIKE ...... (that's six dots)
LIKE .{6}
LIKE ??????
Which SQL statement is used to update data in a database?
MODIFY
ALTER
SAVE
UPDATE
The SQL keyword BETWEEN is used:
For ranges.
To limit the columns displayed.
As a wildcard.
None of the above
Write a query to display first_name and last_name of all employees who have their first_name starting with 'A'.
Select first_name from employess where first_name LIKE '%A';
Select first_name from employess where first_name LIKE "'A'%";
Select first_name from employess where first_name LIKE 'A%';
Select first_name from employess where first_name LIKE '%A%';
Correct command to create database school
use school ;
make database school ;
create school;
Create database school;
Which of the following is not a DML command?
Update
Insert into
Delete
Create Table
Which operator performs pattern matching?
Between Operator
Like Operator
Exists Operator
None of these
If you were wanting to filter data, which clause would you use?
Where
Order by
From
Select
To remove a record from a table which SQL statement would you use?
Remove
Cancel
Delete
Eradicate
Which word is missing from the following SQL statement?
Select * table_name
With
Where
From
And
What is the correct order of clauses in a SQL statement?
SELECT, FROM, ORDER BY, WHERE
SELECT, FROM, WHERE, ORDER BY
SELECT, WHERE, FROM, ORDER BY
WHERE, FROM, SELECT, ORDER BY
How would you display Chairs in the Items table that have a Price greater than £50.
SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50
SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100
SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50
SELECT * FROM Items WHERE Price > 50
____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.
linear
homogeneous
static
dynamic
Stack uses __________ data structure as the element that was inserted last is the first one to be taken out.
LIPO
FIFO
LIFO
FIPO
Every stack has a variable _________ associated with it.
TOP
BOT
POT
none of the above
_________ operation adds an element to the top of the stack.
pop
push
peep
all of the above
A function calls itself is called ___________.
queue
recursion
function
none of above
A queue is a _________ data structure in which each element that was inserted first is the first one to be taken out.
FITO
FIFO
FISO
FIVO
The elements in a queue are added at one end called ________.
front
rear
near
none of above
The term push and pop is related to
A. Array
B. List
C. Stack
D. Queue
Which of the following is non-liner data structure?
A. Stack
B. List
C. Graph
D.Array
Minimum number of fields in each node of a doubly linked list is ____
A. 2
B. 3
C. 4
D. 5
The number of edges in a complete graph of n vertices is_______
A. n(n+1)/2
B. n(n-1)/2
C. n2 /2
D. n
Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
A. Input restricted dequeue
B. Output restricted dequeue
C. Circular queue
D. Priority queue
The operation of visiting each element in the list is known as ……
A. Sorting
B. Traversing
C. Merging
D. Inserting
Which of the following is a linear data structure?
A. List
B. AVL Tree
C. Binary Tree
D. Graph
When a pop() operation is called on an empty queue, what is the condition called?
A. Overflow
B. Underflow
C. Syntax error
D. Garbage value
A graph is a collection of nodes, called ...... And line segments called arcs or ...... that connect pair of nodes.
A. vertices, paths
B. vertices, edges
C. graph node, edges
D. edges, vertices
In ........, search start at the beginning of the list and check every element in the list.
A. Binary search
B. Binary Tree search
C. Linear search
D. Exponential search
Three standards ways of traversing a binary tree T with root R .......
A. Prefix, infix, postfix
B. Pre-process, in-process, post-process
C. Pre-traversal, in-traversal, post-traversal
D. Pre-order, in-order, post-order
