0% found this document useful (0 votes)
640 views

Aptitude Test Infosys

The document describes 4 courses covered on the InfyTQ foundation courses section: 1) Programming Fundamentals using Python 2) Object-Oriented Programming Retail 3) Data Structures and Algorithms using Python 4) Learning DBMS and SQL Each course is broken down into various topics and sub-topics that will be covered.

Uploaded by

Jose Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
640 views

Aptitude Test Infosys

The document describes 4 courses covered on the InfyTQ foundation courses section: 1) Programming Fundamentals using Python 2) Object-Oriented Programming Retail 3) Data Structures and Algorithms using Python 4) Learning DBMS and SQL Each course is broken down into various topics and sub-topics that will be covered.

Uploaded by

Jose Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 216

Courses covered on InfyTQ under the Foundation Courses section are

Programming Fundamentals, Object-Oriented Programming, Data Structures and


Algorithms using Python, and Learning DBMS and SQL.

1. Programming Fundamentals using Python


a. Introduction to Programming
b. Algorithms
c. Pseudocode
d. Control Structures
e. Eclipse Plug-in
f. Debugging
g. Collections
h. Functions
i. Exception Handling
j. Recursion
k. Libraries and Functions
l. File Handling
2. Object-Oriented Programming Retail
a. Introduction
b. OOP Basics
c. Encapsulation
d. Using Objects
e. Eclipse tips
f. Static
g. Relationships
h. Inheritance
i. Abstract class
j. Exception Handling
3. Data Structures and Algorithms
a. Introduction to Data Structures
b. List Data Structure
c. Stack
d. Queue
e. Non-linear Data structures
f. Hashing and hash table
g. Search algorithm
h. Sort algorithm
i. Algorithm technique
4. Learning DBMS and SQL
a. Entities and Relationships diagram
b. SQL basics
c. DDL statements
d. DML statements
e. Joins
f. Subquery
g. Transactions
h. Modular query writing
i. Normalization
j. No SQL databases
Test-I –Infy DBMS
The below table holds the result of an assessment of 3 students.
Table: Assessment
StudentId Marks
1001 99
1002 33
1003 88

A requirement is given to 3 developers Tom, Dick and Harry to generate a


report as follows:
StudentId Marks
1001 99
1002 FAIL
1003 88

If a student has scored less than 50, his status must be shown as ‘FAIL’.
Otherwise, his mark must be displayed.

The 3 developers wrote the following queries:

Tom:

SELECT STUDENTID,CASE WHEN MARKS < 50 THEN 'FAIL' ELSE


TO_CHAR(Marks) END AS STATUS FROM ASSESSMENT

Dick:
SELECT STUDENTID,CASE WHEN MARKS < 50 THEN 'FAIL' ELSE Marks
END AS STATUS FROM ASSESSMENT

Harry:

SELECT STUDENTID,CASE WHEN MARKS > 50 THEN 'FAIL' ELSE Marks


END FROM ASSESSMENT

Which one of them will get the desired output?

Dick

Harry

Tom

None of them
Q2 of 25

outlined_flag
Consider the following code written for creating the table:
CREATE TABLE ACCOUNT (ACCNO INT , ACCNAME VARCHAR(30) NOT
NULL,BALANCE );

The table is NOT getting created, identify the reason.

BALANCE must be NOT NULL

ACCNO must be NOT NULL

Primary key is missing for ACCOUNT

BALANCE must have a datatype


Q3 of 25

outlined_flag
Tables course and student have 1-N relationship respectively. Cid is the
primary key of course table and Sid is the primary key of student table. To
which table the foreign key should be added?
Course
Cid
Cname

Student
Sid
Sname

Either Student or Course

In 1-N relationship foreign key cannot be established

Only Student

Only Course
Q4 of 25

outlined_flag
Rajesh created a table EMP in order to record employee details.

The table creation script for the same is given below:


CREATE TABLE EMP(
empid NUMBER(10) PRIMARY KEY,
empname VARCHAR2(50),
cabinnumber NUMBER(20) UNIQUE
);
Currently table has some data as given below:
empid empname cabinnumber
1001 Hari 789
1002 Varun 145
1003 Shyam 458

Select the right option for inserting a new row into the table.

INSERT INTO EMP VALUES (1004,'Lali',789);

INSERT INTO EMP VALUES (1004,'Lali',NULL);

INSERT INTO EMP VALUES (NULL,'Lali',456);

INSERT INTO EMP VALUES (1003,'Lali',578);


Q5 of 25

outlined_flag
A table Employee has the following data:

The following queries were executed on the table successfully :

UPDATE EMPLOYEE SET DEPARTMENT = 'HR' WHERE DEPARTMENT


= 'Marketing' ;

DELETE FROM EMPLOYEE WHERE DEPARTMENT = 'HR' AND SALARY


= 1000;

What will be the output of the following query?


SELECT COUNT(*) FROM EMPLOYEE;

2
Q6 of 25

outlined_flag
Consider the following statements with respect to a candidate key:
a. Candidate key identifies rows in a relation uniquely.
b. There can be only one candidate key in a relation.
c. A candidate key can be a combination of more than one attribute in a
relation.

Identify the statement/(s) which are TRUE.

Only a and c

Only a and b

only a

Only b and c
Q7 of 25

outlined_flag
Consider the below table SalesPerson:

SELECT DISTINCT Id, Amount FROM SalesPerson ORDER BY Amount


ASC;

Based on the output of the above query, identify the correct statement.

1005 will be 3rd record

1009 will be 4th record

1002 will be 1st record

1001 will be 4th record


Q8 of 25

outlined_flag
Consider the following "employee" table and the code given below:

BEGIN
UPDATE Employee SET Salary=5000 WHERE EmpId = 1;
COMMIT;
UPDATE Employee SET Name='Dravid', Salary = 5000 WHERE EmpId = 3;
INSERT INTO Employee VALUES(3, 'Yuvraj', 2500);
EXCEPTION
WHEN OTHERS THEN
COMMIT;
END;

What will happen when the above code gets executed?

First update will be successful

Both the updates will be successful

Neither update nor insert will be successful

Both the updates and insert will be successful


Q9 of 25

outlined_flag
Consider the tables vehtype and vehicle given below:

vehtype(vid ,vtype) with vid being the primary key.

vehicle(id, vid, brand, model, price) with id being the primary key and
vid foreign key to the vehtype table.

Consider the below join query:

select brand from vehicle v join vehtype vt


on v.vid=vt.vid
group by brand
having count(vtype)>1

Choose an equivalent subquery that would achieve the functionality


performed by the above join query.

Note: The only difference between the options is in the 'WHERE' clause.

SELECT brand FROM vehicle WHERE vid in (SELECT vid FROM vehtype HAVING
COUNT(vtype)>1);

SELECT brand FROM vehicle WHERE vid in (SELECT vid FROM vehtype GROUP BY vid
HAVING COUNT(vtype)>1)

SELECT brand FROM vehicle WHERE vid IN (SELECT vid FROM vehtype) HAVING
COUNT(vid)>1;

SELECT brand FROM vehicle WHERE vid in (SELECT vid FROM vehtype) GROUP BY
brand HAVING COUNT(vid)>1
Q10 of 25

outlined_flag
Consider the tables emp and dept given below:

Which of the following queries will execute successfully?


INSERT INTO emp VALUES(1006, 'Fedrick', 10, 2000);
INSERT INTO emp VALUES (1008, 'Fedrick', NULL, 3000);
INSERT INTO dept (deptno) VALUES (40);
INSERT INTO dept VALUES (NULL, 'HR');
Q11 of 25

outlined_flag
Consider the table toys given below:

What will be the output of the below query?

SELECT * FROM toys t1 WHERE price = (SELECT MAX(price) FROM toys t2


WHERE t1.categoryid=t2.categoryid );

A)

B)

C)

D)

D
Q12 of 25

outlined_flag
Consider the following relational schema along with functional dependencies:

OrderDetails(OrderId, DateOrdered, QuantityOrdered, ItemNumber,


ItemName, ItemPrice, CustomerId, CustomerName)

{OrderId, ItemNumber} -> QuantityOrdered


OrderId -> CustomerId, DateOrdered
ItemNumber-> ItemName, ItemPrice
CustomerId -> CustomerName

What would be the resulting relational schema after converting to 3NF?

A) TableA (OrderId, CustomerId)


TableB (OrderId, ItemNumber, QuantityOrdered, ItemPrice)
TableC (ItemNumber, ItemName)
TableD (CustomerId, CustomerName)
TableE (OrderId, DateOrdered)

B) TableA (OrderId, CustomerId, DateOrdered, CustomerName)


TableB (OrderId, ItemNumber, QuantityOrdered)
TableC (ItemNumber, ItemName)
TableD (CustomerId, CustomerName)
TableE (ItemNumber, ItemPrice)

C) TableA (OrderId, DateOrdered)


TableB (OrderId, ItemNumber, QuantityOrdered)
TableC (ItemNumber, ItemName)
TableD (CustomerId, CustomerName)
TableE (ItemNumber, ItemPrice)

D) TableA (OrderId, CustomerId, DateOrdered)


TableB (OrderId, ItemNumber, QuantityOrdered)
TableC (ItemNumber, ItemName)
TableD (CustomerId, CustomerName)
TableE (ItemNumber, ItemPrice

D
Q13 of 25

outlined_flag
Cray Retail is a retail chain. They have a table in their database that has the
following data:

Three developers Tom, Dick and Harry are given the task of finding the
average salary of the employees in the company. They have been told that a
NULL in the salary column means that those employees should not be
considered.

They write the following queries:

Tom: SELECT SUM(Salary)/COUNT(*) from EMPLOYEE WHERE Salary IS


NOT NULL ;

Dick: SELECT SUM(Salary)/COUNT(*) from EMPLOYEE;

Harry: SELECT AVG(Salary) from EMPLOYEE;

Which of them have got the query correct?

Tom and Harry have got it right

Only Harry has got it right

Tom and Dick have got it right


Only Dick has got it right
Q14 of 25

outlined_flag
Consider a table named Measurement with the following structure and data;

The following procedure is created in the database successfully:

CREATE OR REPLACE PROCEDURE dataInsert_sp(v_Num1


NUMBER,v_Num2 NUMBER,v_Num3 NUMBER,p_Status OUT NUMBER)
IS
v_Sum NUMBER;
BEGIN
v_Sum := v_Num1 + v_Num2;
IF (v_Sum >= v_Num3 ) THEN
p_Status := -2;
RETURN;
ELSE
INSERT INTO Measurement VALUES (v_Num1,v_Num2,v_Num3);
p_Status := -3;
END IF;
EXCEPTION
WHEN OTHERS THEN
p_Status := -4;
END;

What will be the value of p_Status when the procedure is executed with the
input set (v_Num1,v_Num2,v_Num3) = (1,3,6)
-4

NULL

-2

-3
Q15 of 25

outlined_flag
Consider the tables product and orders with the data as follows:

Choose the query which will generate the output given below:

SELECT p.prdid, p.prdname, MIN(o.quantityordered) quantity FROM product p INNER JOIN


orders o ON p.prdid=o.prdid GROUP BY p.prdid, p.prdname having
MIN(o.quantityordered)>10;

SELECT p.prdid, p.prdname, MIN(o.quantityordered) quantity FROM product p INNER JOIN


orders o ON p.prdid=o.prdid GROUP BY p.prdid, p.prdname;

SELECT p.prdid, p.prdname, SUM(o.quantityordered) quantity FROM product p INNER JOIN


orders o ON p.prdid=o.prdid GROUP BY p.prdid, p.prdname having
SUM(o.quantityordered)<10;

SELECT p.prdid, p.prdname, MIN(o.quantityordered) quantity FROM product p INNER JOIN


orders o ON p.prdid=o.prdid GROUP BY p.prdid, p.prdname having
MIN(o.quantityordered)<10;
Q16 of 25

outlined_flag
Consider the table broker given below:

Which of the following will be one of the rows in the output of the below SQL
query?

SELECT BrokerNo, COUNT(NVL(Comission,0)) Commission


FROM Broker GROUP BY BrokerNo;

A.

B.

C.

D.

D
Q17 of 25

outlined_flag
Consider the below table named Destination:

DestId is the PRIMARY KEY.


Another table Travel holds the list of tour packages as given below:

DestId in the Travel table references the DestId of the Destination table using
a FOREIGN KEY.

Given the above details which of the following queries will execute
successfully.
Choose 2 CORRECT options.
DELETE FROM Destination where destId = 102
UPDATE Destination SET destId = 105 where destId = 103
DELETE FROM Destination where destId = 104
UPDATE Destination SET destId = 105 where destId = 102
Q18 of 25

outlined_flag
Consider the table Teacher given below:

How many rows will get updated when the below query is executed?

2
Q19 of 25

outlined_flag
Consider the tables given below:

Determine the output of the below query.

SELECT customer.customerid,NVL(booking.bookingid,'Not Yet') FROM


customer LEFT OUTER JOIN booking ON customer.customerid =
booking.customerid ;

A.

B.

C.

D.

D
Q20 of 25

outlined_flag
Consider the table products given below:

Note: modelno is the PRIMARY KEY of products table.

What will be the output of the following query?

SELECT prodtype FROM products


GROUP BY prodtype
HAVING COUNT(modelno) = (SELECT MIN(COUNT(modelno)) FROM
products GROUP BY prodtype);

PC

PC <br> Printer

Laptop

Printer
Q21 of 25

outlined_flag
Consider the tables SUPPLIER and ORDERS given below:

Identify the query to fetch the details of all the suppliers along with order
details. Include the suppliers who haven't ordered any items also.

SELECT s.supplier_id, o.supplier_id, o.order_date FROM supplier s RIGHT OUTER JOIN


orders o on s.supplier_id=o.supplier_id

SELECT s.supplier_id, o.supplier_id, o.order_date FROM orders o LEFT OUTER JOIN


supplier s on s.supplier_id=o.supplier_id;

SELECT s.supplier_id, o.supplier_id, o.order_date FROM orders o FULL OUTER JOIN


supplier s on s.supplier_id=o.supplier_id;

SELECT s.supplier_id, o.supplier_id, o.order_date FROM supplier s LEFT OUTER JOIN orders
o on s.supplier_id=o.supplier_id;
Q22 of 25

outlined_flag
Consider the tables customer and subscription given below:

What is the output of the below query?

SELECT customerName
FROM customer c JOIN subscription s ON s.customerId=c.customerId
WHERE s. customerId NOT IN

(SELECT customerId
FROM subscription GROUP BY customerId HAVING COUNT (customerId)
=
(SELECT MAX(COUNT(customerId)) FROM subscription GROUP
BY customerId));

Jack

Hary

Tom

Peter
Q23 of 25

outlined_flag
Consider the tables Bank, CustAccountDetails and AccountDetails given
below:

What would be the output of below query?

SELECT CustAccId, Balance, BankName, ad.AccId FROM


CustAccountDetails cd
INNER JOIN Bank ba ON ba.BankCode = cd.BankCode INNER JOIN
AccountDetails ad
ON cd.AccId = ad.AccId
WHERE Balance >
(
SELECT AVG(Balance) FROM CustAccountDetails
INNER JOIN Bank
ON Bank.BankCode = CustAccountDetails.BankCode
WHERE BankName = ba.BankName
) AND ad.AccType = 'Saving';

A.

B.

C.
D. No rows will be selected

D
Q24 of 25

outlined_flag
Consider the following tables:

What will be the output of the following query?

SELECT B.BankName,AD.AccType,SUM(Balance)
FROM CustAccountDetails CA INNER JOIN Bank B ON CA.BankCode =
B.BankCode
INNER JOIN AccountDetails AD ON CA.AccId = AD.AccId
GROUP BY B.BankName,AD.AccType HAVING SUM(Balance) =
(SELECT MIN(SUM(Balance)) from custAccountDetails GROUP BY
BankCode,AccId);

A.

B.

C.

D.

C
D
Q25 of 25

outlined_flag
Consider following tables:

There is a requirement to display donor id, donor name of those donors who
donated the blood.

Also display the patient id who have received blood from these donors.

The following query was written to solve the above requirement.

SELECT DISTINCT d.donorid, donorname, patientid FROM donor d INNER


JOIN bloodtransaction b ON d.donorid = b.donorid;

What is the output of the above query?

A.

B.

C. Query written is correct but fetches no rows

D. Query written does not satisfy the stated requirement

D
Test-II –Infy Programming
Question 1:
Given a string, find the substring based on following conditions,
1. The substring must be the longest one of all the possible substring in the given string.
2. There must not be any repeating characters in the substring.
3. If there is more than one substring satisfying the above two conditions, then print the
substring which occurs first.
4. Length of the substring must be minimum 3.
If there is no substring satisfying all the aforementioned conditions then print -1.
Question 2:
Given an array of integers, find the combination of integers forming a sequence which satisfies
the below conditions:
1.
1. The ith integer must satisfy the given equation in the sequence

(1)

2. The length of the sequence must be maximum possible


3. If there is more than one sequence satisfying above two conditions then print that
sequence which contains least integers.
In case there is no combination of integers possible then print -1.
See the example below:
2. Example 1:
If the given integers are 4, 2, 7, 5, 3, 8, 10, 11, 19 then the possible combinations of
integers satisfying above conditions are 2, 3, 5, 8 and 3, 8, 11, 19 and hence the output
must be 2, 3, 5, 8. Here you cannot form any other combination of integers whose length
is greater than 4 and satisfies the given equation.
Example 2:
If the given integers are 1,5,6,10 then print -1.
Question 3 Given a string in which random numbers are present and we have to find the product
and the number(one is lesser and one is greater) who already present in the string. Confusing,
Let’s see the example:
E.g. Given a string contains 1203456. The multiplication of 3 and 4(one is lesser and one is
greater) product become 12 and it’s present in the string. Like 4 and 5(one is lesser and one is
greater) the product is 20 and it’s present in the string and so on. In such a way, We have to find
all the numbers and in the output just we have to store the only product in the list like[ ’12’,
’20’].
If we haven’t found the product then print -1.

Question 4 :Given a list of string and numbers, rotate the string by one position to the right if the
sum of squares of digits of the corresponding number is even and rotate it twice to the left if the
sum of the squares of the digits of the corresponding number is odd.

Question 5: Given an array, find the sub array which can be a square matrix with maximum
sum. If there are multiple results print the matrices in the order of their orders( i.e, 3×3 matrix
will be printed first, then 2X2…so on)

Question 6: Given an alphanumeric string, extract all numbers, remove the duplicate digits, and
from that set of digits construct the largest even number possible.

Question 7 :Given a mxn matrix select an element if the same element appears at 4 consecutive
position again. Return the minimum element from all the gathered elements. What is
consecutive? It’s horizontal, vertical and all possible diagonals.

Question 8: State whether a giving string contains matching braces or not. In case mismatch is
present then output the index of mismatch position.

Question 9:Longest Alphabetic Sequence.

Question 10: From a alphanumeric string extract all digits, From the smallest odd number with
no repeats.

Question 11:A simple String rotation type question where INPUT will be given in the form of
Dictionary and based on the value of the Dictionary the STRING should be rotated either
clockwise or anti-clockwise.

Question 12 It is based on matrix which i felt a bit difficult. We have to find the number which
occur consecutively 4 times either in a ROW, COLUMN, DIAGONAL and more importantly
REVERSE DIAGONAL. If there are multiple such elements find the minimum among them.If
there is no such element print “-1”.

Question 13: Ques 2: Given a string of brackets (, ), {, }, [, ], find the position in the string
where the orders of brackets breaks.
I/p: ())
O/p: 3

