NEW
Font size
WorksheetsInternal Lab Quiz-1 CSECS
Total questions: 10
Worksheet time: 2hrs 40mins
What is the correct way to declare a variable in Python?
var x : int = 10
x := 10
let x = 10
x = 10
Which of the following is a valid Prolog fact?
cat(tom)
cat(tom).
fish(nemo)
dog(buddy)
How do you create a list in Python?
You create a list in Python using curly braces, e.g., my_list = {}.
You create a list in Python using square brackets, e.g., my_list = [] or my_list = [1, 2, 3].
You create a list in Python by using parentheses, e.g., my_list = (1, 2, 3).
You create a list in Python by calling the list() function, e.g., my_list = list(1, 2, 3).
What is the purpose of the 'import' statement in Python?
To create a new variable in Python.
To include external modules or libraries in a Python script.
To execute a Python script from the command line.
To define a function in Python.
Which operator is used for equality comparison in Prolog?
=
===
equals
==
What is the output of the following Python code: print(2 ** 3)?
9
8
6
4
How do you define a predicate in Prolog?
A predicate in Prolog is defined as 'predicate_name{arguments}'.
A predicate in Prolog is defined using the syntax 'predicate_name(arguments).'.
A predicate in Prolog is expressed with 'predicate_name: arguments.'
A predicate in Prolog is created using 'define predicate_name(arguments)'.
Which Python library is commonly used for data manipulation?
Matplotlib
Pandas
Scikit-learn
NumPy
What is the syntax for a Prolog query?
predicate(arguments)[]
predicate:arguments.
predicate(arguments).
predicate{arguments}
How do you handle exceptions in Python?
Use if-else statements to manage errors.
Log errors without handling them.
Ignore exceptions and continue execution.
Use try-except blocks to handle exceptions.
