Internal Lab Quiz-1 CSECS
Quiz
•
Engineering
•
University
•
Practice Problem
•
Easy
Dr. Sahashra
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
What is the correct way to declare a variable in Python?
var x : int = 10
x := 10
let x = 10
x = 10
Answer explanation
In Python, variables are declared using the assignment operator '='. The correct choice 'x = 10' assigns the value 10 to the variable x. The other options use syntax from different programming languages.
2.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
Which of the following is a valid Prolog fact?
cat(tom)
cat(tom).
fish(nemo)
dog(buddy)
Answer explanation
The correct Prolog fact is 'cat(tom).' because it ends with a period, which is required to denote the end of a fact. The other options either lack the period or are not formatted as valid facts.
3.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
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).
Answer explanation
In Python, lists are created using square brackets. For example, my_list = [] creates an empty list, while my_list = [1, 2, 3] creates a list with elements. The other options describe different data structures or incorrect syntax.
4.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
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.
Answer explanation
The 'import' statement in Python is used to include external modules or libraries, allowing access to their functions and classes. This is essential for code reuse and leveraging existing code, making it the correct choice.
5.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
Which operator is used for equality comparison in Prolog?
=
===
equals
==
Answer explanation
In Prolog, the operator '=' is used for equality comparison, allowing you to check if two terms are equal. The other options, '===', 'equals', and '==' are not valid for this purpose in Prolog.
6.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
What is the output of the following Python code: print(2 ** 3)?
9
8
6
4
Answer explanation
The code print(2 ** 3) calculates 2 raised to the power of 3. This equals 2 * 2 * 2, which is 8. Therefore, the correct answer is 8.
7.
MULTIPLE CHOICE QUESTION
10 mins • 5 pts
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)'.
Answer explanation
A predicate in Prolog is defined using the syntax 'predicate_name(arguments).'. This format clearly indicates the predicate name followed by its arguments enclosed in parentheses, ending with a period.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Bill Nye Inventions
Quiz
•
6th Grade - University
10 questions
04 Pengkondisi Sinyal
Quiz
•
University
15 questions
TRICODE CHALLENGE ROUND 1
Quiz
•
University
10 questions
Disaster Management - Intro 01
Quiz
•
University
10 questions
Servo motor Quiz
Quiz
•
University
10 questions
Emerging technologies in image segmentation
Quiz
•
University
10 questions
CRYPTOGRAPHY
Quiz
•
University
10 questions
Probability Marginalprobability, Conditional Probability
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
Discover more resources for Engineering
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
7 questions
Different Types of Energy
Interactive video
•
4th Grade - University
20 questions
Slopes and Slope-Intercept Form
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Biomolecules (Updated)
Interactive video
•
11th Grade - University
20 questions
Winter/Holiday Trivia
Quiz
•
KG - University
10 questions
WINTER WIN Time - ELA - 12/9/2025
Quiz
•
KG - University
7 questions
Human Impact on Resources
Interactive video
•
4th Grade - University