I/p: (){[]}(
O/p: 8
Question 14 Coding Task

Write a C program to print the first half of an array at last and last half of the array at first.

Input format:

First-line contains the size of the array.

The second line contains elements of array separated by space.

Output Format:

Modified Array

Sample Input

If n = odd

12345

Expected Output:

45312

Sample Input

If n = even

146235

Expected Output:

235146

Question 15 Coding Task

Write a program to remove the given word from the input string. If the substring is not present in
the input string, then print the input string as is.
Input Format:

First-line consists of the sentence.

Second line consists of the words which we want to remove from the given sentence.

Output Format:

Sentence after the given word is removed.

Sample Input:

Conduira is an online learning platform.

learning

Expected Output:

Conduira is an online platform.

Question 16: Given array-(2,6,3,5,8,9)

Possible XSeries-(2,3,5), (2,3,5,8)

Output-Longest XSeries (2,3,5,8)

#XSeries -where sum of two numbers results in next number.

Question 17: Find longest substring of unique characters which is case insensitive.

Question 18: Generation of OTP.

Question 19: Reversing a string leaving the special characters in the same place.

Question 20: For a given list of numbers, find its factors and add the factors. Then if the sum of
factors is present in the original list, sort it and print it.

Example:

Input: 0,1,6

Factors of 0 = 0. Thus sum = 0


Factors of 1 = 1. Thus sum = 1

Factors of 6 = 1,2,3. Thus sum = 6

Output = 1,6

If the sum numbers are not present in original list, then return -1.

Question 21: Maximum number of swaps will be given and an list of digits will be given. We
have to swap numbers to get the lowest number possible by using all digits from the list.

Question 22: Input a matrix. Check if do we get the same number consecutively at least 4 times
in any fashion (Vertical, Horizontal, Diagonal). Record those sets.

• If we get such multiple sets then print the number which is the least one
• If we get such a single set then print the same number
• If we get such no set then print -1
Example1

Input m x n. Let’s take

133339

169239

122549

224579

245672

Sets we get here [3 3 3 3] horizontally in the first line, [9 9 9 9] vertically in the last column,[2 2
2 2] diagonally. Hence, we’ll print min(3,9,2) = 2 here.

Example2

Input m x n. Let’s take

1237

4558

6666

9134

Sets we get here [6 6 6 6] only horizontally in 3rd row. Hence, we’ll print 6 here.

Example3
Input m x n. Let’s take

1234

5678

9123

3214

So we get NO set here. Hence, we’ll print -1 here.

Question 23: Input type String. Output type number. Print out the maximum even number which
can be generated by making combinations of numbers present in the given string. Each number
can be used only once ie. No Redundancy.

Example1

Input String = Infytq@218412

Intermediate step (List of numbers *//redundancy removed*) = [2,1,8,4]

Output Number = 8412

Example2

Input String = someString&337

Intermediate step (List of numbers *//redundancy removed*) = [3,7]

Output Number = -1

Question 24: Given m*n matrix where m defines number of rows and n defines number of
columns. Your job is to check whether a number is consecutive for 3 times either in row,
column, or diagonal. If there are more than one such numbers then print the minimum one.

Note : n = m+1

Input :

First Input : m, displaying number of rows

Second Input : m*n matrix

Output :

Integer

Sample Testcases :
I/P 1:

23456243

23476762

23555525

23112136

11119035

23115127

O/P 1 : 1

Note : Make combinations with 4 integers only.

Question 25: Given a special set of numbers and a special sum. Find all those combinations
from the given set, equaling the given sum.

Input :

First Input : Set of numbers

Second Input : Special Sum

Output :
Combinations satisfying criteria

Sample Testcases :

I/P 1:

-1, 1, 0, 0, 2, -2

O/P 1

Explanation : Following combinations are satisfying (-1,1,2,-2), (0, 0, 1, -1), (0, 0, -2, 2)

Note : Make combinations with 4 integers only.

Solution :

import itertools

l=list(map(int,input().split(",")))

s=int(input())

res=list(itertools.combinations(l,4))

c=0

for i in res:

u=sum(i)

if u == s:

c+=1

print(c)

Question 26: You are given a list of numbers from 1 to 9, in which each word is seperated by ‘,’.
Your job is to find the sum of two numbers. These two numbers are needed to be calculated as
per following rules :

1. First number should be calculated as :

Add all the numbers that do not come between 5 and 8 in the input.
2. Second number should be calculated as :

Append all the numbers to each other that comes between 5 and 8 (inclusive).

Find the sum of both numbers.

Note : 5 always comes before 8.

Number of 5’s = Number of 8’s.

Input :

First Input : List of numbers

Output :

“Sum of both numbers”

Sample Testcases :

I/P 1:

3,4,5,2,7,9,8,3,2

O/P 1:

52810

Solution :

#taking list as input where each element is seperated by ','

lst = list(map(int,input().split(",")))

#find sum of numbers that occur before 5

a = sum(lst[:lst.index(5)])

#find sum of numbers that occur after 8

b = sum(lst[lst.index(8)+1:])
#finding first number

n1 = a+b

#finding second number

rest = lst[lst.index(5):lst.index(8)+1]

n2 = ""

for i in rest:

n2+=str(i)

print(int(n2)+n1)

Question 27: Given a row/column count and a matrix, your job is to find those possible
2*2 matrix where each should follow the given rule :

-> Each element of matrix should be divisible by sum of its digits.

Input :

First Input : Row count, Column Count

Second Input : Matrix

Output :

2*2 matrices satisfying the rule.

Sample Testcases :

I/P 1:

43

40 42 2

30 24 27

180 190 40

11 121 13

O/P 1:
40 42

30 24

30 24

180 190

24 27

190 40

Question 28: You are provided with a mathematical expression, your job is to solve this
expression.

Input :

First Input : String

Output : Result

Sample Testcases :

I/P 1:

(4+3)*(12/6)+100

O/P 1:

114

Solution :

exp=str(input())

res=int(eval(exp))

print(res)
Question 29: You are provided with a string of numbers, check whether it is a palindrome or
not. If it is not a palindrome, then, reverse the string, add it to the original string and check
again. You are required to repeat the process until it becomes palindrome. Find the length of
palindromic string.

Input :

First Input : String

Output : Length of Palindrome

Sample Testcases :

I/P 1:

O/P 1:

I/P 2:

145

O/P 2:

Explanation :

Given string is 145, it is not a palindrome. Reversing and adding, 145+541 = 686,
Hence it is a palindrome.

Solution :

def palincheck(num):

s=str(num[::-1])
if s==num:

return True

return False

n=(input())

val=0

k=0

while(True):

if(palincheck(n)):

val=len(n)

print(val)

break

else:

s1 = str(n[::-1])

k=int(n)+int(s1)

n=str(k)

palincheck(n)

Question 30: You will be given a string of characters and special characters, you task is
to reverse the string leaving special characters in same place.

Input :

First Input : String

Output : Special Reverse of string

Sample Testcases :

I/P 1:

dsd$^f#
O/P 1:

fds$^d#

Solution :

s=input()

d=dict()

res=””

for i in range(len(s)):

if s[i].isalnum()==False:

d.update({i:s[i]})

else:

res+=s[i]

res=list(res[::-1])

for i,j in d.items():

res.insert(i,j)

print(“”.join(res))

Question 31: You will be given a number in the form of string, extract out digits at odd
places, square & merge them. First 4 digits will be the required OTP.

Input :

First Input : String

Output : 4 digit OTP

ample Testcases :
I/P 1:

34567

O/P 1:

1636

Solution :

n=input()

s=””

i=0

for i in range(0,len(n)):

if int(i)%2==1:

s+=str(int(n[i])**2)

print(s[:4])

Question 32: For a given list of numbers, find its factors and add the factors. Then if the
sum of factors is present in the original list, sort it and print it else print -1.

Input :

First Input : List of numbers

Output : List of factors

Sample Testcases :

I/P 1:

1,2,4,7

O/P 1:
[1,4]

I/P 2:

2,4

O/P 2:

-1

Solution :

def findfactsum(n):

s=1

for j in range(2,n+1):

if n%j==0:

s+=j

return s

res=[]

l=list(map(int,input()))

for i in l:

val=findfactsum(i)

if val in l:

res.append(i)

if(len(res)==0):

print(“-1”)

else:

print(sorted(res))

Question 33: Find longest substring of unique characters which is case insensitive.
For “ABDEFGABEF”, the longest substring are “BDEFGA” and “DEFGAB”, with length
6.

For “BBBB”, the longest substring is “B”, with length 1.

For “CDEF”, the longest substring is “CDEF” with length 4.

Input :

First Input : String

Output : Length of longest substring

Sample Testcases :

I/P 1:

CDEF

O/P 1:

Solution :

s=input()

s1=””

for i in range(len(s)):

if(s[i] in s1):

break;

else:

s1+=s[i]

print(len(s1))

Question 34: Given a string of random numbers, your job is to find the product of the
numbers(one is lesser and one is greater) who is already present in the string.
For instance, a pronic number is a number which is the product of two consecutive
integers, that is, a number of the form n(n + 1). Like 6 is the pronic number as 2*3 = 6.

Input :

First Input : String of random numbers

Output : List of pronic numbers

Sample Testcases :

I/P 1:

123456

O/P 1:

[2,6,12]

I/P 2:

4567

O/P 2:

-1

Solution :

import itertools

list1=[]

s=str(input())

res = [s[i: j] for i in range(len(s))

for j in range(i + 1, len(s) + 1)]

def pronic(s1):

set1=[]

set2=[]

for p in range(0,len(s1)-1):
a=int(s1[p])

b=int(s1[p+1])

mul=int(a*b)

mul=str(mul)

if mul in res:

set1.append(mul)

if (len(set1)==0):

print(“-1”)

else:

print(set1)

pronic((s))

Question 35: Given a string and it contains the digits as well as non-digits. We have to
find the largest even number from available digits after removing the duplicates. If not
possible, print -1.

Input :

First Input : String

Output :

Largest number

Sample Testcases :

I/P 1:

%#32%#%2

O/P 1:

32
I/P 2:

%#2373#@

O/P 2:

732

Solution :

def largeeven(lst):

if(res[-1]%2==0 or res[-1]==0):

return res

else:

for j in range(1,len(lst)+1):

if(res[-j]%2==0 or res[-j]==0):

ev=res.pop(-j)

res.append(ev)

return res

else:

return -1

s1=set()

s=str(input())

for i in s:

if i.isdigit():

s1.add(int(i))

res=sorted(s1,reverse=True)

print(largeeven(s1))

POSTED ON
Question 36: You are given a string of brackets (, ), {, }, [, ], your job is to find the position of
string where order of brackets breaks.

Input :

First Input : String of Brackets

Output :

Position where order breaks. (keep 1-based indexing in mind)

Sample Testcases :

I/P 1:

[(((())))][

O/P 1:

12

I/P 2:

{{]}()

O/P 2:

Solution :

s1=[]

op=[‘(‘,'{‘,'[‘]

cl=[‘)’,’}’,’]’]

def validate(s):

for i in range(len(s)):
if s[i] in op:

s1.append(s[i])

elif s[i] in cl:

res=cl.index(s[i])

if(len(s1)>0) and (op[res]==s1[len(s1)-1]):

s1.pop()

else:

return (i+1)

if(len(s1)==0):

return 0

else:

return len(s)+1

s=str(input())

print(validate(s))

Question 37: Given a string s, find length of the longest prefix which is also suffix. The prefix
and suffix should not overlap.

Input :

First Input : String

Output :

“Length of prefix-suffix”

Sample Testcases :

I/P 1:

codeecode
O/P 1:

4 (code is only prefix-suffix & has length 4)

I/P 2:

wwwwww

O/P 2:

3 (www is only prefix-suffix & has length 3)

Solution :

def longestPreSuf(s) :

n = len(s)

prsf = [0] * n

l=0

i=1

while (i < n) :

if (s[i] == s[l]) :

l=l+1

prsf[i] = l

i=i+1

else :

if (l != 0) :

l = prsf[l-1]

else :

prsf[i] = 0

i=i+1

res = prsf[n-1]
if(res > n/2) :

return n//2

else :

return res

s = str(input())

print(longestPreSuf(s))

Question 38: You are provided two or more strings, where each string is associated with the
number (seperated by :). If sum of square of digits is even then rotate the string right by one
position, and if sum of square of digits is odd then rotate the string left by two position.

Input :

Accept multiple values in the form of String:Integer seperated by ‘,’

Output :

Rotated Strings.

Sample Testcases :

I/P 1 :

abcde:234,pqrs:246

O/P 1 :

cdeab

spqr

Explanation :

For first teststring, ‘abcde’ associated integer is 234, squaring 4+9+16=29, which is odd,
so we rotate string left by two positions. For second teststring, ‘spqr’ associated integer
is 246, squaring 4+16+36=56, which is even, so we rotate string right by one position.

Solution :
s=input().split(“,”)

sa=[]

num=[]

for i in s:

s1,n=i.split(“:”)

sa.append(s1)

num.append(n)

def rotate(s2,n):

n=list(str(n))

s=0

for i in n:

s+=int(i)**2

if s%2==0:

return s2[-1:]+s2[:-1] #right rotate

else:

return s2[2:]+s2[:2] #left rotate

for i in range(len(num)):

print(rotate(sa[i],num[i]))
Test-III –Infy Pythom MCQ
1.Python was invented by :
GV Rossum
Dennis Ritchie
Bjarne Stroustrap
James Gosling

2.Predict the output of following code :

a = 8.3
b=2
print a//b
4.15
4
4.1
4.0

3.Which of the following statement about Python is True ?


Python is the successor of Java Language.
Python is an object based programming language
Python is an object oriented programming language
None of the above

4.Hexadecimal values in Python are represented as :


Ox
oX
0x
Ohex
5.It raises x value to the next higher integer value :
pow()
ceil()
floor()
round()

6.It converts angle value x from radians to degrees.


rad2deg()
degrees()
degree()
None of the above

7.In the function pow(x,y,z), 'z' represents :


Division operation
Step up operation
MOD operation
None of the above

8.Predict the output of following code :

s='pythonn'
print(s[0:7:2])
pythonn2
pythonn
pton
2

9.Predict the output of following code :

l = ["one","two","three"]
s = "-".join(l)
print(s)
Type Error : join() not applicable for lists
[one-two-three]
one-two-three
-one-two-three-

10.It is used to know whether a string is ending with a substring or not.


ends_with()
end_with()
endswith()
None of these
11.For formatting the output screen, we use :
modified()
formatted()
format_output()
format()

12.Which one of these is a valid syntax :


'{}-{}'.format(id,name,sal)
{}-{}-{}.format(id,name,sal)
'{}-{}-{}'.formats(id,name,sal)
None of these

13.For sorting a string we use :


sort()
sorted()
None of the above
Both

14.Predict the output :

l = [10,20,30]
print(l*2)
[10,20,30,10,20,30]
[20,40,60]
10 20 30 10 20 30
10 20 3010 20 30
15.Which of the following method does not work with list ?
push()
pop()
extend()
None of the above
16.Predict the output of following code :

s = set("code of geeks")
print(s.difference("geeks "))
8
{'c', 'o', 'f', 'd', ' '}
{'c', 'o', 'f', 'd'}
{'g', 'e', 'k', 's'}

17.Predict the output of following code :

s = set("code of geeks")
print(s.intersection("geeks "))
Error : Operation Intersection not defined
{'g', 'e', 'k', 's', ' '}
{'k', 'o', 'g', 'd', 'f', 'e', 's', ' ', 'c'}
None of these

18.Predict the output of following code :

r = lambda g: g * 2
s = lambda g: g * 3
x=2
x = r(x)
x = s(x)
x = r(x)
x = s(x)
print(x)
4
24
72
Compilation Error
19.Identify the line which has error :

a=1
s=1
for i in (2,3,5):
s=a++
print(s)
2
3
4
5

20.s1 = {2,3,4,5}
s1[2] = 3
print(s1)

Predict the output.


{2,3,4,5}
{2,3,3,5}
Type Error
None of these
21.In Python, objects can be instantiated using :
Garbage Collection
Destructor
Constructor
Self

22.To work with regular expressions, we have to import :


regex
rg
re
@regex

23.Which line of code has error ?

import re
s = ‘s’
x = re.search(‘a’,s)
print(x.start())
1
2
4
No error

24.Predict the output of following code :

print('code'.replace('cde', '1'))
1
cde
code
Error : String 'cde' not present in original string

25.Predict the output of following code :

def int():
print("CODE")
int
int()
Unknown reference to 'int'
Error : int can't be a variable name
CODE
None of these
26.Decorators generally starts with :
!
@
$
#

27.Which of the following expressions can be used to multiply a given number ‘a’
by 4?
a>>2
a>>4
a<<4
a<<2

28.Find the value returned in both case :

sum(2,4,23)
sum({1,2,7})
29 10
29 Error
Error 10
None of these

29.Predict the output of the code :

def outer():
global glo
glo = 20
def inner():
global glo
glo = 30
print(glo)
glo = 10
outer()
print( glo)
10
20
30
None of these

30.Predict the output of following code :

dicts = dict()
for l in enumerate(range(2)):
dicts[l[0]] = l[1]
dicts[l[1]+7] = l[0]
print(dicts)
{0:0, 1:1, 2:1, 3:0}
{0:0, 1:1, 8:1, 7:0}
Error : Dictionary index can not be modified
None of These
31.Which dictionary method returns an object that contains key-value pairs of
dictionary ?
items()
keys()
elements()
element()

32.We can convert two lists into dictionary using :


list2dict()
zip()
ping()
ord()

33.This method computes the cartesian product of input iterables.


intersection()
multiply()
product()
vector_product()

34.Which of the following is not a keyword in Python ?


yield
None of the above
raise
nonlocal

35.Which function is used to read the single line as a input ?


readline()
readlines()
read()
None of these
36.Predict the output for following code :

print('{a}{b}{a}'.format(a='code', b='of geeks'))


code of geekscode
code of geeks code
codeof geekscode
None of the above

37.Predict the output of following code :

int = 1
def randommethod():
global int
for i in (1, 2, 3):
int += 1
randommethod()
print(int)
Compile Time Error
1
Type Error
4

38.To open a text file for writing operation, we use :


fil = open("filename.txt",'w')
fil = open_file("filename.txt",'w')
fil = open("filename.txt",'r')
None of these

39.Predict the output of following code :

class stud:
def __init__(self, roll_no, grade):
self.roll_no = roll_no
self.grade = grade
def display (self):
print("Roll no : ", self.roll_no, ", Grade: ", self.grade)
stud1 = stud(28, ‘acode’)
stud1.age=24
print(hasattr(stud1, 'age'))
28
Error
24
None of these

40.Predict the output of following code :

List = ['code','of','codeofgeeks']
print(List[2][-6])
codeofgeeks
f
Error - Unidentified operation on List
o

41.Predict the output of following code :

lst = [1, 2, 3]
lst.append([5,6,7,8,9,10])
print(len(lsts))
3
9
4
Error

42.Predict the output of following code :

print(bool)
print(bool())
True
Error True
False
Error False

43.Predict the output of following code :

key = 100
try:
key = key/0
except ZeroDivisionError:
print('Hacked ', end = '')
else:
print('Division successful ', end = '')

try:
key = key/5
except:
print('Hacked 1 ', end = '')
else:
print('Coder', end = '')
Hacked Coder
Hacked Hacked1
Hacked Coder Hacked1
None of these

44.Predict the output of following code :

dig = 0
for i in range(0, 5, 0.1):
dig += i
i+=0
print(dig)
5
0.1 + 0.2 + ........ + 4.99
0.1 + 0,2 + ........ + 4.00
Error

45.To execute a python program using command prompt, which command is


used ?
execute python filename
python
run python
None of these

46.Predict the output of following code :

s= 'codeofgeeks'
for i in range(len(s)):
s[i].upper()
print (s)
Codeofgeeks
codeofgeeks
CODEOFGEEKS
Type Error

47.Predict the output of following code :

import re
s = "code of geeks code of geeks code of geeks"
x = re.sub("geeks","god",s,2)
print(x)
code of geeks code of god code of geeks
code of god code of god code of geeks
code of geeks code of geeks code of god
Runtime Error

48.Which of the following is not a Python Flavor


pypy
Jython
numpy
CPython

49.It removes the key ‘k’ and its value from ‘dict’.
dict.remove(k,v)
dict.pop(k,v)
dict.delete(k,v)
dict.erase(k,v)
Answers of above 1-50 questions

Python was invented by :

Correct Answer: GV Rossum

Predict the output of following code :

a = 8.3
b=2
print a//b
Answer Provided:
Correct Answer: 4.0

Which of the following statement about Python is True ?


Answer Provided:
Correct Answer: Python is an object oriented programming language

Hexadecimal values in Python are represented as :


Answer Provided:
Correct Answer: 0x

It raises x value to the next higher integer value :


Answer Provided:
Correct Answer: ceil()

It converts angle value x from radians to degrees.


Answer Provided:
Correct Answer: degrees()

In the function pow(x,y,z), 'z' represents :


Answer Provided:
Correct Answer: MOD operation

Predict the output of following code :

s='pythonn'
print(s[0:7:2])
Answer Provided:
Correct Answer: pton

Predict the output of following code :

l = ["one","two","three"]
s = "-".join(l)
print(s)
Answer Provided:
Correct Answer: one-two-three

It is used to know whether a string is ending with a substring or not.


Answer Provided:
Correct Answer: endswith()

For formatting the output screen, we use :


Answer Provided:
Correct Answer: format()

Which one of these is a valid syntax :


Answer Provided:
Correct Answer: None of these

For sorting a string we use :


Answer Provided:
Correct Answer: Both

Predict the output :

l = [10,20,30]
print(l*2)
Answer Provided:
Correct Answer: [10,20,30,10,20,30]

Which of the following method does not work with list ?


Answer Provided:
Correct Answer: push()

Predict the output of following code :


s = set("code of geeks")
print(s.difference("geeks "))
Answer Provided:
Correct Answer: {'c', 'o', 'f', 'd'}

Predict the output of following code :

s = set("code of geeks")
print(s.intersection("geeks "))
Answer Provided:
Correct Answer: {'g', 'e', 'k', 's', ' '}

Predict the output of following code :

r = lambda g: g * 2
s = lambda g: g * 3
x=2
x = r(x)
x = s(x)
x = r(x)
x = s(x)
print(x)
Answer Provided:
Correct Answer: 72

Identify the line which has error :

a=1
s=1
for i in (2,3,5):
s=a++
print(s)
Answer Provided:
Correct Answer:

s1 = {2,3,4,5}
s1[2] = 3
print(s1)

Predict the output.


Answer Provided:
Correct Answer:
In Python, objects can be instantiated using :
Answer Provided:
Correct Answer:

To work with regular expressions, we have to import :


Answer Provided:
Correct Answer: re

Which line of code has error ?

import re
s = ‘s’
x = re.search(‘a’,s)
print(x.start())
Answer Provided:
Correct Answer: No error

Predict the output of following code :

print('code'.replace('cde', '1'))
Answer Provided:
Correct Answer: code

Predict the output of following code :

def int():
print("CODE")
int
int()
Answer Provided:
Correct Answer: CODE

Decorators generally starts with :


Answer Provided:
Correct Answer: @

Which of the following expressions can be used to multiply a given number ‘a’ by
4?
Answer Provided:
Correct Answer: a<<2
Find the value returned in both case :

sum(2,4,23)
sum({1,2,7})
Answer Provided:
Correct Answer: Error 10

Predict the output of the code :

def outer():
global glo
glo = 20
def inner():
global glo
glo = 30
print(glo)
glo = 10
outer()
print( glo)
Answer Provided:
Correct Answer: 20

Predict the output of following code :

dicts = dict()
for l in enumerate(range(2)):
dicts[l[0]] = l[1]
dicts[l[1]+7] = l[0]
print(dicts)
Answer Provided:
Correct Answer: {0:0, 1:1, 8:1, 7:0}

Which dictionary method returns an object that contains key-value pairs of


dictionary ?
Answer Provided:
Correct Answer: items()

We can convert two lists into dictionary using :


Answer Provided:
Correct Answer: zip()

This method computes the cartesian product of input iterables.


Answer Provided:
Correct Answer: product()

Which of the following is not a keyword in Python ?


Answer Provided:
Correct Answer: None of the above

Which function is used to read the single line as a input ?


Answer Provided:
Correct Answer: readlines()

Predict the output for following code :

print('{a}{b}{a}'.format(a='code', b='of geeks'))


Answer Provided:
Correct Answer: codeof geekscode

Predict the output of following code :

int = 1
def randommethod():
global int
for i in (1, 2, 3):
int += 1
randommethod()
print(int)
Answer Provided:
Correct Answer: 4

To open a text file for writing operation, we use :


Answer Provided:
Correct Answer: fil = open("filename.txt",'w')

Predict the output of following code :

class stud:
def __init__(self, roll_no, grade):
self.roll_no = roll_no
self.grade = grade
def display (self):
print("Roll no : ", self.roll_no, ", Grade: ", self.grade)
stud1 = stud(28, ‘acode’)
stud1.age=24
print(hasattr(stud1, 'age'))
Answer Provided:
Correct Answer: Error

Predict the output of following code :

List = ['code','of','codeofgeeks']
print(List[2][-6])
Answer Provided:
Correct Answer: f

Predict the output of following code :

lst = [1, 2, 3]
lst.append([5,6,7,8,9,10])
print(len(lsts))
Answer Provided:
Correct Answer: Error

Predict the output of following code :

print(bool)
print(bool())
Answer Provided:
Correct Answer: False

Predict the output of following code :

key = 100
try:
key = key/0
except ZeroDivisionError:
print('Hacked ', end = '')
else:
print('Division successful ', end = '')

try:
key = key/5
except:
print('Hacked 1 ', end = '')
else:
print('Coder', end = '')
Answer Provided:
Correct Answer: Hacked Coder

Predict the output of following code :

dig = 0
for i in range(0, 5, 0.1):
dig += i
i+=0
print(dig)
Answer Provided:
Correct Answer: Error

Predict the output of following code :

int = 1
def randommethod():
global int
for i in (1, 2, 3):
int += 1
randommethod()
print(int)
Answer Provided:
Correct Answer: 4

To execute a python program using command prompt, which command is used ?


Answer Provided:
Correct Answer: python

Predict the output of following code :

s= 'codeofgeeks'
for i in range(len(s)):
s[i].upper()
print (s)
Answer Provided:
Correct Answer: codeofgeeks

Predict the output of following code :

import re
s = "code of geeks code of geeks code of geeks"
x = re.sub("geeks","god",s,2)
print(x)
Answer Provided:
Correct Answer: code of god code of god code of geeks

Which of the following is not a Python Flavor


Answer Provided:
Correct Answer: numpy

It removes the key ‘k’ and its value from ‘dict’.


Answer Provided:
Correct Answer: dict.pop(k,v)
Test-IV –Infytq

1) What will be the output of the code below?

class ClassA:
def _init_(self, val1) :
self.value = val1
def method_a(self) :
return 10+self.value
class ClassB:
def _init_(self, val2):
self. num=val2
def method_b(self, obj):
return obj.method_a()+self.num

obj1=ClassA(20)
obj2=ClassB(30)
print(obj2.method_b(obj1))

a) 60
b) 50
c) 30
d) 40

