wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

infytq sample test 2

Total questions: 60

Worksheet time: 3600secs

Name
Class
Date
1.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
2.

Чему равно "a" после выполнения программы?

a = 2

If a<3:

print(a+1)

else:

print(a-1)

a)

3

b)

2

c)

1

d)

0

3.

x = 3

c = 0

while x > 1:

c = c +1

x = x -1

a)

3

b)

0

c)

1

d)

2

4.

Which one will display when this code is run?

a)
b)
c)
d)
5.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
6.
What is the output from this program?
a)
5
7
9
A python is a non-venomous snake
done
b)
A python is a non-venomous snake
A python is a non-venomous snake
A python is a non-venomous snake
done
c)
A python is a non-venomous snake
A python is a non-venomous snake
A python is a non-venomous snake 
A python is a non-venomous snake
done
d)
done
7.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
8.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
9.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
10.

cakeAmount = raw_input()

print "We have", cakeAmount, " cakes"


The above code is run. You type:

six


Select the correct output.

a)

We have six cakes

b)

We have 6 cakes

c)

We havesix cakes

d)

Syntax Error

11.

age = input("Enter Age (as integer): ")

newAge = age + 20

print ("your age in 20 years is:", newAge)


you enter

15

a)

value of age is 15

value of newAge is 35

output is: your age in 20 years is: 35

b)

value of age is 15

value of newAge is 20

output is: your age in 20 years is: 20

c)

value of age is 15

value of newAge is "age + 20"

output is: your age in 20 years is: 35

d)

value of age is 15

value of newAge is 35

output is: your age in 20 years is:35

12.

Let x= "Python", the output of

print(x[0])

print(x[-1])

print(x[-2])

a)

P

N

O

b)

p

O

n

c)

t

h

y

d)

P

n

o

13.

What will this code print?

a)

Print the word 'letter'.

b)

Print a user input on one line.

c)

Print a user input one letter at a time.

d)

Print an Error.

14.

What will be the output of this code?

a)

1,2,3,4,5,6,7,8,9,10,11,12

b)

0,2,4,6,8,10

c)

2,4,6,8,10,12

d)

2,4,6,8,10

15.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon 
16.
What is the output from this code?
a)
A sequence of four orange triangles
b)
An orange triangle and an orange square
c)
A sequence of three orange squares
d)
Error
17.
What output will this code produce?
a)
['France', 'Wales', 'England']
France
b)
['France', 'Wales', 'England']
Wales
c)
France, Wales, England
Wales
d)
France  Wales  England
France
18.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
19.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
20.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
21.
What will print?
a)
1 2
b)
1
c)
3
d)
5
22.

Find the Output:

Item = {"ECE" , "CSE" , "EEE" , "CIVIL"}

Item.add (2,"MECH")

print(Item)

a)

{ "ECE" , "MECH" , "CSE" , "EEE" , "CIVIL" }

b)

{ "ECE" , "CSE" , "MECH" , "EEE" , "CIVIL" }

c)

{ "ECE" , "CSE" , "EEE" , "CIVIL" }

d)

{ "ECE" , "CSE" , "EEE" ,"MECH" , "CIVIL" }

23.

What is the output for the below code

a=b=c = 1,2,3

print(a,b,c)

a)

1 2 3

b)

(1, 2, 3) (1, 2, 3) (1, 2, 3)

c)

Syntax Error

d)

Logical Error

24.

Integrity constraints ensure that changes made to the database by authorized users do not result into loss of data consistency. Which of the following statement(s) is (are) true w.r.t. the examples of integrity constraints ?

(i) An instructor Id. No. cannot be null, provided Intructor Id No. being primary key.

(ii) No two citizens have same Adhar-Id.

(iii) Budget of a company must be zero.

a)

(i), (ii) and (ii) are true.

b)

(i) false, (ii) and (iii) are true.

c)

(i) and (ii) are true; (iii) false.

25.

a)

0

b)

1

c)

error

d)

none of the mentioned

26.
a)

[[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]

b)

[[0], [[0], 1], [[0], [[0], 1], 2]]

c)

[0, None, 1, None, 2, None]

d)

[[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]

27.
a)

Welcome# 111#924.66

b)

Welcome#111#924.66

c)

Welcome#111#.66

d)

Welcome # 111#924.66

28.

To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed)?

a)

s[]

b)

s.getitem(3)

c)

s.__getitem__(3)

d)

s.getItem(3)

29.

a)

True False

b)

True True

c)

Run Time Error

d)

False False

30.

What function do you use to read a string?

a)

input(“Enter a string”)

b)

eval(input(“Enter a string”))

c)

enter(“Enter a string”)

d)

eval(enter(“Enter a string”))

31.

Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?

a)

[2, 33, 222, 14]

b)

Error

c)

25

d)

[25, 14, 222, 33, 2]

32.

a)

11

b)

12

c)

21

d)

22

33.

Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?

a)

[3, 4, 5, 20, 5, 25, 1]

b)

[1, 3, 3, 4, 5, 5, 20, 25]

c)

[3, 5, 20, 5, 25, 1, 3]

d)

[1, 3, 4, 5, 20, 5, 25]

34.

What will be the output of the following Python code?


"Welcome to Python".split()

a)

[“Welcome”, “to”, “Python”]

b)

(“Welcome”, “to”, “Python”)

c)

{“Welcome”, “to”, “Python”}

d)

“Welcome”, “to”, “Python”

35.

a)

The program prints two rows 3 4 5 1 followed by 33 6 1 2

b)

The program prints on row 3 4 5 1 33 6 1 2

c)

The program prints two rows 3 4 5 1 followed by 33 6 1 2

d)

