wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Internal Lab Quiz-1 CSECS

Total questions: 10

Worksheet time: 2hrs 40mins

Name
Class
Date
1.

What is the correct way to declare a variable in Python?

a)

var x : int = 10

b)

x := 10

c)

let x = 10

d)

x = 10

2.

Which of the following is a valid Prolog fact?

a)

cat(tom)

b)

cat(tom).

c)

fish(nemo)

d)

dog(buddy)

3.

How do you create a list in Python?

a)

You create a list in Python using curly braces, e.g., my_list = {}.

b)

You create a list in Python using square brackets, e.g., my_list = [] or my_list = [1, 2, 3].

c)

You create a list in Python by using parentheses, e.g., my_list = (1, 2, 3).

d)

You create a list in Python by calling the list() function, e.g., my_list = list(1, 2, 3).

4.

What is the purpose of the 'import' statement in Python?

a)

To create a new variable in Python.

b)

To include external modules or libraries in a Python script.

c)

To execute a Python script from the command line.

d)

To define a function in Python.

5.

Which operator is used for equality comparison in Prolog?

a)

=

b)

===

c)

equals

d)

==

6.

What is the output of the following Python code: print(2 ** 3)?

a)

9

b)

8

c)

6

d)

4

7.

How do you define a predicate in Prolog?

a)

A predicate in Prolog is defined as 'predicate_name{arguments}'.

b)

A predicate in Prolog is defined using the syntax 'predicate_name(arguments).'.

c)

A predicate in Prolog is expressed with 'predicate_name: arguments.'

d)

A predicate in Prolog is created using 'define predicate_name(arguments)'.

8.

Which Python library is commonly used for data manipulation?

a)

Matplotlib

b)

Pandas

c)

Scikit-learn

d)

NumPy

9.

What is the syntax for a Prolog query?

a)

predicate(arguments)[]

b)

predicate:arguments.

c)

predicate(arguments).

d)

predicate{arguments}

10.

How do you handle exceptions in Python?

a)

Use if-else statements to manage errors.

b)

Log errors without handling them.

c)

Ignore exceptions and continue execution.

d)

Use try-except blocks to handle exceptions.