2) Consider the relational schema along with the functional dependencies given below:

gaming (garnename, gametype, amount, playerno, playername, playertype, discount, duration)

• playerno -> playername, playertype, discount

• gamename -> gametype, duration, amount

• playertype -> discount


How many tables will result when the relation is in 3NF?

a) 2
b) 4
c) 3
d) 1

3) Consider the Hashing methods given below:

i) h(key) = key%10
ii) h(key) = key%25
iii) h(key) = key%50

Which of the hashing methods would NOT lead to collision when the following values are to be stored in
the hash tablé?

80, 20, 35, 45, 25, 90

a) Only
b) Both ii) and iii)
c) Both i) and iii)
d) All i), ii) and iii)

4) Number 14 needs to be searched using BINARY SEARCH in the following sorted list of numbers:
1, 3, 7.9, 14, 19, 45
How many comparisons will be required to conclude that the number 14 is found at the 5th position?
Note: We have used integer division for finding the middle element and the index starts with 0 (zero)

a) 2
b) 3
c) 4
d) 1

5) Consider a Patient table with attributes patientid (primary key), patientname, city, dateofbirth, and
phone. Except patientid no columns are unique. The table has three indexes as follows:

IDX1 – patientid
IDX2 – patientname, dateofbirth
IDX3 – gateofbirth, phone
Which of the following queries will result in INDEX UNIQUE SCAN?

a) WHERE city <> ‘Mumbai’ AND dateofbirth > ’30-Mar-1995′


b) WHERE patientid = ‘P1007′ AND dateofbirth ’30-Mar-1995’
c) WHERE patientname = ‘Sam’ AND dateofbirth = ’30-Mar-1995′
d) WHERE patientname LIKE ‘R%’

Q6

What gets printed? name = "snow storm" name[5] = 'X' print name

Ans D
A) snow storm
B) snowXstorm
C) snow Xtorm
D) ERROR, this code will not run

Q7

What gets printed? var = 100 if ( var == 100 ) : print "Value of expression is 100"

Ans C
• A) Nothing
• B) An Error
• C) Value of expression is 100
• D) NONE

Ans:- D

Q8

What is the output of the following Python program? num1 = 5 if num1 >= 91: num2 = 3 else: if num1
< 6: num2 = 4 else: num2 = 2 x = num2 * num1 + 1 print (x,x%7)

Ans B
• A) 21 3
• B) 21 0
• C) 21 21
• D) NONE

Q9
slicing operations can be used on strings as well?

Ans A
• A) True
• B) False

Q10

strings can be enclosed within single, double or triple quotes?

Ans A
• A) True
• B) False

Q11

What gets printed? unichr(1234)

Ans A
• A) 1234
• B) abcd
• C) u04d2
• D) None of the above

Q12

What are BIFs?

Ans B
• A) Back Index Format
• B) Built In Functions
• C) Bored Inline Functions
• D) Boost Index File

Q13
Which of these is not a core datatype?

Ans C
• A) Lists
• B) Dictionary
• C) Tuples
• D) Class

Q14

9.
What gets printed? a = 10 b = 2 print a if b else 0

Ans A
• A) 10
• B) 2
• C) 0
• D) Error

Q15

What is the python file format?

Ans C
• A) TXT
• B) DAT
• C) PY
• D) JAVA

Q16

What gets printed? def myfunc(x, y, z, a): print x + y nums = [1, 2, 3, 4] myfunc(*nums)

Marks B
• A) 1
• B) 3
• C) 4
• D) 5

Q17

What gets printed? if False: print('Hi') elif True: print('Hello') else: print('Howdy')

Ans V
• A) Nothing
• B) Hi
• C) Hello
• D) Howdy

Q18

What gets printed? print "hello" 'world'

Ans B
• A) The text, "hello world" in one line
• B) The text, "helloworld" in one line
• C) "hello" in one line and "world" in the next line
• D) Syntax Error. This Python program will not run.

Q19

what gets printed? a = range(5) b = range(10) print(zip(a,b))

Ans B
• A) 5 10
• B) 1 2 3 4 5
• C) [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
• D) 0, 0, 1, 1, 2, 2, 3, 3, 4, 4

Q20
What gets printed? def addItem(listParam): listParam += [1] mylist = [1, 2, 3, 4] addItem(mylist) print
len(mylist)

Ans D
• A) 1
• B) 3
• C) 4
• D) 5

Q21

What gets printed? while a = 10: print('Howdy')

Ans C
• A) Howdy
• B) Nothing
• C) An Error
• D) 10

Q22

What gets printed? def dostuff(param1, *param2): print type(param2) dostuff('apples', 'bananas',
'cherry', 'dates')

Ans C
• A) str
• B) int
• C) tuple
• D) list

Q23

String in python is immutable?

Ans A
• A) True
• B) False
Q24

What sequence of numbers is printed? values = [1, 2, 1, 3] nums = set(values) def checkit(num): if
num in nums: return True else: return False for i in filter(checkit, values): print i

Ans B
• A) 1 2 3
• B) 1 2 1 3
• C) 1 2 13 1 2 1 3
• D) Error

Q25

What gets printed? name = 'python' while bool(name) == False: print('hi')

Ans B
• A) hi
• B) true
• C) false
• D) nothing
Test IV

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

Q1. Look at this series: 12, 11, 13, 12, 14, 13, Q2. Look at this series: 36, 34, 30, 28, 24, … What
… What number should come next? number should come next?
A. 10 A. 22
B. 16 B. 26
C. 13 C. 23
D. 15 D. 20
Q3 Look at this series: 7, 10, 8, 11, 9, 12, … Q4. Look at this series: 2, 1, (1/2), (1/4), … What
What number should come next? number should come next?
A. 7 A. (1/3)
B. 12 B. (1/8)
C. 10 C. (2/8)
D. 13 D. (1/16)
Q5. Look at this series: 80, 10, 70, 15, 60, … Q6. Which word does NOT belong with the others?
What number should come next? A. index
A. 20 B. glossary
B. 25 C. chapter
C. 30 D. book
D. 50
Q7. Which word is the odd man out? Q8. Which word does NOT belong with the others?
A. trivial A. wing
B. unimportant B. fin
C. important C. beak
D. insignificant D. rudder
Q9. Which word is the odd man out? Q10. Pick the odd man out?
A. hate A. just
B. fondness B. fair
C. liking C. equitable
D. attachment D. biased
Q11. CUP : LIP :: BIRD : ? Q12. Paw : Cat :: Hoof : ?
A. GRASS A. Lamb
B. FOREST B. Horse
C. BEAK C. Elephant
D. BUSH D. Tiger
Q13. Safe : Secure :: Protect : Q14. Melt : Liquid :: Freeze :
A. Lock A. Ice
B. Guard B. Solid
C. Sure C. Condense
D. Conserve D. Push
Q15. Parts : Strap :: Wolf : Q16. An Informal Gathering occurs when a group
A. Flow of people get together in a casual, relaxed manner.
B. Animal Which situation below is the best example of an
C. Wood Informal Gathering?
D. Fox
A. A debating club meets on the first Sunday
morning of every month.
B. After finding out about his salary raise, Jay and a
few colleagues go out for a quick dinner after
work.
C. Meena sends out 10 invitations for a
bachelorette party she is giving for her elder sister.
D. Whenever she eats at a Chinese restaurant,
Roop seems to run into Dibya.
Q17. A Tiebreaker is an additional contest Q18. The Sharks and the Bears each finished with
carried out to establish a winner among tied 34 points, and they are now battling it out in a
contestants. Choose one situation from the five-minute overtime.
options below that best represents a
Tiebreaker. A. When he is offered a better paying position,
Jacob leaves the restaurant he manages to
A. At halftime, the score is tied at 2-2 in a manage a new restaurant on the other side of
football match. town.
B. Serena and Maria have each secured 1 set B. Catherine is spending her junior year of college
in the game. studying abroad in France.
C. The umpire tosses a coin to decide which C. Malcolm is readjusting to civilian life after two
team will have bat first. years of overseas military service.
D. RCB and KKR each finished at 140 all out. D. After several miserable months, Sharon decides
that she can no longer share an apartment with
her roommate Hilary.
Q19. Reentry occurs when a person leaves Q20. Posthumous Award occurs when an award is
his or her social system for a period of time given to someone, after their death. Choose one
and then returns. Which situation below situation below as the best example of
best describes Reentry? Posthumous Award.

A. When he is offered a better paying A. Late yesteryear actress Sridevi was awarded
position, Javed leaves the hotel he manages with a Lifetime Achievement Award posthumously
to manage another one in a neighboring city. in Filmfare 2019.
B. Charan is spending her final year of B. Chitra never thought she’d live to receive a third
college studying abroad in China. booker prize for her novel.
C. Manan is readjusting to civilian life after 2 C. Emanuel has been honored with a prestigious
years of overseas merchant navy service. literary award for his writing career and his
D. After 5 miserable months, Sneha decides daughter accepted the award on behalf of her
that she can no longer share her room with deceased father.
roommate Hital. D. Meenal’s publisher canceled her book contract
after she failed to deliver the manuscript on time.
Test V

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

Q1. The ‘A’ state government has chalked Q2. The car dealer found that there was a
out a plan for the underdeveloped ‘B’ district tremendous response for the new XYZ’s car
where 66% of the funds will be placed in the booking with long queues of people complaining
hands of a committee of local about the duration of business hours and
representatives. arrangements. Courses of action:
Courses of action: I. People should make their arrangement of lunch
I. The ‘A’ state government should decide and snacks while going for car XYZ’s booking and
guidelines and norms for the functioning of be ready to spend several hours.
the committee. II. Arrangement should be made for more booking
II. Other state government may follow desks and increase business hours to serve more
similar plan if directed by the Central people in less time.
government.
A. If only I follows
A. If only I follows B. If only II follows
B. If only II follows C. If either I or II follows
C. If either I or II follows D. If neither I nor II follows
D. If neither I nor II follows E. If both I and II follow
E. If both I and II follow
Q3. The ‘M’ state government has decided Q4. lert villagers nabbed a group of bandits armed
hence forth to award the road construction with murderous weapons. Courses of action:
contracts through open tenders only. I. The villagers should be provided sophisticated
Courses of action: weapons.
I. The ‘M’ state will not be able to get the II. The villagers should be rewarded for their
work done swiftly as it will have to go courage and unity.
through tender and other procedures.
II. Hence forth the quality of roads A. If only I follows
constructed may be far better. B. If only II follows
C. If either I or II follows
A. If only I follows D. If neither I nor II follows
B. If only II follows E. If both I and II follow
C. If either I or II follows
D. If neither I nor II follows
E. If both I and II follow
Q5. 10 coaches of a passenger train have got Q6. If a legislature decides to fund agricultural
derailed and have blocked the railway track subsidy programs, national radio, and a small
from both ends. Courses of action: business loan program, what 2 other programs can
I. The railway authorities should immediately they fund?
send men and equipment and clear the spot
II. All the trains running in both directions A. harbor improvements and school music
should be diverted immediately via other program
routes. B. harbor improvements and international airport
C. hurricane preparedness and international
A. If only I follows airport
B. If only II follows D. hurricane preparedness and school music
C. If either I or II follows program
D. If neither I nor II follows E. harbor improvements and hurricane
E. If both I and II follow preparedness
Q7. Statement: Anger is energy, in a more Q8. Statement: Medicine ‘P’ is a drug which is
proactive way and how to channelize it is in causing ripples in the medical field.
itself a skill. Assumptions: I. No other drug is causing ripples in
Assumptions: I. Anger need to be the medical field.
channelized. II. Medicine ‘P’ is a great drug.
II. Only skillful people can channelize anger
to energy. A) If only assumption I is implicit.
B) If only assumption II is implicit.
A) If only assumption I is implicit. C) if either I or II is implicit.
B) If only assumption II is implicit. D) if neither I or II is implicit.
C) if either I or II is implicit. E) if both I and II are implicit.
D) if neither I or II is implicit.
E) if both I and II are implicit.
Q9. A train 110 m long is running with a Q10. A, B, and C started a business with capitals of
speed of 60 km/hr. At what time will it pass Rs. 8000, Rs. 10000, and Rs. 12000 respectively. At
a man who is running at 6 km/hr in the the end of the year, the profit share of B is Rs.
direction opposite to that in which the train 1500. The difference between the profit shares of
is going? A and C is?
a)5 sec a.Rs. 300
b)6 sec b.Rs. 400
c)7 sec c.Rs. 500
d)10 sec d.Rs. 600
e.None of these
Q11.If Rs. 510 be divided among A, B, C in Q12. The current of a stream runs at the rate of 4
such a way that A gets 2/3 of what B gets, kmph. A boat goes 6 km and back to the starting
and B gets 1/4 of what C gets, then their point in 2 hours, then find the speed of the boat in
shares are respectively? still water?
a) Rs. 120, Rs. 240, a)10 kmph
b) Rs. 150Rs. 60, Rs. 90, b)21 kmph
c) Rs. 360Rs. 150, Rs. 300, Rs. 60 c)8 kmph
d) None of these d)12 kmph
Q13. In how much time would the simple Q14Find the cost of fencing around a circular field
interest on a certain sum be 0.125 times the of diameter 28 m at the rate of Rs.1.50 a meter?
principal at 10% per annum? a)Rs.150
a) 1 1/4 years b)Rs.132
b) 1 3/4 years c)Rs.100
c) 2 1/4 years d)Rs.125
d) 2 3/4 years
Q15. A pupil’s marks were wrongly entered Q16. The H.C.F of two numbers is 11, and their
as 83 instead of 63. Due to the average L.C.M is 7700. If one of the numbers is 275, then
marks for the class got increased by half. The the other is?
number of pupils in the class is? a)279
a)10 b)283
b)20 c)308
c)40 d)318
d)73
Q17. If the sum of the two numbers is 22 Q18. Three pipes A, B and C can fill a tank from
and the sum of their squares is 404, then the empty to full in 30 minutes, 20 minutes and 10
product of the numbers is? minutes respectively. When the tank is empty, all
a)40 the three pipes are opened. A, B and C discharge
b)44 chemical solutions P, Q and R respectively. What is
c)80 the proportion of solution R in the liquid in the
d)88 tank after 3 minutes?
a)5/11
b)6/11
c)7/11
d)8/11

