You are on page 1of 14

Infytq screening test 3

1. Out of 10 teachers of a school, one teacher retires and in place of him a new teacher (1 point)
25 yrs. old joins. As a result of it average age of the teachers reduces by 3 yrs. Age
of the retired teacher (in yrs.) is.

Example : 26

55

2. Consider the following table emp10 with given data (1 point)

Emp10
firstname lastname gender salary
pradeep rangasamy M 28000
minu tiwari f 22000
abjith dasgupta M 35000
Ganesh majumdar M 50000
himadri bhuyan M 20000
gurunath reddy M 40000

What is the result of the following SQL Query ?

select FIRSTNAME from emp10 where salary in

(select salary*2/4 from emp10)

order by salary,gender
◯ no rows returned
⚫1
◯3
◯2

3. How many seconds will a 500 metre long train take to cross a man walking with a (1 point)
speed of 3 km/hr in the direction of the moving train if the speed of the train is 63
km/hr?

EXAMPLE : 42

30

4. Consider the following statements in SQL. (1 point)

i) UNION can be used with UPDATE keyword

ii) All the SELECT queries in the UNION must be against the same table

iii) UNION and UNION ALL will give the same result when the participating
SELECT queries are mutually exclusive.

Identify which of the above statements are TRUE


◯ only i) and iii)
◯ only i) and ii)
◯ only ii) and iii)
⚫ only iii)

5. In a group of buffaloes and ducks, the number of legs are 24 more than twice the (1 point)
number of heads. What is the number of buffaloes in the group?

Example : 11

12

6. What is the result of the following query? (1 point)

select round(to_date('25-OCT-2008'),'YYYY') from dual;