The program prints two rows 1 3 4 5 followed by 1 2 6 33

36.

a)

[[1, 2], [3, 1.5], [0.5, 0.5]]

b)

[[3, 1.5], [1, 2], [0.5, 0.5]]

c)

[[0.5, 0.5], [1, 2], [3, 1.5]]

d)

[[0.5, 0.5], [3, 1.5], [1, 2]]

37.

What will be the output of the following Python code?


print("xyyzxyzxzxyy".count('xyy', -10, -1))

a)

2

b)

0

c)

1

d)

error

38.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a)

SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)

b)

SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)

c)

SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)

d)

SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);

39.

With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?

a)

SELECT * FROM Items ORDER BY Price ASCENDING

b)

SELECT * FROM Items ORDER BY Price ASC

c)

SELECT * FROM Items BY Price LOWEST TO HIGHEST

d)

SELECT * FROM Items ORDER BY Price DESC

40.

With SQL, how can you return the number of records in the "Persons" table?

a)

SELECT NO(*) FROM Persons

b)

SELECT COUNT(*) FROM Persons

c)

SELECT LEN(*) FROM Persons

41.
Write a code for the following: Return the names and imdb_ratings of all movies with ‘day’ in the name.
a)
SELECT * FROM movies WHERE name LIKE ‘day’;
b)
RETURN  name, imdb_rating FROM movies WHERE name LIKE '%day%';
c)
SELECT name, imdb_rating FROM movies WHERE name LIKE '%day%';
d)
SELECT * FROM movies WHERE imdb_rating AND name LIKE ‘%day%’;
42.
a)
ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;
b)
ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;
c)
ANSWER: SELECT * FROM movies WHERE year > 2010;
d)
ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;
43.
Return the name and genre of each movie with an imdb_rating greater than 5 and year greater than 2012.
a)
SELECT * FROM movies WHERE imdb_rating > 5 AND year > 2012;
b)
SELECT name, genre FROM movies WHERE imdb_rating < 5 AND year < 2012;
c)
SELECT name, year FROM movies WHERE imdb_rating > 5 year > 2012;
d)
SELECT name, genre FROM movies WHERE imdb_rating > 5 AND year > 2012;
44.
a)
SELECT * FROM movies WHERE genre = 'horror' AND imdb_rating >= 7  LIMIT 8; ORDER BY ASC LIMIT 8;
b)
SELECT * FROM movies WHERE genre = 'horror' AND imdb_rating >= 7  LIMIT 8;
c)
SELECT * FROM movies WHERE imdb_rating >= 7  LIMIT 8;
d)
SELECT * FROM movies WHERE genre = 'horror' AND imdb_rating >= 7;
45.
a)
SELECT genre, year FROM movies WHERE genre = 'action' ORDER BY year ASC LIMIT 11;
b)
SELECT genre, year FROM movies WHERE genre = action ORDER BY year DESC LIMIT 11;
c)
none of these
d)
SELECT genre, year FROM movies WHERE genre = 'action' ORDER BY year DESC LIMIT 11;
46.
a)
SELECT * FROM movies WHERE genre = 'romance' AND imdb_rating > 7.5 ORDER BY year DESC LIMIT 4;
b)
SELECT * FROM movies WHERE genre = 'romance' AND imdb_rating > 7.5 ORDER BY year ASC LIMIT 4;
c)
SELECT * FROM movies WHERE genre = romance AND imdb_rating > 7.5 ORDER BY year DESC LIMIT 4;
d)
SELECT * FROM movies WHERE genre = 'romance' AND imdb_rating < 7.5 ORDER BY year DESC LIMIT 4;
47.
a)

v_num is not equal to v_char

b)

compilation error

c)

v_num is equal to v_char

d)

runtime error

48.

Which choice shows what I will see on the screen after the following block is executed?

a)

-1

VALUE_ERROR

b)

-1

TOO_MANY_ROWS

c)

3

NO ERROR

d)

1

NO ERROR

49.

Match SQL language with SQL commands

1)DDL i)Revok, Grant

2)DML ii)rename a table

3)TCL iii)insert, update

4)DCL iv)rollback , commit

a)

1-iii,2-i,3-ii,4-iv

b)

1-iii,2-ii,3-iv,4-i

c)

1-ii,2-iii,3-iv,4-i

d)

1-i,2-iii,3-ii,4-iv

50.

The Entity Customer has three candidate keys: a) CustId b) Email and c) ContactNo. Suggest the best primary key for this entity.

a)

CustId

b)

Email

c)

ContactNo

d)

CustId and ContactNo

51.
Which of the following is spelled correctly?
a)
recreation
b)
rekreation
c)
recreasion
d)
recreetion
52.

Find the odd one out

a)

AC

b)

EF

c)

VX

d)

QS

53.
a)

B

b)

D

c)

I

d)

K

54.

The time of the watch is

2:31

3:13

3:55

4:37

?

What will be the next time?

a)

5:25

b)

5:00

c)

5:19

d)

5:05

55.

If 20% of a = b, then b% of 20 is same as

a)

4% of a

b)

5% of a

c)

20% of a

d)

None of these

56.

Accept means

a)

consent to receive

b)

natural ability

c)

buy or obtain

d)

to try

57.

if 15% of (A+B) = 25% of (A-B), then what percent of B is equal to A?

(a)  

58.

A sum of money at simple interest doubles in 7 years. It will becomes four times in

a)

18years

b)

21years

c)

38years

d)

42years

59.

In how many ways can the letters of the word MACHINE be arranged so that the vowels may occupy the odd Positions

a)

576

b)

210

c)

144

d)

1024

60.

The small child does whatever his father was done.

a)

has done

b)

did

c)

does

d)

had done

e)

No correction required