Q19. The principle that amounts to Rs. 4913 Q20. The radius of a wheel is 22.4 cm. What is the
in 3 years at 6 1/4 % per annum C.I. distance covered by the wheel in making 500
compounded annually, is? resolutions?
a)Rs. 3096 a) 252 m
b)Rs. 4076 b) 704 m
c)Rs. 4085 c) 352 m
d)Rs. 4096 d) 808 m
e) None of these

Solution Link : https://www.firstnaukri.com/career-guidance/65-logical-reasoning-questions-and-


answers-for-freshers

From Question 9 onwards:

https://www.allindiajobs.in/2015/11/infosys-placement-papers-2016.html
Test 6

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

1. Jake left point A for point B. 2 hours and 15 2. A completes a work in 2 days, B in 4 days, C in 9
minutes later, Paul left A for B and arrived at B at and D in 18 days. They form group of two such
the same time as Jake. Had both of them started that difference is maximum between them to
simultaneously from A and B travelling towards complete the work. What is difference in the
each other, they would have met in 120 minutes. number of days they complete that work?
How much time (hours) did it take for the slower
one to travel from A to B if the ratio of speeds of
the faster to slower is 3:1?

3. . How many 4 digit numbers contain number 2. 4. How many three digit numbers abc are formed
a. 3170 b. 3172 c. 3174 d. 3168 where at least two of the three digits are same.

5. How many kgs of wheat costing Rs.24/- per kg 6. What is the next number of the following
must be mixed with 30 kgs of wheat costing sequence 7, 14, 55, 110, ....?
Rs.18.40/- per kg so that 15% profit can be
obtained by selling the mixture at Rs.23/- per kg

7. How many numbers are divisible by 4 between 1 8. (11111011)2 = ()8


to 100

9. There are 1000 junior and 800 senior students in 10. 161?85?65?89 = 100, then use + or - in place of
a class.And there are 60 sibling pairs where each ? and take + as m,- as n then find value of m-n
pair has 1 junior and 1 senior. One student is
chosen from senior and 1 from junior
randomly.What is the probability that the two
selected students are from a sibling pair?

11. In a cycle race there are 5 persons named as 12. Rahul took a part in cycling game where 1/5
J,K,L,M,N participated for 5 positions so that in ahead of him and 5/6 behind him excluding him.
how many number of ways can M finishes always Then total number of participants are:
before N?

13. If a refrigerator contains 12 cans such that 7 14. There are 16 people, they divide into four
blue cans and 5 red cans. In how many ways can groups, now from those four groups select a team
we remove 8 cans so that atleast 1 blue can and 1 of three members,such that no two members in
red can remains in the refrigerator. the team should belong to same group.

15. How many five digit numbers are there such 16. 7 people have to be selected from 12 men and
that two left most digits are even and remaining 3 women, Such that no two women can come
are odd and digit 4 should not be repeated. together. In how many ways we can select them?

17. Tennis players take part in a tournament. Every 18. Find the unit digit of product of the prime
player plays twice with each of his opponents. number up to 50 .
How many games are to be played?

19. If [x^(1/3)] - [x^(1/9)] = 60 then find the value 20. A family X went for a vacation. Unfortunately it
of x. rained for 13 days when they were there. But
whenever it rained in the mornings, they had clear
afternoons and vice versa. In all they enjoyed 11
mornings and 12 afternoons. How many days did
they stay there totally?

Solution Link : http://www.alpingi.com/wp-content/uploads/2016/04/Infosys-Placement-Paper-1.pdf


Test7

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

1. 125 small but identical cubes are put together to form a large cube. This large cube is now
painted on all six faces.

(i) How many of the smaller cubes have (ii) How many of the smaller cubes have exactly
no face painted at all. three faces painted?
(a) 27
(a) 98
(b) 64
(b) 100
(c) 8
(c) 96
(d) 36
(d) 95

(iii) How many of the smaller cubes have


atleast one side painted?

(a) 4
(b) 8

(c) 9

(d) 27

2. Directions : Study the following information and answer the question given below: In a certain code,
the symbols for 0 (zero) is @ and for 1 is $. There are no other symbols for all other number greater than
one. The numbers greater than 1 are to be written only by using the two symbols given above. The value
of the symbol for 1 doubles itself every time it shifts one place to the left. Study the following examples:
‘0’ is written as @, ‘1’ is written as #, ‘2’ is written as #, @‘3’ is written as # # ‘4’ is written as #@@ and
so on

=> Which of the following represents 14?

(a) #@@@

(b) ###@

(c) ##@@

(d) ##@#

3. 7528 : 5306 :: 4673 : ? 4. x2–y2=16 and xy = 15 so find out x + y ?

a) 2367 a)5

b) 2451 b)3

c) 2531 c)8

d) 2489 d)9
5. Census population of a district in 1981 was 4.54 6. Based on the statement in the question, mark
Lakhs, while in year 2001 it was 7.44 Lakhs. What the most logical pair of statement that follow
was the estimated mid-year population of that "Either he will shout or they will fire".
district in year 2009.
(1) He shouted.

(2) He did not shout.


a)6.8Lacs
(3) They fired
b)9.5 Lacs
(4) They did not fire
c)8.6 Lacs

d)5.9 Lacs
(a) 1,4

(b) 2,3

(c) 4,1

7. Gautham passes through seven lane to reach his school. He finds that YELLOW lane is between his
house and KAMA lane. The third lane from his school is APPLE lane. PEACOCK lane is immediately before
the PARK lane. He passes ASH lane at the end. KAMA lane is between YELLOW lane and PEACOCK lane.
The sixth lane from his house is RAO lane.

I. How many lane are there between KAMA lane II. After passing the park lane how many lane does
and RAO lane ? Gautham cross to reach the school ?

a) one a) 4

b) two b) 3

c) three c) 2

d) four d) 1

III. After passing the YELLOW lane how many lane IV. Which lane is between PARK lane and RAO lane
does Gautham cross to reach the school ? ?

a) YELLOW lane
a) 4 b) KAMA lane

b) 6 c) APPLE lane

c) 2 d) PEACOCK lane

d) 1

V. If the house of Gautham,each lane and his


school are equidistant and he takes 2 min to pass
one lane then how long will he take to reach
school from his house ?

a) 18 min

b) 16 min

c) 14 min

d) 12 min

8. Find the maximum value of n such that 50! is 9. Find the no of ways in which 6 toffees can be
perfectly divisible by 2520^n . distributed over 5 different people namely
A,B,C,D,E.

a) 8
b) 9
c) 4
d) 5

10. A train covered a distance at a uniform speed 11. A girl leaves from her home. She first walks 30
.if the train had been 6 km/hr faster it would have metres in North-west direction and then 30 metres
been 4 hour less than schedule time and if the in South-west direction. Next, she walks 30 metres
train were slower by 6 km/hr it would have been 6 in South-east direction. Finally, she turns towards
hrs more.find the distance. her house. In which direction is she moving?
a) 720 Km Option
b) 830 Km
c) 1000Km
d) 540 Km
A) North-east

B) North-west

C) South-east

D) South-west

E) None of these

12. There are two containers on a table. A and B. 13. Four persons A,B,C,D were there. All were of
A is half full of wine, while B,which is twice A's size, different weights. All Four gave a statement.
is one quarter full of wine. Both containers are Among the four statements only the person who is
filled with water and the contents are poured into lightest in weight of all others gave a true
a third container C. What portion of container C's statement.
mixture is wine?

A Says : B is heavier than D.


a) 33.3% of wine
b) 33.33% of wine B Says : A is heavier than C.
c) 44.5% of wine
d) 55.55% of wine C Says : I am heavier than D.

D Says : C is heavier than B.

Find the lightest and List the persons in ascending


order according to their weights ?

14. There is well of depth 30 m and frog is at 15. Find the next term in the given series 47, 94,
bottom of the well. He jumps 3 m in one day and 71, 142, 119, 238, _ ?
falls back 2 m in the same day. How many days will
it take for the frog to come out of the well? a) 331

a) 26 days b) 360

b) 27 days c)320

c) 28 days d)340

d) 29 days

16. A train leaves Meerut at 5 a.m. and reaches 17. ‘A’ and ‘B’ started a business in partnership
Delhi at 9 a.m. Another train leaves Delhi at 7 a.m. investing Rs 20000/- and Rs 15000/- respectively.
and reaches Meerut at 10.30 a.m. At what time do After six months ‘C’ jointed them with Rs 20000/-.
the two trains travel in order to cross each other ? What will be B’s share in the total profit of Rs
25000/- earned at the end of two years from the
starting of the business?
a) 7.56 am
b) 8.56 am
c) 5.56 am a) 7500
d) 4.56 am b) 5500
c) 4500
d) 6500

18. b,x,e,u,h,_? 19. A Jar contains 18 balls. 3 blue balls are

removed from the jar and not replaced.Now the


probability of getting a blue ball is 1/5 then how
Note that a=1,b=2,c=3…z=26. many blue balls jar contains initially ?

a) p=17 a) 6
b) q=18 b) 4
c) r=18
c) 8
d) s=17 d) 2
Solution Link : http://www.alpingi.com/wp-content/uploads/2016/04/Infosys-Placement-Paper-2.pdf
Test 8

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

1. 4, 6, 10, 14, 22, 26, 34, 38, 46, _ ? 2. y, _?, q, m, i


What is next term in the series. a) w

a) 56 b) u
b) 58
c) 57 c) t
d) 59
d) l

3. What is the next number in the series 4. Data Sufficiency Question: Is w a Whole
3,7,13,19... number?
Statement 1: 3w is an Odd number.
a) 39 Statemet 2: 2w is an Even number
b) 29
c) 49
d) 59
a) Only A statement is enough
b) Only B statement is enough
c) Both A and B are required
d) Neither A or B is sufficient

5. Joe's age, Joe's sister's age and Joe’s 6. The sum of series represented as
fathers age sums up to a century. When
son is as old as his father, Joe's sister will 1/(1×5)+1/(5×9)+1/(9×13)+−−−−+1/(221×225) is: :
be twice as old as now. When Joe is as old
as his father then his father is twice as old
as when his sister was as old as her
father.Age of her father ? a) 28/221

b) 56/221
a) 50
b) 60 c) 56/225
c) 70
d) None of these
d) Data insufficient

7. What are the next three terms in the 8. What is the next number in the series. a, b, d, h,
series 3, 6, 7, 12, 13, 18, 19, 24, _ _ _? _?

a) 26,31,32
a=1,b=2,c=3……z=26.
b)25,30,31

c)27,32,33
a) q
d)24,29,30 b) p
c) r
d) s

9.The number of zeros at the end of the product of 10. A train goes from stations A to B. One day
all prime numbers between 1 and 1111 is? there is a technical problem at the very beginning
of the journey & hence the train travels at 3/5 of
it's original speed and so it arrives 2 hours late.
a)11 Had the problem occurred after 50 miles had been
covered, the train would have arrived 40 min
b)111 earlier(i.e., only 120-40 = 80 min late). What is the
distance between the 2 stations?
c)1

d)111.1
a)150 miles

b)120 miles

c)160 miles

d)100 miles
11. Due to some defect in our elevator, I was 12. In the Garbar Jhala, Ahmadabad a shopkeeper
climbing down the staircase. I’d climbed first raises the price of Jewellery by x% then he
down just 7 steps when I saw a man on the decreases the new price by x%. After one such up
ground floor. Continuing to walk down, I down cycle, the price of a Jewellery decreased by
greeted the man and I was surprised to see Rs. 21025. After a second updown cycle the
that when I was yet to get down 4 steps to jewellery was sold for Rs. 484416. What was the
reach the ground floor, the man had already original price of the jewellery.
finished climbing the staircase. He perhaps
climbed up 2 steps for every 1 of mine. How
many steps did the staircase have? a)100000,841.

b) 525625, 841.
a) 22 steps c) 525625, 100.
b) 11 steps
c) 33 steps d) None
d) 44 steps

13. Three football teams are there. Given 14. A dog takes 4 leaps for every 5 leaps of hare
below is the group table. but 3 leaps of dog is equal to 4 leaps of hare
compare speed?
Fill in the x's
a) 14:15
P - Played
b) 16:17
W – Won
c) 18:19
L - Lost
d) 20:11
D - Draw

F - Goals For

A - Goals Against

PWLDFA

A2 2xx x 1

B2 x x 124

C2 x x x37
15. A bird keeper has got P pigeons, M 16. 3,4,7,10,13,16,19,22, . . . Find 10th term in
mynas and S sparrows. The keeper goes for series.
lunch leaving his assistant to watch the
birds. Suppose p = 10, m = 5, s = 8 when the a) 38
bird keeper comes back, the assistant b)48
informs the x birds have escaped. The bird
keeper exclaims: "Oh no! All my sparrows c)28
are gone." How many birds flew away?
d)8
When the bird keeper comes back, the
assistant told him that x birds have escaped.
The keeper realized that atleast 2 sparrows
have escaped. What is minimum no of birds
that can escape?

a) 10 pigeon, 5 myna and 2 sparrows.


b) 5 pigeon, 10 myna and 2 sparrows.
c) 2 pigeon, 10 myna and 5 sparrows.
d) 4 pigeon, 9 myna and 4 sparrows.

17. a,d,i,p,? what is next term 18. A shop has 4 shelf, 3 wardrobes, 2 chairs and 7
tables for sell. You have to buy ?
a) q

b) r
i. 1 shelf
c) s
ii. 1 wardrobe
d) t
iii. either 1 chair or 1 table

How many selection can be made?

a)108

b)144

c)256
d)72

Solution Link : http://www.alpingi.com/wp-content/uploads/2016/04/Infosys-Placement-Paper-3.pdf


Test9

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

1. X Z Y + X Y Z = Y Z X. Find the three digits 2. In a 5 digit number, 3 pairs of sum is 11


each.last digit is 3 times first one,3rd digit
is 3 less than 2nd, 4th digit is 4 more than
a) X = 4, Y = 9, Z = 5 the second one. Find the number.
b) X = 1, Y = 1, Z =1
c) X = 5, Y = 2, Z =1
d) X = 5, Y = 5, Z = 5 a) 34186
b) 12345
c) 24186
d) None

3. GOOD is coded as 164 then BAD as 21. If 4. Supposing a clock takes 7 seconds to strike
UGLY coded as 260 then JUMP? 7. How long will it take to strike 10?

a)140 a)10 1/2 seconds.

b)240 b)11 1/2 seconds

c)320 c)9 1/2 seconds

d)540 d) 7 1/2 seconds


5. An escalator is descending at constant 6. Albert and Fernandes have two leg swimming
speed. A walks down and takes 50 steps to race. Both start from opposite ends of the pool. On
reach the bottom. B runs down and takes the first leg, the boys pass each other at 18 m from
90 steps in the same time as A takes 10
the deep end of the pool. During the second leg
steps. How many steps are visible when
the escalator is not operating? they pass at 10 m from the shallow end of the
pool. Both go at constant speed but one of them is
faster. Each boy rests for 4 seconds at the end of
a)200 the first leg. What is the length of the pool?

b)100

c)300 a) 55 m
b) 44 m
d)500 c) 33 m
d) 66m

7. 16, 36, 100, 324, _ ? Find the next 8. How many ways can one arrange the
term. word EDUCATION such that relative
a) 1156 positions of vowels and consonants
b) 1120 remains same?
c) 2000 a)2880
d) 5000
b)3220

c)1000

d)8820

9. There are 8 digits and 5 alphabets.In 10. What is the next number of the following
how many ways can you form an sequence 7, 14, 55, 110, _ ?
alphanumeric word using 3 digits and
2 alphabets? a)121
a)2621
b)1221
b)4200
c)1331
c) 43200
d)111
d)none

11. In an Octagon the number of possible 12. How many numbers are divisible by 4 between
diagonals are? 1 to 100
8
a) C2 – 8 a) 34
8
b) C4 – 8 b) 14
8 1
c) C –8 c) 24
8
d) C2 –2 d) 44

13. 5 cars are to be parked in 5 parking 14. 12 persons can complete the work in 18 days.
slots. there are 3 red cars, 1 blue car and 1 after working for 6 days, 4 more persons added to
green car. How many ways the car can be complete the work fast. in how many more days
parked? they will complete the work?

a)20 ways a) 10 days


b) 30 days
b)50 ways c) 9 days
d) 20 days
c) 10 ways

d) 120 ways

15. A set of football matches is to be 16. Next term in series 3, 32, 405, _
organized in a "round-robin" fashion, i.e.,
every participating team plays a match
against every other team once and only a)5155
once. If 21 matches are totally played, how
many teams participated? b)6144

c)2222

a)9 d)4416

b)5

c)9

d)11

17. A cube is divided into 729 identical 18. Find the radius of the circle inscribed in a
cubelets. Each cut is made parallel to some triangle ABC. Triangle ABC is a right-angled
surface of the cube . But before doing that isosceles triangle with the hypotenuse as 62√
the cube is colored with green color on
one set of adjacent faces ,red on the other
set of adjacent faces, blue on the third set. a) Radius is 2 cm
So, how many cubelets are there which b) Radius is 4 cm
are painted with exactly one color? c) Radius is 6 cm
d) Radius is 8 cm

a)306

b)294

c)100

d)729

19. How many boys are there in the class if 20. If dolly works hard then she can get A grade
the number of boys in the class is 8 more
than the number of girls in the class, which 1. If dolly does not work hard then she can get A
is five times the difference between the grade
number of girls and boys in the class. 2. If dolly gets an A grade then she must have
worked hard
a)80
3. If dolly does not gets an A grade then she must
b)40
not have worked hard
c)60
4. Dolly wishes to get A grad.
d)10

a)Option 2 is correct as it is contranegative of


given statement.

b) Option 3 is correct as it is contrapositive of the


given statement.

c) Option 1 is correct as it is contrapositive of the


given statement.

d) Option 2 is correct as it is contranegative of


given statement.
Solution Link : http://www.alpingi.com/wp-content/uploads/2016/04/Infosys-Placement-Paper-4.pdf
Test 10

Level of Exam: Moderate difficulty

Total Questions: 20 questions from Quantitative Aptitude, Logical Reasoning and


Verbal Ability sections

Negative Marking – No, There is no negative marking in the paper.

1. The hour hand lies between 3 and 4. Tthe 2. Jack and Jill went up and down a hill. They
difference between hour and minute hand started from the bottom and Jack met Jill
is 50 degree.What are the two possible again 20 miles from the top while
timings? returning. Jack completed the race 1 min a
a) Substitute the θ = 8011, 28011 head of Jill. If the hill is 440 miles high and
b) Substitute the θ =7011, 18011 their speed while down journey is 1.5
c) Substitute the θ = 6011, 38011 times the up journey. How long it took for
d) Substitute the θ =58011, 48011 the Jack to complete the race ?

a)12.6 min

b)11.6 min

c)13.6 min

d)None

3. Data Sufficiency question: A, B, C, D have 4. One of the longest sides of the triangle is
to stand in a queue in descending order of 20 m. The other side is 10 m. Area of the
their heights. Who stands first? I. D was triangle is 80 m2. What is the another side
not the last, A was not the first. II. The first of the triangle?
is not C and B was not the tallest.

a)Assume a=20,b=10
a) Person A
b) Person B b)Assume a=30,b=20
c) Person C
d) Person D c) Assume a=40, b=20

d)Assume a=60,b=10

5. Data Sufficiency Question: 6. Mr. T has a wrong weighing pan. One arm
is lengthier than other. 1 kilogram on left
balances 8 melons on right, 1 kilogram on
a and b are two positive numbers. How right balances 2 melons on left. If all
many of them are odd? melons are equal in weight, what is the
weight of a single melon.
I. Multiplication of b with an odd
number gives an even number.
II. a2 – b is even. a)300gm

b)400gm
a. None of a and b are odd
b. None of a and b are even c)200gm
c. Either a or b odd
d. None of the above statement is true d)600gm

7. If ABC =C3 and CAB = D3, Then find D3÷B3 8. There are three trucks A, B, C. A loads 10
kg/min. B loads 13 1/3 kg/min. C unloads 5
kg/min. If three simultaneously works then
a)74 what is the time taken to load 2.4 tones?
a) 2 hrs 10 mins
b)64
b) 2 hrs 30 mins
c)84
c) 4 hrs 10 mins
d)54
d) 4 hrs 30 mins

