wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz 2

Total questions: 10

Worksheet time: 15mins

Name
Class
Date
1.

What will be the output of the following Python code?

a)

3

b)

4

c)

4 is maximum

d)

3,4

2.

What will be the output of the following Python code?

a)

x is 50

Changed global x to 2

Value of x is 50

b)

x is 50

Changed global x to 2

Value of x is 2

c)

x is 50

Changed global x to 50

Value of x is 50

d)

x is 50

Changed global x to 52

Value of x is 2

3.

What will be the output of the following Python code?

a)

a is 7 and b is 3 and c is 10

a is 25 and b is 5 and c is 24

a is 5 and b is 100 and c is 50

b)

a is 3 and b is 7 and c is 10

a is 5 and b is 25 and c is 24

a is 50 and b is 100 and c is 5

c)

a is 3 and b is 7 and c is 10

a is 25 and b is 5 and c is 24

a is 100 and b is 5 and c is 50

d)

a is 3 and b is 3 and c is 10

a is 25 and b is 25 and c is 24

a is 100 and b is 5 and c is 50

4.

What does the following code print?

a)

[2, 4, 6]

b)

[1, 2, 3]

c)

[4, 16, 36]

d)

[0, 2, 4]

5.

What does the following code print?

a)

mary

b)

hada

c)

little

d)

littlelamb

6.

What is the correct sequence to create a database connection?

i. Import JDBC packages.

ii. Open a connection to the database.

iii. Load and register the JDBC driver.

iv. Execute the statement object and return a query resultset.

v. Create a statement object to perform a query.

vi. Close the resultset and statement objects.

vii. Process the resultset.

viii. Close the connection.

a)
  1. i, ii, iii, v, iv, vii, viii, vi

b)
  1. i, iii, ii, v, iv, vii, vi, viii

c)
  1. ii, i, iii, iv, viii, vii, v, vi

d)
  1. i, iii, ii, iv, v, vi, vii, viii

7.

What are the major components of the JDBC?

a)

DriverManager, Driver, Connection, Statement, and ResultSet

b)

DriverManager, Driver, Connection, and Statement

c)

DriverManager, Statement, and ResultSet

d)

DriverManager, Connection, Statement, and ResultSet

8.

Fine the Out for the following

a)

b)

c)

d)

9.

Which of the following methods is used to add an ActionListener to a JButton object?

a)

addAction()

b)

addActionListener()

c)

addListener()

d)

addEventHandler()

10.

 

Which of the following methods is used to set the size of a component?

a)

setSize()

b)

setPreferredSize()

c)

setBounds()

d)

setMinimumSize()