Round(to_date('
______________
What is the value that needs to be put in the blank to get the result ?
◯ 01-JAN-2008
◯ 01-NOV-2008
⚫ 01-JAN-2009
◯ 01-OCT-2008

7. What is the value of ‘comm’ ,'sal',and ‘netsal’ after executing the following query if (1 point)
the initial value of ‘sal’ is 10000? (ASSUME comm and netsal coumns have null
values)

UPDATE EM SET SAL = SAL + 1000, COMM = SAL*0.3,


NETSAL=(NETSAL+SAL+COMM)
◯ error in query
◯ 11000,3000,14000
⚫ 11000,3000,null
◯ 11000,3300,14300

8. Consider the following schemas (1 point)

Table 1 : DEPT

DEPTNO (NOT NULL , NUMBER(2)), DNAME (VARCHAR2(14)),

LOC (VARCHAR2(13)

Table 2 : EMP

EMPNO (NOT NULL , NUMBER(4)), ENAME (VARCHAR2(10)),

JOB (VARCHAR2(9)), MGR (NUMBER(4)), HIREDATE (DATE),

SAL (NUMBER(7,2)), COMM (NUMBER(7,2)), DEPTNO (NUMBER(2))

MGR is the empno of the employee whom the employee reports to. DEPTNO is a
foreign key.

what is the sql query that finds the most recently hired employee details in each
department.
◯ SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN

(SELECT DEPTNO, MIN(HIREDATE) FROM EMP GROUP BY DEPTNO);


◯ SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN

(SELECT DEPTNO, MIN(HIREDATE) FROM EMP );


⚫ SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN

(SELECT DEPTNO, MAX(HIREDATE) FROM EMP GROUP BY DEPTNO);


◯ SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN

(SELECT DEPTNO, MAX(HIREDATE) FROM EMP);

9. What is the result of the following query? (1 point)

select to_char(1234567,'99,999.0000') "DISPLAY NUMBER USING to_char "


from dual;
◯ no rows returned
⚫ ########
◯ 12345.67
◯ 12345.00

10. Consider the emp _project table. (1 point)

pname pnumber plocation dnum

--------- ----------- ------------ --------

ProductA 1 New York 5

ProductB 2 Texas 5

ProductC 3 Wilington 5

ERP 10 Delaware 4

Reorg 20 Wilington 1
Newbee 30 Delaware 4

Identify the correct query for the following output

pname

-----------------

ERP

Newbee
◯ SELECT pname FROM TABLE emp project WHERE dnumber = 10;
⚫ SELECT pname FROM emp project WHERE dnum = 4;
◯ SELECT pname FROM TABLE emp project as dnum = 4;
◯ SELECT pname FROM emp project FOR dnum = 4;

11. Consider the following 2 statements (1 point)

P: ^= and <> denote the same operation is SQL

Q: != and <> denote the same operation is SQL


⚫ P is TRUE, Q is TRUE
◯ P is FALSE, Q is FALSE
◯ P is FALSE, Q is TRUE
◯ P is TRUE, Q is FALSE

12. Given the following linked list: (1 point)

12->34->26->67->98

What would be the state of the linked list when the following Python function is
invoked by passing the head node of the above linked list and 3?
----Assumption: All the references to the necessary files are available

◯ 98->34->26->67->12
⚫ 12->34->26->67->98
◯ 26->34->12->67->98
◯ 67->34->26->12->98

13. Identify the correct answer for the given statements (1 point)

i) IS NULL operator tests the attribute for its absence of data

ii) DISTINCT keyword is used to not allow duplicate values when you create data
⚫ i-true, ii-false
◯ i-false, ii-true
◯ i-false, ii-false
◯ i-true, ii-true

14. (Top--->Bottom) (1 point)


7->12->1->5->4->2
What will be the output of the below Python function when it is invoked by passing
the above stack?
Assumption: All the references to the necessary files are available

----Assumption: All the references to the necessary files are available


◯ 84->8->5
◯ 5->84->8
⚫ 8->5->84
◯ No change

15. Consider the following output of an SQL Query. (1 point)

DATE WITH TIME


19-FEB-2020,10:55

SQL QUERY

select to_char(sysdate,'DD-MON-YYYY,___:___') "DATE WITH TIME" from


dual;

What are the values that need to be put in the blanks to complete execution of
query given below ?
◯ hh:ss
◯ hh:mm
⚫ hh:mi
◯ hh:mn

16. What will be the status of output_stack after execution of above code? (1 point)

Assumption: All the references to the necessary files are available

Note: Consider that the elements of stack in the options are shown from top to
bottom

◯ 11SouthAfrica-->18England-->27Australia-->32India
◯ 5India-->9Australia-->7England-->11SouthAfrica
◯ 11SouthAfrica-->7England-->9Australia-->5India
⚫ 32India-->27Australia-->18England-->11SouthAfrica
17. What is the output of following function when head node of following linked list is (1 point)
passed as input?

1->2->3->4->5->6

def fun(head):

if(head==None):

return

print(head.get_data()," ",end='')

if head.get_next().!= None:

fun(head.get_next().get_next())

print(head.get_data()," ", end='')


◯146641
◯135135
◯1235
⚫135531

18. A tank is filled in 5 hours by three pipes A, B and C. The pipe C is twice as fast as (1 point)
B and B is twice as fast as A. How much time will pipe A alone take to fill the
tank?

example : 22hrs

35hrs

19. def fun(n): (0 points)

queue.enqueue(0)

queue.enqueue(1)
for I in range(0,n):

a= queue.dequeue()

b= queue.dequeue()

queue.enqueue(a)

queue.enqueue(a+b)

print(a)
◯ Prints numbers from n-1 to 0
◯ Prints first n Fibonacci numbers in reverse order.
⚫ Prints first n Fibonacci numbers
◯ Prints numbers from 0 to n-1

20. Arun, Kamal and Vinay invested Rs. 8000, Rs. 4000 and Rs. 8000 respectively in a (1 point)
business. Arun left after six months. If after eight months, there was a gain of Rs.
4005, then what will be the share of Kamal?

Examples: 325

890

21. Train A takes 1 hour more than train B to travel a distance of 720 km. Due to (1 point)
engine trouble speed of train B falls by one third, so it takes 3 hours more than
Train A to complete the same journey. What is the speed of Train A (in km/hr)?

Example: 60

80

22. A can do a piece of work in 12 days and B in 16 days. A began the work alone, (1 point)
After some days B joined the work. The work was completed in 9 days, in all. How
many days before the completion of the work did B join the work?

Example : 22
4

23. Ram borrows Rs. 3000 at 10% compound rate of interest. At end of each year he (1 point)
pays back Rs. 1000. How much amount should he pay at the end of the third year
to clear all his dues?

Example: 52

1683

24. A shopkeeper bought 80 kg of sugar at the rate of Rs 13.5 per kg. He mixed it with (1 point)
120 kg of sugar costing Rs 16 per kg. In order to make a profit of 20%, he must sell
the mixture at:

Example : 21

18

25. Rs. 600 amounts to Rs. 720 in 4 years at simple interest. If the interest rate is (1 point)
increased by 5% of itself. How much would it amount?

Example : 624

726

26. What will be the output of the below Python code? (1 point)

def func (sample, res, key,val):

if(key in sample):

res=True

sample .update({key:val})

res=False
res=None

sample={ "X5":1,"X" :0,"XL":3 ,"XXL":4}

func (sample ,res,"X",2)

print(sample["X"], res)
◯ 0 None
◯ 2 None
⚫ 0 True
◯ 2 False

27. Consider the following list of numbers to be sorted using bubble sort in ascending (1 point)
order.

9, 6, 18, 3, 10, 25, 2

At the end of 3rd pass what will be status of the above list?

◯ [6, 9, 3, 10, 18, 2, 25]


◯ [2, 3, 6, 9, 10, 18, 25]
⚫ [3, 6, 9, 2, 10, 18, 25]
◯ [3, 6, 2, 9, 10, 18, 25]

28. Consider the below given list of numbers. (1 point)

43, 89, 15, 29, 7, 25, 0, 99

Suppose merge sort algorithm is used to sort the above list of numbers in ascending
order, how many times lists will be merged?
◯1
⚫7
◯0
◯5
29. Consider the list of numbers given below which should be sorted in ascending (1 point)
order:

91 68 12 83 72 3 47 65

At the end of 4th pass, the status of the list is

3 12 47 65 72 91 68 83

Which sorting algorithm is being used to sort the list?

◯ bubble sort
⚫ selection sort
◯ merge sort
◯ quick sort

30. Consider the below Python code: (1 point)

Assumption: All the references to the necessary files are available

What is the status of Queues q1 and q2 after execution of above code?

The order of elements in options are from Front to Rear


◯ q1 contains: 12-->20-->15 and q2 contains: 10-->1
◯ q1 contains: 12-->15-->20 and q2 contains: 1-->10
⚫ q1 contains: 12-->15-->20 and q2 contains: 10-->1
◯ q1 contains: 12-->10-->15-->20 and q2 contains: 1

31. What would be the output of the below Python code (1 point)

list1=[10,20,0,40,0]
def test ( ) :

try :

i=3

if(listl[i]/listl[i+l]>l): value=i+l

except ZeroDivisionError: print("1")

except IndexError: print("2")

finally :

print("4")

print("5")

test()
◯1

5
⚫1

5
◯2

5
◯1

32. Given the following linked list: (1 point)

1->4->6->7->9

What would be the state of the linked list when the following Python function is
invoked by passing the head node of the above linked list and 5?
Assumption: All the references to the necessary files are available. Method
get_next() returns the link to the next node. Method get_data() returns data of the
node.

◯ 1->4->6->7->7
◯ 7->4->6->7->7
◯ 1->4->6->7->9
⚫ 7->4->6->7->9

33. Function fun() would always return 1 (1 point)

Consider the list of numbers given below:

45 56 79 81 82 94 108

Identify the search algorithm which will be able to find the element 79 in 4
iterations

from the below given options.

1. Linear Search

2. Binary Search
◯ only 1
◯ only 2
⚫ Both 1 & 2
◯ Neither 1 or 2

You might also like