9. HERE = COMES – SHE, (Assume S = 8) Find 10. A person is 80 years old in 490 and only 70
value of R + H + O years old in 500 in which year is he born?
a) 24 a) 400 BC
b) 14 b) 550 BC
c) 34
d) 44 c) 570 BC

d) 440 BC

11. Lucia is a wonderful grandmother and her 12. A family X went for a vacation.
age is between 50 and 70. Each of her sons Unfortunately it rained for 13 days when
have as many sons as they have brothers. they were there. But whenever it rained in
Their combined ages give Lucia's present the mornings, they had clear afternoons
age.what is the age? and vice versa. In all they enjoyed 11
a) Approx 64. mornings and 12 afternoons. How many
b) Approx 84 days did they stay there totally?
c) Approx 54
d) Approx 94

a)9 days

b) 21 days

c)18 days

d)27 days

13. Find the unit digit of product of the prime 14. Complete the series.. 2 2 12 12 30 30 ?
number up to 50 . a)1*2=2
a) 1
b) 2 b)6*5=30
c) 5
d) 0 c)7*8=56

d)8*9=72

Solution Link : http://www.alpingi.com/wp-content/uploads/2016/04/Infosys-Placement-Paper-5.pdf


Test 11

1. Which of the following creates a virtual relation for storing the query ?

A. Function

B. View

C. Procedure

D. None of the mentioned

Answer: Option B
Explanation:
View
Any such relation that is not part of the logical model, but is made visible to a user as a
virtual relation, is called a view.

2. Which of the following is the syntax for views where v is view name ?
A. Create view v as “query name”;

B. Create “query expression” as view;

C. Create view v as “query expression”;

D. Create view “query expression”;

Answer: Option C
Explanation:
Create view v as “query expression”;
is any legal query expression. The view name is represented by v

.3 Materialised views make sure that

A. View definition is kept stable

B. View definition is kept up-to-date

C. View definition is verified for error


D. View is deleted after specified time
Answer & Explanation

Answer: Option B
Explanation:
View definition is kept up-to-date

4. Updating the value of the view

A. Will affect the relation from which it is defined

B. Will not change the view definition

C. Will not affect the relation from which it is defined

D. Cannot determine

Answer: Option A
Explanation:
Will affect the relation from which it is defined

5. SQL view is said to be updatable (that is, inserts, updates or deletes can be applied on
the view) if which of the following conditions are satisfied by the query defining the view?

A. The from clause has only one database relation.

B. The query does not have a group by or having clause.

C. The select clause contains only attribute names of the relation, and does not have any
expressions, aggregates, or distinct specification.

Answer: Option D
Explanation:
All of the mentioned
All of the conditions must be satisfied to update the view in sql.

6. Which of the following is used at the end of the view to reject the tuples which do not
satisfy the condition in where clause ?

A. With

B. Check

C. With check
D. All of the mentioned

Answer: Option C
Explanation:
With check
Views can be defined with a with check option clause at the end of the view definition;
then, if a tuple inserted into the view does not satisfy the view’s where clause condition,
the insertion is rejected by the database system.

1. Which one of the following is a set of one or more attributes taken collectively to uniquely
identify a record?

A. Candidate key

B. Sub key

C. Super key

D. Foreign key

Answer: Option C
Explanation:
Super key
Super key is the superset of all the keys in a relation.

2. Consider attributes ID , CITY and NAME . Which one of this can be considered as a
super key ?

A. NAME

B. ID

C. CITY

D. CITY , ID

Answer: Option B
Explanation:
ID
Here the id is the only attribute which can be taken as a key. Other attributes are not
uniquely identified .

3. The subset of super key is a candidate key under what condition ?

A. No proper subset is a super key


B. All subsets are super keys

C. Subset is a super key

D. Each subset is a super key

Answer: Option A
Explanation:
No proper subset is a super key
The subset of a set cannot be the same set.Candidate key is a set from a super key which
cannot be the whole of the super set

4. A _____ is a property of the entire relation, rather than of the individual tuples in which
each tuple is unique.

A. Rows

B. Key

C. Attribute

D. Fields

Answer: Option B
Explanation:
Key
Key is the constraint which specifies uniqueness.

5. Which one of the following attribute can be taken as a primary key ?

A. Name

B. Street

C. Id

D. Department

Answer: Option C
Explanation:
Id
The attributes name , street and department can repeat for some tuples.But the id
attribute has to be unique .So it forms a primary key.
6. Which one of the following cannot be taken as a primary key ?

A. Id

B. Register number

C. Dept_id

D. Street

Answer: Option D
Explanation:
Street
Street is the only attribute which can occur more than once.

7. A attribute in a relation is a foreign key if the _______ key from one relation is used as an
attribute in that relation .

A. Candidate

B. Primary

C. Super

D. Sub

Answer: Option B
Explanation:
Primary
The primary key has to be referred in the other relation to form a foreign key in that relation .

8. The relation with the attribute which is the primary key is referenced in another relation.
The relation which has the attribute as primary key is called

A. Referential relation

B. Referencing relation

C. Referenced relation

D. Referred relation

Answer: Option B
Explanation:
Referencing relation
9. The ______ is the one in which the primary key of one relation is used as a normal
attribute in another relation .

A. Referential relation

B. Referencing relation

C. Referenced relation

D. Referred relation

Answer: Option C
Explanation:
Referenced relation

10. A _________ integrity constraint requires that the values appearing in specified
attributes of any tuple in the referencing relation also appear in specified attributes of at
least one tuple in the referenced relation.

A. Referential

B. Referencing

C. Specific

D. Primary

Answer: Option A
Explanation:
Referential
A relation, say r1, may include among its attributes the primary key of another relation, say
r2. This attribute is called a foreign key from r1, referencing r2. The relation r1 is also called
the referencing relation of the foreign key dependency, and r2 is called the referenced
relation of the foreign key.

1. The____condition allows a general predicate over the relations being joined.

A. On

B. Using

C. Set

D. Where
Answer: Option A
Explanation:
On
On gives the condition for the join expression.

2. Which of the join operations do not preserve non matched tuples.

A. Left outer join

B. Right outer join

C. Inner join

Answer: Option C
Explanation:
Inner join
INNER JOIN: Returns all rows when there is at least one match in BOTH tables

3. What type of join is needed when you wish to include rows that do not have matching
values?

A. Equi-join

B. Natural join

C. Outer join

D. All of the mentioned

Answer: Option C
Explanation:
Outer join
An outer join does not require each record in the two joined tables to have a matching
record.

4. How many tables may be included with a join?

A. One

B. Two

C. Three
D. All of the mentioned

Answer: Option D
Explanation:
All of the mentioned
Join can combine multiple tables.

5. Which are the join types in join condition:

A. Cross join

B. Natural join

C. Join with USING clause

D. All of the mentioned

Answer: Option D
Explanation:
All of the mentioned
There are totally four join types in SQL.

6. How many join types in join condition:

A. 2

B. 3

C. 4

D. 5

Answer: Option D
Explanation:
5
Types are inner join,left outer join,right outer join,full join,cross join.

7. Which join refers to join records from the right table that have no matching key in the left
table are include in the result set:

A. Left outer join

B. Right outer join


C. Full outer join

D. Half outer join

Answer: Option B
Explanation:
Right outer join
RIGHT OUTER JOIN: Return all rows from the right table, and the matched rows from the
left table.

8. The operation which is not considered a basic operation of relational algebra is

A. Join

B. Selection

C. Union

D. Cross product

Answer: Option A
Explanation:
Join

9. In SQL the statement select * from R, S is equivalent to

A. Select * from R natural join S

B. Select * from R cross join S

C. Select * from R union join S

D. Select * from R inner join S

Answer: Option B
Explanation:
Select * from R cross join S
1. A _________ consists of a sequence of query and/or update statements.

A. Transaction

B. Commit

C. Rollback

D. Flashback

Answer: Option A
Explanation:
Transaction
Transaction is a set of operation until commit.

2. Which of the following makes the transaction permanent in the database ?

A. View

B. Commit

C. Rollback

D. Flashback

Answer: Option B
Explanation:
Commit
Commit work commits the current transaction.

3. In order to undo the work of transaction after last commit which one should be used ?

A. View

B. Commit

C. Rollback

D. Flashback

Answer: Option C
Explanation:
Rollback
Rollback work causes the current transaction to be rolled back; that is, it undoes all the
updates performed by the SQL statements in the transaction.
4. Consider the following action:
Transaction…..
Commit;
Rollback;
What does Rollback do?

A. Undoes the transactions before commit

B. Clears all transactions

C. Redoes the transactions before commit

D. No action

Answer: Option D
Explanation:
No action
Once a transaction has executed commit work, its effects can no longer be undone by
rollback work.

5. In case of any shut down during transaction before commit which of the following
statement is done automatically ?

A. View

B. Commit

C. Rollback

D. Flashback

Answer: Option C
Explanation:
Rollback
Once a transaction has executed commit work, its effects can no longer be undone by
rollback work.

6. In order to maintain the consistency during transactions database provides

A. Commit

B. Atomic
C. Flashback

D. Retain

Answer: Option B
Explanation:
Atomic
By atomic , either all the effects of the transaction are reflected in the database, or none are
(after rollback).

7. Transaction processing is associated with everything below except

A. Conforming a action or triggering a response

B. Producing detail summary or exception report

C. Recording a business activity

D. Maintaining a data

Answer: Option A
Explanation:
Conforming a action or triggering a response

8. A transaction completes its execution is said to be

A. Committed

B. Aborted

C. Rolled back

D. Failed

Answer: Option A
Explanation:
Committed
A complete transaction always commits.

9. Which of the following is used to get back all the transactions back after rollback ?

A. Commit
B. Rollback

C. Flashback

D. Redo

Answer: Option C
Explanation:
Flashback

10. ______ will undo all statements up to commit?

A. Transaction

B. Flashback

C. Rollback

D. Abort

Answer: Option C
Explanation:
Rollback
Flashback will undo all the statements and Abort will terminate the operation.

1. What is the purpose of index in sql server

A. To enhance the query performance

B. To provide an index to a record

C. To perform fast searches

D. All of the mentioned

Answer: Option D
Explanation:
All of the mentioned
A database index is a data structure that improves the speed of data retrieval operations on
a database table at the cost of additional writes.

2. How many types of indexes are there in sql server?


A. 1

B. 2

C. 3

D. 4

Answer: Option B
Explanation:
2
They are clustered index and non clustered index.

3. How non clustered index point to the data?

A. It never points to anything

B. It points to a data row

C. It is used for pointing data rows containing key values

Answer: Option C
Explanation:
It is used for pointing data rows containing key values
Nonclustered indexes have a structure separate from the data rows. A nonclustered index
contains the nonclustered index key values and each key value entry has a pointer to the
data row that contains the key value.

4. Which one is true about clustered index?

A. Clustered index is not associated with table

B. Clustered index is built by default on unique key columns

C. Clustered index is not built on unique key columns

D. None of the men

Answer: Option B
Explanation:
Clustered index is built by default on unique key columns
Nonclustered indexes have a structure separate from the data rows. A nonclustered index
contains the nonclustered index key values and each key value entry has a pointer to the
data row that contains the key value.

5. What is true about indexes?

A. Indexes enhance the performance even if the table is updated frequently

B. It makes harder for sql server engines to work to work on index which have large keys

C. It doesn’t make harder for sql server engines to work to work on index which have large
keys

Answer: Option B
Explanation:
It makes harder for sql server engines to work to work on index which have large keys
Indexes tend to improve the performance.

6. Does index take space in the disk ?

A. It stores memory as and when required

B. Yes, Indexes are stored on disk

C. Indexes are never stored on disk

D. Indexes take no space

Answer: Option B
Explanation:
Yes, Indexes are stored on disk
Indexes take memory slots which are located on the disk.

7. What are composite indexes ?

A. Are those which are composed by database for its internal use

B. A composite index is a combination of index on 2 or more columns

C. Composite index can never be created

D. None of the mentioned

Answer: Option B
Explanation:
A composite index is a combination of index on 2 or more columns
A composite index is an index on two or more columns of a table.

8. If an index is _________________ the metadata and statistics continue to exists

A. Disabling

B. Dropping

C. Altering

D. Both a and b

Answer: Option A
Explanation:
Disabling
A database index is a data structure that improves the speed of data retrieval operations on
a database table at the cost of additional writes.

9. In _______________ index instead of storing all the columns for a record together, each
column is stored separately with all other rows in an index.

A. Clustered

B. Column store

C. Non clustered

D. Row store

Answer: Option B
Explanation:
Column store
A database index is a data structure that improves the speed of data retrieval operations on
a database table at the cost of additional writes.

10. A _________________ index is the one which satisfies all the columns requested in the
query without performing further lookup into the clustered index.

A. Clustered

B. Non Clustered

C. Covering
D. B-Tree

Answer: Option C
Explanation:
Covering
A covered query is a query where all the columns in the query’s result set are pulled from
non-clustered indexes.

1. This set of Database Questions & Answers focuses on “SQL Data Types and Schemas”
Dates must be specified in the format

A. mm/dd/yy

B. yyyy/mm/dd

C. dd/mm/yy

D. yy/dd/mm

Answer: Option B
Explanation:
yyyy/mm/dd
yyyy/mm/dd is the default format in sql

2. An ________ on an attribute of a relation is a data structure that allows the database


system to find those tuples in the relation that have a specified value for that attribute
efficiently, without scanning through all the tuples of the relation.

A. Index

B. Reference

C. Assertion

D. Timestamp

Answer: Option A
Explanation:
Index
Index is the reference to the tuples in a relation.

3. Which of the following is used to store movie and image files ?


A. Clob

B. Blob

Answer: Option B
Explanation:
Blob
SQL therefore provides large-object data types for character data (clob) and binary data
(blob). The letters “lob” in these data types stand for “Large OBject.”

4. The user defined data type can be created using

A. Create datatype

B. Create data

C. Create definetype

D. Create type

Answer: Option D
Explanation:
Create type
The create type clause can be used to define new types.Syntax : create type Dollars as
numeric(12,2) final; .

5. Values of one type can be converted to another domain using which of the following ?

A. Cast

B. Drop type

C. Alter type

D. Convert

Answer: Option A
Explanation:
Cast
Example of cast :cast (department.budget to numeric(12,2)). SQL provides drop type and
alter type clauses to drop or modify types that have been created earlier.
6. Which of the following closely resembles Create view ?

A. Create table . . .like

B. Create table . . . as

C. With data

D. Create view as

Answer: Option B
Explanation:
Create table . . . as
The ‘create table . . . as’ statement closely resembles the create view statement and both
are defined by using queries.The main difference is that the contents of the table are set
when the table is created, whereas the contents of a view always reflect the current query
result.

7. In contemporary databases the top level of the hierarchy consists of ______, each of
which can contain _____.

A. Catalogs, schemas

B. Schemas, catalogs

C. Environment, schemas

D. Schemas, Environment

Answer: Option A
Explanation:
Catalogs, schemas

8. Which of the following statements creates a new table temp instructor that has the same
schema as instructor.

A. create table temp_instructor;

B. Create table temp_instructor like instructor;

C. Create Table as temp_instructor;

D. Create table like temp_instructor;

Answer: Option B
Explanation:
Create table temp_instructor like instructor;

1. In the __________ normal form, a composite attribute is converted to individual


attributes.

A. First

B. Second

C. Third

D. Fourth

Answer: Option A
Explanation:
First
The first normal form is used to eliminate the duplicate information.

2. A table on the many side of a one to many or many to many relationship must:

A. Be in Second Normal Form (2NF)

B. Be in Third Normal Form (3NF)

C. Have a single attribute key

D. Have a composite key

Answer: Option D
Explanation:
Have a composite key
The relation in second normal form is also in first normal form and no partial dependencies
on any column in primary key.

3. Tables in second normal form (2NF):

A. Eliminate all hidden dependencies

B. Eliminate the possibility of a insertion anomalies

C. Have a composite key

D. Have all non key fields depend on the whole primary key

Answer: Option A
Explanation:
Eliminate all hidden dependencies
The relation in second normal form is also in first normal form and no partial dependencies
on any column in primary key.

4. Which-one ofthe following statements about normal forms is FALSE?

A. BCNF is stricter than 3 NF

B. Lossless, dependency -preserving decomposition into 3 NF is always possible

C. Loss less, dependency – preserving decomposition into BCNF is always possible

D. Any relation with two attributes is BCNF View Answer

Answer: Option C
Explanation:
Loss less, dependency – preserving decomposition into BCNF is always possible
We say that the decomposition is a lossless decomposition if there is no loss of information
by replacing r (R) with two relation schemas r1(R1) andr2(R2).

5. Functional Dependencies are the types of constraints that are based on______

A. Key

B. Key revisited

C. Superset key

D. None of these

Answer: Option A
Explanation:
Key
Key is the basic element needed for the constraints.

6. Which is a bottom-up approach to database design that design by examining the


relationship between attributes:

A. Functional dependency

B. Database modeling

C. Normalization
D. Decomposition

Answer: Option C
Explanation:
Normalization
Normalisation is the process of removing redundancy and unwanted data.

7. Which forms simplifies and ensures that there is minimal data aggregates and repetitive
groups:

A. 1NF

B. 2NF

C. 3NF

D. All of the mentioned

Answer: Option C
Explanation:
3NF
The first normal form is used to eliminate the duplicate information.

8. Which forms has a relation that possesses data about an individual entity:

A. 2NF

B. 3NF

C. 4NF

D. 5NF

Answer: Option C
Explanation:
4NF
A Table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X
\twoheadrightarrow Y, X is a superkey—that is, X is either a candidate key or a superset
thereof.

9. Which forms are based on the concept of functional dependency:

A. 1NF
B. 2NF

C. 3NF

D. 4NF

Answer: Option C
Explanation:
3NF
The table is in 3NF if every non-prime attribute of R is non-transitively dependent (i.e.
directly dependent) on every superkey of R.

10. Empdt1(empcode, name, street, city, state,pincode). For any pincode, there is only one
city and state. Also, for given street, city and state, there is just one pincode. In
normalization terms, empdt1 is a relation in

A. 1 NF only

B. 2 NF and hence also in 1 NF

C. 3NF and hence also in 2NF and 1NF

D. BCNF and hence also in 3NF, 2NF and 1NF View Answer

Answer: Option B
Explanation:
2 NF and hence also in 1 NF
The relation in second normal form is also in first normal form and no partial dependencies
on any column in primary key.

1. To include integrity constraint in a existing relation use :

A. Create table

B. Modify table

C. Alter table

Answer: Option C
Explanation:
Alter table
SYNTAX – alter table table-name add constraint , where constraint can be any constraint on
the relation.

2. Which of the following is not a integrity constraint ?

A. Not null

B. Positive

C. Unique

D. Check ‘predicate’

Answer: Option B
Explanation:
Positive
Positive is a value and not a constraint.

3. Foreign key is the one in which the ________ of one relation is referenced in another
relation.

A. Foreign key

B. Primary key

C. References

D. Check constraint

Answer: Option B
Explanation:
Primary key
The foreign-key declaration specifies that for each course tuple, the department name
specified in the tuple must exist in the department relation.

4. Domain constraints, functional dependency and referential integrity are special forms of
_________.

A. Foreign key

B. Primary key

C. Assertion

D. Referential constraint
Answer: Option C
Explanation:
Assertion
An assertion is a predicate expressing a condition we wish the database to always satisfy.

5. Which of the following is the right syntax for assertion?

A. Create assertion 'assertion-name' check 'predicate';

B. Create assertion check 'predicate' 'assertion-name';

C. Create assertions 'predicates';

D. All of the mentioned

Answer: Option A
Explanation:
Create assertion 'assertion-name' check 'predicate';

6. Data integrity constraints are used to:

A. Control who is allowed access to the data

B. Ensure that duplicate records are not entered into the table

C. Improve the quality of data entered for a specific property (i.e., table column)

D. Prevent users from changing the values stored in the table

Answer: Option C
Explanation:
Improve the quality of data entered for a specific property (i.e., table column)

7. Which of the following can be addressed by enforcing a referential integrity constraint?

A. All phone numbers must include the area code

B. Certain fields are required (such as the email address, or phone number) before the
record is accepted

C. Information on the customer must be known before anything can be sold to that custome

D. When entering an order quantity, the user must input a number and not some text (i.e.,
12 rather than ‘a dozen’)
Answer: Option C
Explanation:
Information on the customer must be known before anything can be sold to that custome
The information can be referred and obtained .

8. _____________, express the number of entities to which another entity can be


associated via a relationship set.

A. Mapping Cardinality

Answer: Option A
Explanation:
Mapping Cardinality
Mapping cardinality is also called as cardinality ratio.

9. An entity in A is associated with at most one entity in B, and an entity in B is associated


with at most one entity in A.This is called as

A. One-to-many

B. One-to-one

C. Many-to-many

D. Many-to-one

Answer: Option B
Explanation:
One-to-one
Here one entity in one set is related to one one entity in other set.

10. An entity in A is associated with at most one entity in B. An entity in B, however, can be
associated with any number (zero or more) of entities in A.

A. One-to-many

B. One-to-one

C. Many-to-many

D. Many-to-one
Answer: Option D
Explanation:
Many-to-one
Here more than one entity in one set is related to one one entity in other set.

11. Data integrity constraints are used to

A. Control who is allowed access to the data

B. Ensure that duplicate records are not entered into the table

C. Improve the quality of data entered for a specific property

D. Prevent users from changing the values stored in the table

Answer: Option C
Explanation:
Improve the quality of data entered for a specific property
The data entered will be in a particular cell (i.e., table column) .

12. Establishing limits on allowable property values, and specifying a set of acceptable,
predefined options that can be assigned to a property are examples of:

A. Attributes

B. Data integrity constraints

C. Method constraints

D. Referential integrity constraints

Answer: Option B
Explanation:
Data integrity constraints
Only particular value satsfying the constraints are entered in column .

13. Which of the following can be addressed by enforcing a referential integrity constraint?

A. All phone numbers must include the area code

B. Certain fields are required (such as the email address, or phone number) before the
record is accepted
C. Information on the customer must be known before anything can be sold to that customer

D. Then entering an order quantity, the user must input a number and not some text (i.e., 12
rather than ‘a dozen’)

Answer: Option C
Explanation:
Information on the customer must be known before anything can be sold to that customer

14. ______ is a special type of integrity constraint that relates two relations & maintains
consistency across the relations.

A. Entity Integrity Constraints

B. Referential Integrity Constraints

C. Domain Integrity Constraints

D. Domain Constraints

Answer: Option B
Explanation:
Referential Integrity Constraints

15. Which one of the following uniquely identifies the elements in the relation?

A. Secondary Key

B. Primary key

C. Foreign key

D. Composite key

Answer: Option B
Explanation:
Primary key
Primary key checks for not null and uniqueness constraint

16. Drop Table cannot be used to drop a table referenced by a _________ constraint.

A. Local Key
B. Primary Key

C. Composite Key

D. Foreign Key

Answer: Option D
Explanation:
Foreign Key
Foreign key is used when primary key of one relation is used in another relation .

17. ____________ is preferred method for enforcing data integrity

A. Constraints

B. Stored Procedure

C. Triggers

D. Cursors

Answer: Option A
Explanation:
Constraints
Constraints are specified to restrict entries in the relation.

1. Which one of the following is a set of one or more attributes taken collectively to uniquely
identify a record?

A. Candidate key

B. Sub key

C. Super key

D. Foreign key

Answer: Option C
Explanation:
Super key
Super key is the superset of all the keys in a relation.
2. Consider attributes ID , CITY and NAME . Which one of this can be considered as a
super key ?

A. NAME

B. ID

C. CITY

D. CITY , ID

Answer: Option B
Explanation:
ID
Here the id is the only attribute which can be taken as a key. Other attributes are not
uniquely identified .

3. The subset of super key is a candidate key under what condition ?

A. No proper subset is a super key

B. All subsets are super keys

C. Subset is a super key

D. Each subset is a super key

Answer: Option A
Explanation:
No proper subset is a super key
The subset of a set cannot be the same set.Candidate key is a set from a super key which
cannot be the whole of the super set

4. A _____ is a property of the entire relation, rather than of the individual tuples in which
each tuple is unique.

A. Rows

B. Key

C. Attribute

D. Fields
Answer: Option B
Explanation:
Key
Key is the constraint which specifies uniqueness.

5. Which one of the following attribute can be taken as a primary key ?

A. Name

B. Street

C. Id

D. Department

Answer: Option C
Explanation:
Id
The attributes name , street and department can repeat for some tuples.But the id attribute
has to be unique .So it forms a primary key.

6. Which one of the following cannot be taken as a primary key ?

A. Id

B. Register number

C. Dept_id

D. Street

Answer: Option D
Explanation:
Street
Street is the only attribute which can occur more than once.

7. A attribute in a relation is a foreign key if the _______ key from one relation is used as an
attribute in that relation .

A. Candidate

B. Primary
C. Super

D. Sub

Answer: Option B
Explanation:
Primary
The primary key has to be referred in the other relation to form a foreign key in that relation .

8. The relation with the attribute which is the primary key is referenced in another relation.
The relation which has the attribute as primary key is called

A. Referential relation

B. Referencing relation

C. Referenced relation

D. Referred relation

Answer: Option B
Explanation:
Referencing relation

9. The ______ is the one in which the primary key of one relation is used as a normal
attribute in another relation .

A. Referential relation

B. Referencing relation

C. Referenced relation

D. Referred relation

Answer: Option C
Explanation:
Referenced relation

10. A _________ integrity constraint requires that the values appearing in specified
attributes of any tuple in the referencing relation also appear in specified attributes of at
least one tuple in the referenced relation.
A. Referential

B. Referencing

C. Specific

D. Primary

Answer: Option A
Explanation:
Referential
A relation, say r1, may include among its attributes the primary key of another relation, say
r2. This attribute is called a foreign key from r1, referencing r2. The relation r1 is also called
the referencing relation of the foreign key dependency, and r2 is called the referenced
relation of the foreign key.

The situation where the lock waits only for a specified amount of time for another lock to be
released is

A. Lock timeout

B. Wait-wound

C. Timeout

D. Wait

Answer: Option A
Explanation:
Lock timeout
The timeout scheme is particularly easy to implement, and works well if transactions are
short and if longwaits are likely to be due to deadlocks.

1. A relational database consists of a collection of

A. Tables

B. Fields

C. Records

D. Keys

Answer: Option A
Explanation:
Fields are the column of the relation or tables.Records are each row in relation.Keys are the
constraints in a relation .

2. A ________ in a table represents a relationship among a set of values.

A. Column

B. Key

C. Row

D. Entry

Answer: Option C
Explanation:
Column has only one set of values.Keys are constraints and row is one whole set of attributes.Entry
is just a piece of data.

3. The term _______ is used to refer to a row.

A. Attribute

B. Tuple

C. Field

D. Instance

Answer: Option B
Explanation:
Tuple
Tuple is one entry of the relation with several attributes which are fields.

4. The term attribute refers to a ___________ of a table.

A. Record

B. Column

C. Tuple

D. Key
Answer: Option B
Explanation:
Attribute is a specific domain in the relation which has entries of all tuples.

5. For each attribute of a relation, there is a set of permitted values, called the ________ of
that attribute.

A. Domain

B. Relation

C. Set

D. Schema

Answer: Option A
Explanation:
The values of the attribute should be present in the domain.Domain is a set of values permitted .

6. Database __________ , which is the logical design of the database, and the database
_______,which is a snapshot of the data in the database at a given instant in time.

A. Instance, Schema

B. Relation, Schema

C. Relation, Domain

D. Schema, Instance

Answer: Option D
Explanation:
Schema, Instance
Instance is a instance of time and schema is a representation.

7. A domain is atomic if elements of the domain are considered to be ____________ units.

A. Different

B. Indivisbile

C. Constant
D. Divisible

Answer: Option B
Explanation:
Indivisbile

8. The tuples of the relations can be of ________ order.

A. Any

B. Same

C. Sorted

D. Constant

Answer: Option A
Explanation:
Any
The values only count .The order of the tuples does not matter.

9. Using which language can a user request information from a database ?

A. Query

B. Relational

C. Structural

D. Compiler

Answer: Option A
Explanation:
Query
Query language is a method through which the database entries can be accessed.

10. Student(ID, name, dept name, tot_cred) In this query which attribute form the primary
key?

A. Name

B. Dept
C. Tot_cred

D. ID

Answer: Option D
Explanation:
ID The attributes name ,dept and tot_cred can have same values unlike ID .

11. Which one of the following is a procedural language ?

A. Domain relational calculus

B. Tuple relational calculus

C. Relational algebra

D. Query language

Answer: Option C
Explanation:
Relational algebra
Domain and Tuple relational calculus are non-procedural language.Query language is a
method through which the database entries can be accessed.

12. The_____ operation allows the combining of two relations by merging pairs of tuples,
one from each relation, into a single tuple.

A. Select

B. Join

C. Union

D. Intersection

Answer: Option B
Explanation:
Join
Join finds the common tuple in the relations and combines it.

13. The result which operation contains all pairs of tuples from the two relations, regardless
of whether their attribute values match.
A. Join

B. Cartesian product

C. Intersection

D. Set difference

Answer: Option B
Explanation:
Cartesian product
Cartesian product is the multiplication of all the values in the attributes.

14. The _______operation performs a set union of two “similarly structured” tables

A. Union

B. Join

C. Product

D. Intersect

Answer: Option A
Explanation:
Union
Union just combines all the values of relations of same attributes.

15. The most commonly used operation in relational algebra for projecting a set of tuple
from a relation is

A. Join

B. Projection

C. Select

D. Union

Answer: Option C
Explanation:
Select
Select is used to view the tuples of the relation with or without some constraints.
16. The _______ operator takes the results of two queries and returns only rows that
appear in both result sets.

A. Union

B. Intersect

C. Difference

D. Projection

Answer: Option B
Explanation:
Intersect
The union operator gives the result which is the union of two queries and difference is the
one where query which is not a part of second query .

17. A ________ is a pictorial depiction of the schema of a database that shows the relations
in the database, their attributes, and primary keys and foreign keys.

A. Schema diagram

B. Relational algebra

C. Database diagram

D. Schema flow

Answer: Option A
Explanation:
Schema diagram

18. The _________ provides a set of operations that take one or more relations as input
and return a relation as an output

A. Schematic representation

B. Relational algebra

C. Scheme diagram

D. Relation flow

Answer: Option B
Explanation:
Relational algebra
Test 12

1. DBMS is a collection of ………….. that enables user to create and maintain a database.
A) Keys
B) Translators
C) Program
D) Language Activity

2. In a relational schema, each tuple is divided into fields called


A) Relations
B) Domains
C) Queries
D) All of the above

3. In an ER model, ……………. is described in the database by storing its data.


A) Entity
B) Attribute
C) Relationship
D) Notation

4. DFD stands for


A) Data Flow Document
B) Data File Diagram
C) Data Flow Diagram
D) Non of the above

5. A top-to-bottom relationship among the items in a database is established by a


A) Hierarchical schema
B) Network schema
C) Relational Schema
D) All of the above
6. ……………… table store information about database or about the system.
A) SQL
B) Nested
C) System
D) None of these

7. …………..defines the structure of a relation which consists of a fixed set of attribute-domain


pairs.
A) Instance
B) Schema
C) Program
D) Super Key

8. ……………… clause is an additional filter that is applied to the result.


A) Select
B) Group-by
C) Having
D) Order by

9. A logical schema
A) is the entire database
B) is a standard way of organizing information into accessible parts.
C) Describes how data is actually stored on disk.
D) All of the above

10. ………………… is a full form of SQL.


A) Standard query language
B) Sequential query language
C) Structured query language
D) Server side query language

11) A relational database developer refers to a record as


A. a criteria
B. a relation
C. a tuple
D. an attribute
12) ………. keyword is used to find the number of values in a column.
A. TOTAL
B. COUNT
C. ADD
D. SUM

13) An advantage of the database management approach is


A. data is dependent on programs
B. data redundancy increases
C. data is integrated and can be accessed by multiple programs
D. none of the above
14) The collection of information stored in a database at a particular moment is called as ……
A. schema
B. instance of the database
C. data domain
D. independence

15) Data independence means


A. data is defined separately and not included in programs.
B. programs are not dependent on the physical attributes of data
C. programs are not dependent on the logical attributes of data
D. both B and C

16) A ……… is used to define overall design of the database


A. schema
B. application program
C. data definition language
D. code

17) Key to represent relationship between tables is called


A. primary key
B. secondary key
C. foreign key
D. none of the above

18) Grant and revoke are ……. statements.


A. DDL
B. TCL
C. DCL
D. DML

19) DBMS helps achieve


A. Data independence
B. Centralized control of data
C. Neither A nor B
D. Both A and B

20) ………. command can be used to modify a column in a table


A. alter
B. update
C. set
D. create
ANSWERS:

1. C) Program
2. B) Domains
3. A) Entity
4. C) Data Flow Diagram
5. A) Hierarchical schema
6. C) System
7. B) Schema
8. C) Having
9. B) is a standard .. accessible parts.
10. C) Structured query language
11) C. a tuple
12) B. COUNT
13) C. data is integrated and can be accessed by multiple programs
14) B. instance of the database
15) D. both B and C
16) A. schema
17) C. foreign key
18) C. DCL
19) D. Both A and B
20) A. alter
Test 13

1. The candidate key is that you choose to identify each row uniquely is called ……………..
A) Alternate Key
B) Primary Key
C) Foreign Key
D) None of the above

2. …………….. is used to determine whether a table contains duplicate rows.


A) Unique predicate
B) Like Predicate
C) Null predicate
D) In predicate

3. To eliminate duplicate rows ……………… is used


A) NODUPLICATE
B) ELIMINATE
C) DISTINCT
D) None of these

4. State true or false


i) A candidate key is a minimal super key.
ii) A candidate key can also refer to a surrogate key.
A) i-true, ii-false
B) i-false, ii-true
C) i-true, ii-true
D) i-false, ii-false

5. DCL stands for


A) Data Control Language
B) Data Console Language
C) Data Console Level
D) Data Control Level
6. …………………… is the process of organizing data into related tables.
A) Normalization
B) Generalization
C) Specialization
D) None of the above

7. A ………………. Does not have a distinguishing attribute if its own and most are dependent
entities, which are part of some another entity.
A) Weak entity
B) Strong entity
C) Non-attributes entity
D) Dependent entity

8. …………….. is the complex search criteria in the where clause.


A) Substring
B) Drop Table
C) Predict
D) Predicate

9. ………………… is the preferred method for enforcing data integrity


A) Constraints
B) Stored Procedure
C) Triggers
D) Cursors

10. The number of tuples in a relation is called its …………. While the number of attributes in a
relation is called it’s ………………..
A) Degree, Cardinality
B) Cardinality, Degree
C) Rows, Columns
D) Columns, Rows

11) The language that requires a user to specify the data to be retrieved without specifying
exactly how to get it is
A. Procedural DML
B. Non-Procedural DML
C. Procedural DDL
D. Non-Procedural DDL

12) Which two files are used during the operation of the DBMS?
A. Query languages and utilities
B. DML and query language
C. Data dictionary and transaction log
D. Data dictionary and query language
13) The database schema is written in
A. HLL
B. DML
C. DDL
D. DCL

14) The way a particular application views the data from the database that the application
uses is a
A. module
B. relational model
C. schema
D. subschema

15) The relational model feature is that there


A. is no need for primary key data
B. is much more data independence than some other database models
C. are explicit relationships among records.
D. are tables with many dimensions

16) Which one of the following statements is false?


A. The data dictionary is normally maintained by the database administrator
B. Data elements in the database can be modified by changing the data dictionary.
C. The data dictionary contains the name and description of each data element.
D. A data dictionary is a tool used exclusively by the database administrator.

17) Which of the following are the properties of entities?


A. Groups
B. Table
C. Attributes
D. Switchboards

18) Which database level is closest to the users?


A. External
B. Internal
C. Physical
D. Conceptual

19) Which are the two ways in which entities can participate in a relationship?
A. Passive and active
B. Total and partial
C. Simple and Complex
D. All of the above
20) …….. data type can store unstructured data
A. RAW
B. CHAR
C. NUMERIC
D. VARCHAR

ANSWERS:
1. B. Primary Key
2. A. Unique predicate
3. C. DISTINCT
4. C. i-true, ii-true
5. A. Data Control Language
6. A. Normalization
7. A. Weak entity
8. D. Predicate
9. A. Constraints
10. B. Cardinality, Degree
11. B. Non-Procedural DML
12.C. Data dictionary and transaction log
13. C. DDL
14. D. subschema
15. B. is much more data independence than some other database models
16. B. Data elements in the database can be modified by changing the data dictionary.
17. C. Attributes
18. A. External
19. B. Total and partial
20. A. RAW
Test 14

1. State true or false.


i) Select operator is not a unary operator.
ii) Project operator chooses subset of attributes or columns of a relation.
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False

2. …………… database is used as template for all databases created.


A) Master
B) Model
C) Tempdb
D) None of the above

3. One aspect that has to be dealt with by the integrity subsystem is to ensure that only valid
values can be assigned to each data items. This is referred to as
A) Data Security
B) Domain access
C) Data Control
D) Domain Integrity

4. ………………….. operator is basically a join followed by a project on the attributes of first


relation.
A) Join
B) Semi-Join
C) Full Join
D) Inner Join

5. Which of the following is not a binary operator in relational algebra?


A) Join
B) Semi-Join
C) Assignment
D) Project
6. Centralizing the integrity checking directly under the DBMS ………….. duplication and
ensures the consistency and validity of the database.
A) Increases
B) Skips
C) Does not reduce
D) Reduces

7. Which of the following is/are the DDL statements?


A) Create
B) Drop
C) Alter
D) All of the above

8. In snapshot, …………………. clause tells oracle how long to wait between refreshes.
A) Complete
B) Force
C) Next
D) Refresh

9. ……………… defines rules regarding the values allowed in columns and is the standard
mechanism for enforcing database integrity.
A) Column
B) Constraint
C) Index
D) Trigger

10. For like predicate which of the following is true.


i) % matches zero of more characters.
ii) _ matches exactly one character.
A) i-only
B) ii-only
C) Both of them
D) None of them

ANSWERS:

1. C) i-False, ii-True
2. B) Model
3. D) Domain Integrity
4. B) Semi-Join
5. D) Project
6. D) Reduces
7. D) All of the above
8. D) Refresh
9. B) Constraint
10. C) Both of them

Test 15

1. In SQL, which command is used to issue multiple CREATE TABLE, CREATE VIEW and
GRANT statements in a single transaction?
A) CREATE PACKAGE
B) CREATE SCHEMA
C) CREATE CLUSTER
D) All of the above
2. In SQL, the CREATE TABLESPACE is used
A) to create a place in the database for storage of scheme objects, rollback segments, and
naming the data files to comprise the tablespace.
B) to create a database trigger.
C) to add/rename data files, to change storage
D) All of the above
3. Which character function can be used to return a specified portion of a character string?
A) INSTR
B) SUBSTRING
C) SUBSTR
D) POS
4. Which of the following is TRUE for the System Variable $date$?
A) Can be assigned to a global variable.
B) Can be assigned to any field only during design time.
C) Can be assigned to any variable or field during run time.
D) Can be assigned to a local variable.

5. What are the different events in Triggers?


A) Define, Create
B) Drop, Comment
C) Insert, Update, Delete
D) Select, Commit
6. Which is the subset of SQL commands used to manipulate Oracle Database Structures,
including tables?
A) Data Definition Language
B) Data Manipulation Language
C) Data Described Language
D) Data Retrieval Language
7. The SQL statement SELECT SUBSTR(‘123456789’, INSTR(‘abcabcabc’,’b’), 4) FROM
EMP; prints
A) 6789
B) 2345
C) 1234
D) 456789

8. Which of the following SQL command can be used to modify existing data in a database
table?
A) MODIFY
B) UPDATE
C) CHANGE
D) NEW

9. When SQL statements are embedded inside 3GL, we call such a program as ……….
A) nested query
B) nested programming
C) distinct query
D) embedded SQL

10. ……………. provides option for entering SQL queries as execution time, rather than at the
development stage.
A) PL/SQL
B) SQL*Plus
C) SQL
D) Dynamic SQL
11) The RDBMS terminology for a row is
A. tuple
B. relation
C. attribute
D. degree

12) To change column value in a table the ……… command can be used.
A. create
B. insert
C. alter
D. update
13) The full form of DDL in Database Management System is
A. Dynamic Data Language
B. Detailed Data Language
C. Data Definition Language
D. Data Derivation Language

14) To pass on granted privileges to other user the …… clause is used


A. create option
B. grant option
C. update option
D. select option

15) A set of possible data values is called


A. attribute
B. degree
C. tuple
D. domain

16) ……… is critical in formulating database design.


A. row column order
B. number of tables
C. functional dependency
D. normalizing

17) A primary key if combined with a foreign key creates


A. Parent-Child relationship between the tables that connect them
B. Many to many relationship between the tables that connect them
C. Network model between the tables that connect them
D. None of the above

18) A …………. represents the number of entities to which another entity can be associated
A. mapping cardinality
B. table
C. schema
D. information

19) Which two files are used during operation of the DBMS
A. Query languages and utilities
B. DML and query language
C. Data dictionary and transaction log
D. Data dictionary and query language

20) A ……….. is a set of column that identifies every row in a table.


A. composite key
B. candidate key
C. foreign key
D. super key

ANSWERS:

1. B) CREATE SCHEMA
2. A) to create a place in the database for storage of scheme objects……….
3. C) SUBSTR
4. B) Can be assigned to any field only during design time.
5. C) Insert, Update, Delete
6. A) Data Definition Language
7. B) 2345
8. B) UPDATE
9. D) embedded SQL
10.D) Dynamic SQL
11) A. tuple
12) D. update
13) C. Data Definition Language
14) B. grant option
15) D. domain
16) C. functional dependency
17) A. Parent-Child relationship between the tables that connect them
18) A. mapping cardinality
19) C. Data dictionary and transaction log
20) D. super key
Test 16

1. The relational model is based on the concept that data is organized and stored in two-
dimensional tables called ……………………….

A) Fields
B) Records
C) Relations
D) Keys

2. ……………….. contains information that defines valid values that are stored in a column or
data type.

A) View
B) Rule
C) Index
D) Default

3. Which of the syntax is correct for insert statement?


i) insert into <table_name> values <list of values>
ii) insert into <table_name> (column list) values <list of values>

A) i-only
B) ii-only
C) Both of them
D) None of them

4. ………………. first proposed the process of normalization in DBMS.


A) Edgar. W
B) Edgar F. Codd
C) Edward Stephen
D) Edward Codd

5. For using a specific database …………… command is used.


A) use database
B) database name use
C) Both A &B
D) None of them

6. Which of the following is not comparison operator?

A) <>
B) <
C) =<
D) >=

7. An outstanding functionality of SQL is its support for automatic ………… to the target data.

A) programming
B) functioning
C) navigation
D) notification

8. ………………… is a special type of integrity constraint that relates two relations & maintains
consistency across the relations.

A) Entity Integrity Constraints


B) Referential Integrity Constraints
C) Domain Integrity Constraints
D) Domain Constraints

E) Key Constraints

9. ……………..specifies a search condition for a group or an aggregate.

A) GROUP BY Clause
B) HAVING Clause
C) FROM Clause
D) WHERE Clause

10. Drop Table cannot be used to drop a table referenced by a …………… constraint.

A) Local Key
B) Primary Key
C) Composite Key
D) Foreign Key
ANSWERS:

1. C) Relations
2. C) Index
3. C) Both of them
4. B) Edgar F. Codd
5. A) use database
6. C) =<
7. C) navigation
8. B) Referential…..Constraints
9. B) HAVING Clause
10. D) Foreign Key
Test 17

1. Processed data is called ………………..


A) Raw data
B) Information
C) Useful data
D) Source

2. …………….. is a utility to capture a continuous record of server activity and provide auditing
capability.
A) SQL Server Profile
B) SQL server service manager
C) SQL server setup
D) SQL server wizard.

3. Data items grouped together for storage purposes are called a


A) record
B) title
C) list
D) string

4. …………. contains data assisting day to day activities of the organization.


A) Control database
B) Operational database
C) Strategic database
D) Sequential database

5. ………………… approach reduces time and effort required for design and lesser risk in database
management.
A) Single global database
B) Top-down approach
C) Multiple databases
D) None of the above

6. HSAM stands for ……….


A) Hierarchic Sequential Access Method
B) Hierarchic Standard Access Method
C) Hierarchic Sequential and Method
D) Hierarchic Standard and Method

7. SQL server stores index information in the ………… system table


A) syst indexes
B) system indexes
C) sysind
D) sys indexes

8. The one guideline to be followed while designing the database is


A) A database design may be ambiguous.
B) Unrelated data should be at the same table so that updating the data will be easy.
C) It should avoid/reduce the redundancy.
D) An entity should not have attributes.

9. Which of the following is not a logical database structure?


A) Chain
B) Network
C) Tree
D) Relational

10. ……………. is a preferred method for enforcing data integrity


A) Constraints
B) Stored procedure
C) Triggers
D) Cursors

ANSWERS:

1. B) Information
2. B) SQL server service manager
3. A) record
4. B) Operational database
5. C) Multiple databases
6. A) Hierarchic Sequential Access Method
7. D) sys indexes
8. C) It should avoid/reduce the redundancy.
9. A) Chain
10. A) Constraints
Test 18

1. Reflexivity property says that X – Y is true if Y is ………………….


A) Subset of X

B) Null set of X

C) Super set of Y

D) Subset of Y

2. Anything that affects the database schema is a part of

A) DML

B) DCL

C) DDL

D) All of the above

3. An instance of a relation is a time varying set of ………………….

A) Tuples

B) Rows

C) Both of them

D) None of them

4. In the ………………… mode any record in the file can be accessed at random

A) Sequential access
B) Random access

C) Standard access

D) Source access

5. Which can be used to delete all the rows if a table?

A) Delete * from table_name

B) Delete from table_name

C) Delete table_name

D) all rows cannot be deleted at a time.

6. Which if the following is not the type of data integrity.

A) Key integrity

B) Domain integrity

C) Entity integrity

D) Referential integrity

7. 4NF stands for ..

A) Fourth Normal File

B) Fourth Normal Form

C) Fourth Normal Fraction

D) Fourth Negative File

8. A ……………… allows to make copies of the database periodically to help in the cases of
crashes & disasters.
A) Recovery utility

B) Backup Utility

C) Monitoring utility

D) Data loading utility

9. ………………. Allows definitions and query language statements to be entered; query results
are formatted and displayed.

A) Schema Processor

B) Query Processor

C) Terminal Interface

D) None of the above

10. The main task carried out in the …………… is to remove repeating attributes to separate
tables.

A) First Normal Form

B) Second Normal Form

C) Third Normal Form

D) Fourth Normal Form

ANSWERS:

1. A) Subset of X
2. C) DDL
3. C) Both of them
4. B) Random access
5. A) Delete * from table_name
6. A) Key integrity
7. B) Fourth Normal Form
8. B) Backup Utility
9. C) Terminal Interface
10. D) Fourth Normal Form
Test 19

1. ………………………. is the powerful language for working with RDBMS.


A) Embedded Programs
B) Dynamic Programs
C) Query Language
D) Static Language Programs

2. The file in DBMS is called as ……………… in RDBMS.


A) console
B) schema
C) table
D) object

3. In ………………… , we have a strict parent-child relationship only.


A) hierarchical databases.
B) network databases
C) object oriented databases
D) relational databases

4. Which normal form is considered adequate for relational database design?


A) 2 NF
B) 3 NF
C) 4 NF
D) BCNF

5. What operator tests column for the absence of data?


A) IS NULL operator
B) ASSIGNMENT operator
C) LIKE operator
D) NOT operator

6. Which is proper subset designed to support views belonging to different classes of users in
order to hide or protect information.
A) Schema
B) Sub-schema
C) Non-schema
D) Non-sub schema

7. Which contain information about a file needed by system programs for accessing file
records?
A) File blocks
B) File operators
C) File headers
D) None of these

8. A ……………….. DBMS distributes data processing tasks between the workstation and
network server.
A) Network
B) Relational
C) Client Server
D) Hierarchical

9. The ……………….. refers to the way data is organized in and accessible from DBMS.
A) database hierarchy
B) data organization
C) data sharing
D) data model

10. …………….. is a statement that is executed automatically by the system.


A) trigger
B) assertion
C) durability
D) integrity constraint

ANSWERS:
1. ………………………. is the powerful language for working with RDBMS.
C) Query Language

2. The file in DBMS is called as ……………… in RDBMS.


C) table

3. In ………………… , we have a strict parent-child relationship only.


A) hierarchical databases.

4. Which normal form is considered adequate for relational database design?


B) 3 NF
5. What operator tests column for the absence of data?
A) IS NULL operator

6. Which is proper subset designed to support views belonging to different classes of users in
order to hide or protect information.
B) Sub-schema

7. Which contain information about a file needed by system programs for accessing file
records?
C) File headers

8. A ……………….. DBMS distributes data processing tasks between the workstation and
network server.
C) Client Server

9. The ……………….. refers to the way data is organized in and accessible from DBMS.
D) data model

10. …………….. is a statement that is executed automatically by the system.


A) trigger
Test 20

1) Which of the following is not a characteristic of a relational database model?


A. Table
B. Tree like structure
C. Complex logical relationship
D. Records

2) Field is otherwise called as ……… of the record


A. data item
B. data type
C. value
D. variable

3) A table can have only one


A. Secondary key
B. Alternate key
C. Unique key
D. Primary key

4) A field can be called as ……….. in relation context.


A. random file
B. direct file
C. attribute
D. tuple

5) In the relational modes, cardinality is termed as


A. Number of tuples
B. Number of attributes
C. Number of tables
D. Number of constraints

6) The …….. is used for creating and destroying table, indexes and other forms of structures.
A. data manipulation language
B. data control language
C. transaction control language
D. data definition language
7) The view of total database content is
A. Conceptual view
B. Internal view
C. External view
D. Physical view

8) The ………… refers to the way data is organized in and accessible from DBMS.
A. database hierarchy
B. data organization
C. data sharing
D. data model

9) Architecture of the database can be viewed as


A. two levels
B. four levels
C. three levels
D. one level

10) …….. introduced the relational database rules.


A. Atul kahate
B. James Gossling
C. EF Codd
D. Dennies Rithchie

11) In a relational model, relations are termed as


A. Tuples
B. Attributes
C. Tables
D. Rows

12) When the values in one or more attributes being used as a foreign key must exist in
another set of one or more attributes in another table, we have created a(n) ……..
A. transitive dependency
B. insertion anomaly
C. referential integrity constraint
D. normal form

13) In the architecture of a database system external level is the


A. physical level
B. logical level
C. conceptual level
D. view level
14) A functional dependency is a relationship between or among …….
A. tables
B. rows
C. relations
D. attributes

15) Related fields in a database are grouped to form a


A. data file
B. data record
C. menu
D. bank

16) ………. is, a table have more than one set of attributes that could be chosen as the key
A. foreign key
B. integrity key
C. relationship
D. candidate key

17) The database environment has all of the following components except.
A. users
B. separate files
C. database
D. database administrator

18) The operation of eliminating columns in a table done by …….. operation.


A. Restrict
B. Project
C. Union
D. Divide

19) The way a particular application views the data from the database that the application
uses is a
A. module
B. relational model
C. schema
D. sub schema

20) ……. is a condition specified on a database schema and restricts the data that can be
stored in an instance of the database.
A. Key Constraint
B. Check Constraint
C. Foreign key constraint
D. integrity constraint
ANSWERS:
1) B. Tree like structure
2) A. data item
3) D. Primary key
4) C. attribute
5) A. Number of tuples
6) D. data definition language
7) A. Conceptual view
8) D. data model
9) C. three levels
10) C. EF Codd
11) C. Tables
12) C. referential integrity constraint
13) D. view level
14) D. attributes
15) B. data record
16) D. candidate key
17) A. users
18) B. Project
19) D. sub schema
20) B. Check Constraint

Test 21

1. A ………………… specifies the actions needed to remove the drawbacks in the current design
of a database.
A) 1 NF
B) 2 NF
C) 3 NF
D) Normal form
2. A relation is in ……………………… if an attribute of a composite key is dependent on an
attribute of another composite key.
A) 2NF
B) 3NF
C) BCNF
D) 1NF

3. The fifth Normal form is concerned with


A) Functional dependency
B) Multivalued dependency
C) Join dependency
D) Domain key

4. A table is in the ………………….. if only candidate keys are the determinants.


A) functional dependency
B) transitive dependency
C) 4 NF
D) BCNF

5. In 2NF
A) No functional dependencies exist.
B) No multivalued dependencies exist.
C) No partial functional dependencies exist
D) No partial multivalued dependencies exist.

6. The normal form that is not necessarily dependency preserving is


A) 2NF
B) 3NF
C) BCNF
D) 4NF

7. The …………….. is related to the concept of multi-valued dependency.


A) fourth normal form
B) fifth normal form
C) boyce codd normal form
D) third normal form

8. Which normal form is considered adequate for normal relational database design?
A) 2NF
B) 5NF
C) 4NF
D) 3NF
9. Dependency preservation is not guaranteed in
A) BCNF
B) 3NF
C) 4NF
D) DKNF

10. A relation is ………………. if every field contains only atomic values that are, no lists or sets.
A) 1 NF
B) 2 NF
C) 3 NF
D) BCNF

ANSWERS:

1. A ………………… specifies the actions needed to remove the drawbacks in the current design
of a database.
D) Normal form

2. A relation is in ……………………… if an attribute of a composite key is dependent on an


attribute of another composite key.
B) 3NF

3. The fifth normal form is concerned with


C) Join dependency

4. A table is in the ………………….. if only candidate keys are the determinants.


D) BCNF

5. In 2NF
C) No partial functional dependencies exist

6. The normal form that is not necessarily dependency preserving is


A) 2NF

7. The …………….. is related to the concept of multi-valued dependency.


A) fourth normal form

8. Which normal form is considered adequate for normal relational database design?
D) 3NF

9. Dependency preservation is not guaranteed in


A) BCNF
10. A relation is ………………. if every field contains only atomic values that are, no lists or sets.
A) 1 NF
Test 22

1. Which of the following relational algebra operations do not require the participating tables
to be union-compatible?
A. Union
B. Intersection
C. Difference
D. Join

2) Relational Algebra does not have


A. Selection operator
B. Projection operator
C. Aggregation operator
D. Division operator

3) Tree structures are used to store data in


A. Network model
B. Relational model
C. Hierarchical model
D. File-based system

4) The rule that a value of a foreign key must appear as a value of some specific table is called
a
A. Referential constraint
B. Index
C. Integrity constraint
D. Functional

5) It is an abstraction through which relationships are treated as higher-level entities.


A. Generalization
B. Specialization
C. Aggregation
D. Inheritance

6) The operation which is not considered a basic operation of relational algebra is


A. Join
B. Selection
C. Union
D. Cross product

7) In SQL the statement select*from R,S is equivalent to


A. Select * from R natural join S
B. Select * from R cross join S
C. Select * from R union join S
D. Select * from R inner join S

8) When an E-R diagram is mapped to tables, the representation is redundant for


A. Weak entity sets
B. weak relationship sets
C. Strong entity sets
D. strong relationship sets

9) If two relations R and S are joined, then the non-matching tuples of both R and S are
ignored in
A. left outer join
B. right outer join
C. full outer join
D. inner join

10) Relational Algebra is


A. Data Definition Language
B. Meta Language
C. Procedural query Language
D. None of the above

11) If an entity can belong to only one lower level entity then the constraint is
A. disjoint
B. partial
C. overlapping
D. single

12) The common column is eliminated in


A. theta join
B. outer join
C. natural join
D. composed join

13) In E-R diagram total participation is represented by


A. double lines
B. Dashed lines
C. single line
D. Triangle

14) Relationships among relationships can be represented in an E-R model using


A. Aggregation
B. Association
C. Weak entity sets
D. Weak relationship sets

15) Which of the following constitutes a basic set of operations for manipulating relational
data?
A. Predicate calculus
B. Relational calculus
C. Relational algebra
D. SQL

16) Relational calculus is a


A. Procedural language
B. Non-Procedural language
C. Data definition language
D. High level language

17) Cartesian product in relational algebra is


A. a Unary operator
B. a Binary operator
C. a Ternary operator
D. not defined

18) In an E-R diagram attributes are represented by


A. rectangle
B. square
C. ellipse
D. triangle

19) In an E-R diagram, an entity set is represented by a


A. rectangle
B. ellipse
C. diamond box
D. circle

20) E-R model uses this symbol to represent the weak entity set?
A. Dotted rectangle
B. Diamond
C. Doubly outlined rectangle
D. None of these

ANSWERS:

1) D.Join
2) C. Aggregation operator
3) C. Hierarchical model
4) A. Referential constraint
5) C. Aggregation
6) A. Join
7) B. Select * from R cross join S
8) B. weak relationship sets
9) D. inner join
10) C. Procedural query Language
11) B. partial
12) C. natural join
13) A. double lines
14) A. Aggregation
15) C. Relational algebra
16) B. Non-Procedural language
17) B. a Binary operator
18) C. ellipse
19) A. rectangle
20) C. Doubly outlined rectangle
Test 23

1) What is a data integrity?


A. It is the data contained in the database that is non-redundant.
B. It is the data contained in the database that is accurate and consistent.
C. It is the data contained in the database that is secured.
D. It is the data contained in the database that is shared.

2) As per equivalence rules for query transformation, selection operation distributes over
A. Union
B. Intersection
C. Set difference
D. All of the above

3) In SQL the word ‘natural’ can be used with


A. inner join
B. full outer join
C. right outer join
D. all of the above

4) Which of the following relational algebraic operations is not from set theory?
A. Union
B. Intersection
C. Cartesian Product
D. Select

5) An entity set that does not have sufficient attributes to form a primary key is a
A. strong entity set
B. weak entity set
C. simple entity set
D. primary entity set

6) In the case of entity integrity, the primary key may be


A. not Null
B. Null
C. both Null and not Null
D. any value
7) A logical schema
A. is the entire database.
B. is a standard way of organizing information into accessible parts.
C. describes how data is actually stored on disk
D. both A and C

8) Which of the operations constitute a basic set of operations for manipulating relational
data?
A. Predicate calculus
B. Relational calculus
C. Relational algebra
D. None of the above

9) Which of the following is another name for the weak entity?


A. Child
B. Owner
C. Dominant
D. All of the above

10) Which of the following is a record based logical model?


A. Network Model
B. Object-oriented model
C. E-R model
D. None of the above

11) A file manipulation command that extracts some of the records from a file is called
A. SELECT
B. PROJECT
C. JOIN
D. PRODUCT

12) In E-R Diagram derived attribute is represented by


A. Ellipse
B. Dashed ellipse
C. Rectangle
D. Triangle

13) The natural join is equal to


A. Cartesian Product
B. Combination of Union and Cartesian product
C. Combination of selection and Cartesian product
D. Combination of projection and Cartesian product
14) In E-R diagram relationship type is represented by
A. Ellipse
B. Dashed ellipse
C. Rectangle
D. Diamond

15) In E-R diagram generalization is represented by


A. Ellipse
B. Dashed ellipse
C. Rectangle
D. Triangle

16) A table joined with itself is called


A. Join
B. Self Join
C. Outer Join
D. Equi Join

17) ……….. means multiple copies of the same data items.


A. Data reduction
B. Data integrity
C. Data consistency
D. Data redundancy

18) Different values for the same data item is referred to as …….
A. data consistency
B. data inconsistency
C. data integrity
D. data duplication

19) The ………. returns row after combining two tables based on common values.
A. difference
B. product
C. join
D. union

20) The ………. can be used to ensure database integrity.


A. entity integrity
B. database constraints
C. referential integrity
D. cardinality
ANSWERS:

1) B. It is the data contained in the database that is accurate and consistent.


2) All of the above
3) A. inner join
4) D. Select
5) B. weak entity set
6) A. not Null
7) A. is the entire database.
8) C. Relational algebra
9) Child
10) A. Network Model
11) A. SELECT
12) B. Dashed ellipse
13) D. Combination of projection and Cartesian product
14) D. Diamond
15) D. Triangle
16) B. Self Join
17) D. Data redundancy
18) B. data inconsistency
19) C. join
20) B. database constraints
Test 24-SQL

1. DML is provided for


A) Description of logical structure of database
B) Addition of new structure in the database system.
C) Manipulation & processing of database
D) Definition of physical structure of database system

2.’AS’ clause is used in SQL for


A) Selection operation
B) Rename Operation
C) Join operation
D) Projection Operation

3. Count function in SQL returns the number of


A) values
B) distinct values
C) groups
D) columns

4. The statement in SQL which allows to change the definition of a table is


A) Alter
B) Update
C) Create
D) Select

5. Which of the following is correct.


A) A SQL query automatically eliminates duplicates
B) SQL permits attribute names to be repeated in the same relation
C) A SQL query will not work if there are no indexes on the relations
D) None of the above

6. Which of the following operation is used if we are interested in only certain columns of a
table?
A) PROJECTION
B) SELECTION
C) UNION
D) JOIN

7. Which of the following is a legal expression in SQL?


A) SELECT NULL FROM EMPLOYEE;
B) SELECT NAME FROM EMPLOYEE;
C) SELECT NAME FROM EMPLOYEE WHERE SALARY=NULL;
D) None of the above

8. Which of the following is a valid SQL type?


A) CHARACTER
B) NUMERIC
C) FLOAT
D) All of the above

9. Which command is used to select distinct subject (SUB) from the table (BOOK)?
A) SELECT ALL FROM BOOK
B) SELECT DISTINCT SUB FROM BOOK
C) SELECT SUB FROM BOOK
D) All of the above

10. In SQL, which of the following is not a data definition language commands?
A) RENAME
B) REVOKE
C) GRANT
D) UPDATE

ANSWERS:

1. DML is provided for


C) Manipulation & processing of database
2.’AS’ clause is used in SQL for
B) Rename Operation
3. Count function in SQL returns the number of
A) values
4. The statement in SQL which allows to change the definition of a table is
A) Alter
5. Which of the following is correct.
D) None of the above
6. Which of the following operation is used if we are interested in only certain columns of a
table?
A) PROJECTION
7. Which of the following is a legal expression in SQL?
B) SELECT NAME FROM EMPLOYEE;
8. Which of the following is a valid SQL type?
D) All of the above
9. Which command is used to select distinct subject (SUB) from the table (BOOK)?
B) SELECT DISTINCT SUB FROM BOOK
10. In SQL, which of the following is not a data definition language commands?
D) UPDATE
Test 25-SQL

1. Which of the following query is correct for using comparison operators in SQL?
A) SELECT sname, coursename FROM studentinfo WHERE age>50 and <80;
B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;
C) SELECT sname, coursename FROM studentinfo WHERE age>50 and WHERE
age<80;
D) None of the above

2.How to select all data from studentinfo table starting the name from letter ‘r’?
A) SELECT * FROM studentinfo WHERE sname LIKE ‘r%’;
B) SELECT * FROM studentinfo WHERE sname LIKE ‘%r%’;
C) SELECT * FROM studentinfo WHERE sname LIKE ‘%r’;
D) SELECT * FROM studentinfo WHERE sname LIKE ‘_r%’;

3. Which of the following SQL query is correct for selecting the name of staffs from ‘tblstaff’
table where salary is 15,000 or 25,000?
A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);
B) SELECT sname from tblstaff WHERE salary BETWEEN 15000 AND 25000;
C) Both A and B
D) None of the above
4. The SELECT statement, that retrieves all the columns from empinfo table name starting
with d to p is ……………………..
A) SELECT ALL FROM empinfo WHERE ename like ‘[d-p]%’;
B) SELECT * FROM empinfo WHERE ename is ‘[d-p]%’;
C) SELECT * FROM empinfo WHERE ename like ‘[p-d]%’;
D) SELECT * FROM empinfo WHERE ename like ‘[d-p]%’;

5. Select a query that retrieves all of the unique countries from the student table?
A) SELECT DISTINCT coursename FROM studentinfo;
B) SELECT UNIQUE coursename FROM studentinfo;
C) SELECT DISTINCT coursename FROM TABLE studentinfo;
D) SELECT INDIVIDUAL coursename FROM studentinfo;

6. Which query is used for sorting data that retrieves the all the fields from empinfo table and
listed them in the ascending order?
A) SELECT * FROM empinfo ORDER BY age;
B) SELECT * FROM empinfo ORDER age;
C) SELECT * FROM empinfo ORDER BY COLUMN age;
D) SELECT * FROM empinfo SORT BY age;

7. Select the right statement to insert values to the stdinfo table.


A) INSERT VALUES (“15”, “Hari Thapa”, 45, 5000) INTO stdinfo;
B) INSERT VALUES INTO stdinfo (“15”, “Hari Thapa”, 45, 5000);
C) INSERT stdinfo VALUES (“15”, “Hari Thapa”, 45, 5000);
D) INSERT INTO stdinfo VALUES (“15”, “Hari Thapa”, 45, 5000);

8. How to Delete records from studentinfo table with name of student ‘Hari Prasad’?
A) DELETE FROM TABLE studentinfo WHERE sname=’Hari Prasad’;
B) DELETE FROM studentinfo WHERE sname=’Hari Prasad’;
C) DELETE FROM studentinfo WHERE COLUMN sname=’Hari Prasad’;
D) DELETE FROM studentinfo WHERE sname LIKE ‘Hari Prasad’;

9. Constraint checking can be disabled in existing …………. and ………….. constraints


so that any data you modify or add to the table is not checked against the
constraint.
A) CHECK, FOREIGN KEY
B) DELETE, FOREIGN KEY
C) CHECK, PRIMARY KEY
D) PRIMARY KEY, FOREIGN KEY

10. ………………… joins two or more tables based on a specified column value not equaling a
specified column value in another table.
A) OUTER JOIN
B) NATURAL JOIN
C) NON-EQUIJOIN
D) EQUIJOIN

ANSWERS:

1. B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;
2. A) SELECT * FROM studentinfo WHERE sname LIKE ‘r%’;
3. A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);
4. D) SELECT * FROM empinfo WHERE ename like ‘[d-p]%’;
5. A) SELECT DISTINCT coursename FROM studentinfo;
6. A) SELECT * FROM empinfo ORDER BY age;
7. D) INSERT INTO stdinfo VALUES (“15”, “Hari Thapa”, 45, 5000);
8. B) DELETE FROM studentinfo WHERE sname=’Hari Prasad’;
9. A) CHECK, FOREIGN KEY
10.C) NON-EQUIJOIN
Test 26:-SQL and Embedded Sql

1) DROP is a ……………. statement in SQL.


A. Query
B. Embedded SQL
C. DDL
D. DCL

2) The keyword to eliminate duplicate rows from the query result in SQL is.
A. DISTINCT
B. NO DUPLICATE
C. UNIQUE
D. None of the above

3) Which of the following aggregate function does not ignore nulls in its results?
A. COUNT
B. COUNT(*)
C. MAX
D. MIN

4) In SQL, testing whether a subquery is empty is done using


A. DISTINCT
B. UNIQUE
C. NULL
D. EXISTS

5) ……………. operator is used to compare a value to a list of literals values that have been specified.
A. Like
B. Compare
C. Between
D. In

6) The language used in application programs to request data from the DBMS is referred to as
the
A. DML
B. DDL
C. VDL
D. SDL

7) The DBMS language component which can be embedded in a program is


A. The data definition language(DDL)
B. The data manipulation language(DML)
C. The database administrator(DBA)
D. A query language

8) A DBMS query language is designed to


A. Support end users who use English-like commands.
B. Support in the development of complex applications software.
C. Specify the structure of a database.
D. All of the above

9) It is possible to define a schema completely using.


A. VDL and DDL
B. DDL and DML
C. SDL and DDL
D. VDL and DML

10) Which of the following is correct.


A. a SQL query automatically eliminates duplicates.
B. SQL permits attribute names to be repeated in the same relation.
C. a SQL query will not work if there are no indexes on the relations.
D. None of these.

11) Which of the following is a comparison operator in SQL?


A. =
B. LIKE
C. BETWEEN
D. All of the above

12) To delete a particular column in a relation the command used is.


A. UPDATE
B. DROP
C. ALTER
D. DELETE

13) The ………… operator is used to compare the value to a list of literals values that that have
been specified.
A. BETWEEN
B. ANY
C) IN
D) ALL

14) ………… function divides one numeric expression by another and returns the remainder.
A. POWER
B. MOD
C. ROUND
D. REMAINDER

15) A data manipulation command the combines the record from one or more tables is called.
A) SELECT
B. PROJECT
C. JOIN
D. PRODUCT

16) DDL stands for


A. Data definition language
B. Data description language
C. Data design languages
D. Database dictionary languages.

17) The DDL is used to specify the ……..


A. Conceptual schema
B. Internal schema
C. Both
D. None

18) Which is used for data retrieval from the database?


A. DDL
B. DML
C. SDL
D. VDL

19) Which is used to specify the user views and their mappings to the conceptual schema?
A. DDL
B. DML
C. SDL
D. VDL

20) Which command are included in a general purpose programming languages?


A. DDL
B. DML
C. DSL
D. VDL
ANSWERS:

1) C. DDL
2) C. UNIQUE
3) B. COUNT(*)
4) D. EXISTS
5) A. Like
6) A. DML
7) B. The data manipulation language(DML)
8) D. All of the above
9) B. DDL and DML
10) D. None of these.
11) D. All of the above
12) C. ALTER
13) A. BETWEEN
14) B. MOD
15) C. JOIN
16) A. Data definition language
17) A.Conceptual schema
18) B.DML
19) D.VDL
20) B.DML
Test 27-SQL server

1. ……………………. are predefined and maintained SQL Server and users cannot assign or
directly change the values.
A) Global variables
B) Local Variables
C) Integer Variables
D) Floating Variables

2. A local variable is shown ……………………… preceding its name.


A) One @ symbol
B) Two @@ symbol
C) One # symbol
D) Two ## symbol

3. Constraint checking can be disabled on existing ……….. and …………. constraints so that any
data you modify or add to the table is not checked against the constraint.
A) CHECK, FOREIGN KEY
B) DELETE, FOREIGN KEY
C) CHECK, PRIMARY KEY
D) PRIMARY KEY, FOREIGN KEY

4. ……………. and ………………. are the Transact – SQL control-of-flow key words.
A) Continue, Stop
B) Break, Stop
C) Continue, While
D) While, Going to

5. The type of constraint …………………… specifies data values that are acceptable in a column.
A) DEFAULT
B) CHECK
C) PRIMARY
D) UNIQUE
6. The ………………… constraint defines a column or combination of columns whose values
match the primary key of the same or another table.
A) DEFAULT
B) CHECK
C) PRIMARY
D) FOREIGN KEY

7. The control-of-flow statement ………………… defines conditional, and optionally, alternate


execution when a condition is FALSE.
A) WHILE
B) WAITFOR
C) IF……..ELSE
D) BEGIN………. END
8. In SQL Server, ………………… is based on relationships between foreign keys and primary
keys or between foreign keys and unique keys.
A) Entity integrity
B) Domain integrity
C) Referential integrity
D) User-defined integrity

9. When a …………….. clause is used, each item in the select list must produce a single value
for each group.
A) ORDER BY
B) GROUP
C) GROUP BY
D) GROUP IN

10. MS SQL Server uses a variant of SQL called T-SQL, or Transact SQL, an implementation
of ……………… with some extensions.
A) MS SQL Server
B) Tabular Data Set
C) SQL-92
D) Tabular Data Stream

ANSWERS:

1. A) Global variables
2. A) One @ symbol
3. A) CHECK, FOREIGN KEY
4. C) Continue, While
5. B) CHECK
6. D) FOREIGN KEY
7. C) IF……..ELSE
8. C) Referential integrity
9. C) GROUP BY
10.C) SQL-92
Test 28:Sql server

1. …………………… is the full form of SQL.


A) Standard Query Language
B) Sequential Query Language
C) Structured Query Language
D) Server Side Query Language

2. SQL Server 2005 NOT includes the following system database ………….
A) tempdb Database
B) Master Database
C) Model Database
D) sqldb Database

3. SQL Server stores index information in the ………………… system table.


A) sysindexes
B) systemindexes
C) sysind
D) sysindexes

4. ………………… is a read-only database that contains system objects that are included with
SQL Server 2005.
A) Resource Database
B) Master Database
C) Model Database
D) msdb Database

5. The SQL Server services includes …………………


A) SQL server agent
B) Microsoft distribution transaction coordinator
C) Both a & b
D) None of the above
6. …………………. is a utility to capture a continuous record of server activity and provide
auditing capability.
A) SQL server profile
B) SQL server service manager
C) SQL server setup
D) SQL server wizard

7. The query used to remove all references for the pubs and newspubs databases from the
system tables is ……………………..
A) DROP DATABASE pubs, newpubs;
B) DELETE DATABASE pubs, newpubs;
C) REMOVE DATABASE pubs, newpubs;
D) DROP DATABASE pubs and newpubs;

8. …………………. clause specifies the groups into which output rows are to be placed and, if
aggregate functions are included in the SELECT clause.
A) ORDER BY
B) GROUP
C) GROUP BY
D) GROUP IN

9. ……………… are predefined and maintained SQL Server where users cannot assign or
directly change the values.
A) Local Variables
B) Global Variables
C) Assigned Variables
D) Direct Variables

10. Microsoft SQL Server NOT uses which of the following operator category?
A) Bitwise Operator
B) Unary Operator
C) Logical Operator
D) Real Operator

ANSWERS:

1. C) Structured Query Language


2. D) sqldb Database
3. D) sysindexes
4. A) Resource Database
5. C) Both a & b
6. B) SQL server service manager
7. A) DROP DATABASE pubs, newpubs;
8. C) GROUP BY
9. B) Global Variables
10.D) Real Operator

SQL Transaction Management

1) In the …………, one transaction inserts a row in the table while the other transaction is
halfway through its browsing of the table.
A. transaction read a problem
B. one way read a problem
C. serial read problem
D. phantom read problem

2) Transaction processing is associated with everything below except.


A. producing detail, summery, or exception reports
B. recording a business activity
C. confirming an action or triggering a response
D. maintaining data

3) ………. helps solve concurrency problem.


A. locking
B. transaction monitor
C. transaction serializability
D. two-phase commit

4) If a transaction acquires a shared lock, then it can perform ………. operation.


A. read
B. write
C. read and write
D. update

5) If a transaction obtains a shared lock on a row, it means that the transaction wants to ….. that row.
A. write
B. insert
C. execute
D. read

6) The node where the distributed transaction originates is called the …….
A. local coordinator
B. starting coordinator
C. global coordinator
D. originating node

7) If a transaction obtains an exclusive lock on a row, it means that the transaction wants to
……. that row.
A. select
B. update
C. view
D. read

8) If a transaction acquires an exclusive lock, then it can perform ………. operation.


A. read
B. write
C. read and write
D. update

9) …….. is a specific concurrency problem wherein two transactions depend on each other for
something.
A. phantom read problem
B. transaction read a problem
C. deadlock
D. locking

10) If a database server is referenced in a distributed transaction, the value of its commit
point strength determines which role it plays in the ………
A. two-phase commit
B. two-phase locking
C. transaction locking
D. checkpoints

11) Transaction ………. ensures that the transaction is being executed successfully.
A. concurrency
B. consistency
C. serializability
D. non serialiasability

12) The situation in which a transaction holds a data item and waits for the release of data
item held by some other transaction, which in turn waits for another transaction, is called
…….
A. serializable schedule
B. process waiting
C. concurrency
D. deadlock
13) ………… protocol grantees that a set of transactions becomes serializable.
A. two-phase locking
B. two-phase commit
C. transaction locking
D. checkpoints

14) The global coordinator forgets about the transaction phase is called ………
A. Prepare phase
B. Commit phase
C. Forget phase
D. Global phase

15) In two-phase commit, ………. coordinates the synchronization of the commit or rollback
operations.
A. database manager
B. central coordinator
C. participants
D. concurrency control manager

16) In two-phase locking protocol, a transaction obtains locks in ……..phase.


A. shrinking phase
B. growing phase
C. running phase
D. initial phase

17) A transaction processing system is also called as ……..


A. processing monitor
B. transaction monitor
C. TP monitor
D. monitor

18) After the nodes are prepared, the distributed transaction is said to be ……
A. in-doubt
B. in-prepared
C. prepared transaction
D. in-node

19) In ………., we have many mini transactions within the main transaction.
A. transaction control
B. chained transaction
C. nested transaction
D. calling transaction
20) In a two-phase locking protocol, a transaction release locks in ……… phase.
A. shrinking phase
B. growing phase
C. running phase
D. initial phase

ANSWERS:

1) D. phantom read problem


2) C. confirming an action or triggering a response
3) A. locking
4) A. read
5) D. read
6) C. global coordinator
7) B. update
8) C. read and write
9) C. deadlock
10) A. two-phase commit
11) C. serializability
12) D. deadlock
13) A. two-phase locking
14) C. Forget phase
15) B. central coordinator
16) B. growing phase
17) C. TP monitor
18) A. in-doubt
19) B. chained transaction
20) A. shrinking phase

Database backup and recovery

1) Which of the following is not a recovery technique?


A. Deferred update
B. Immediate update
C. Two-phase commit
D. Recovery management
2)Checkpoints are a part of
A. Recovery measures
B. Security measures
C. Concurrency measures
D. Authorization measures

3) ……. deals with soft errors, such as power failures.


A. system recovery
B. media recovery
C. database recovery
D. failure recovery

4) ……….. is an essential part of any backup system.


A. Filter
B. Recovery
C. Security
D. Scalability

5) Media recovery deals with ………..


A. disk errors
B. hard errors
C. system errors
D. power failures

6) For a backup/restore system, …………. is a prerequisite for service in a enterprise.


A. Filter
B. Recovery
C. Security
D. Scalability

7) Failure recovery and media recovery fall under ……..


A. transaction recovery
B. database recovery
C. system recovery
D. value recovery

8) The ………. consists of the various applications and database that play a role in a backup
and recovery strategy.
A. Recovery Manager environment
B. Recovery Manager suit
C. Recovery Manager file
D. Recovery Manager database

9) In which the database can be restored up to the last consistent state after the system
failure?
A. Backup
B. Recovery
C. Both
D. None

10) A ……….. is a block of Recovery Manager(RMAN)job commands that is stored in the


recovery catalogue.
A. recovery procedure
B. recovery block
C. stored block
D. stored script

11) In log based recovery, the log is sequence of ………


A. filter
B. records
C. blocks
D. numbers

12) The enrolling of a database in a recovery catalogue is called ………


A. set up
B. registration
C. start up
D. enrollment

13) ………. is an alternative of log based recovery.


A. Disk recovery
B. Shadow paging
C. Dish shadowing
D. Crash recovery

14) Most backup and recovery commands in ……….. are executed by server sessions.
A. Backup Manager
B. Recovery Manager
C. Backup and Recovery Manager
D. Database Manager

15) …….. systems typically allows to replace failed disks without stopping access to the system.
A. RAM
B. RMAN
C. RAD
D. RAID

16) An ……… is an exact copy of a single data-file, archived redo log file, or control file.
A. image copy
B. data file copy
C. copy log
D. control copy

17) ………. known as memory-style error correcting-code(ECC) organization, employs parity


bits.
A. RAID level 1
B. RAID level 2
C. RAID level 3
D. RAID level 4

18) The remote backup site is sometimes called the ………. site.
A. primary
B. secondary
C. ternary
D. None of the above

19) EXP command is used ………..


A. to take Backup of the Oracle Database
B. to import data from the exported dump file
C. to create Rollback segments
D. to create Schedule.

20) The simplest approach to introducing redundancy is to duplicate every disk is called …..
A. mirroring
B. imaging
C. copying
D. All of the above

ANSWERS:

1) C. Two-phase commit
2) A. Recovery measures
3) D. failure recovery
4) C. Security
5) A. disk errors
6) D. Scalability
7) C. system recovery
8) A. Recovery Manager environment
9) B. Recovery
10) D. stored script
11) B. records
12) B. registration
13) B. Shadow paging
14) B. Recovery Manager
15) D. RAID
16) A. image copy
17) B. RAID level 2
18) B. secondary
19) A. to take Backup of the Oracle Database
20) A. mirroring
For code on matrix refer link :- https://www.geeksforgeeks.org/matrix/

For dbms learing material ref :- https://www.geeksforgeeks.org/dbms/

Program in python ref:- https://www.geeksforgeeks.org/python-add-leading-k-character/

https://www.geeksforgeeks.org/tag/python-string-programs/

https://www.multisoftsystems.com/assessments/python-practice-test

https://play.google.com/store/apps/details?id=ab.design.infyqt_placement

https://codeofgeeks.com/category/infytq-last-year-problems/

You might also like