WorksheetsPCEP QUIZ Section 1
Total questions: 40
Worksheet time: 22mins
A process in which the source code is immediately executed without translating in into a machine code is called:
complilation
linking
interpretation
debugging
A code written in a high-level programming language is called:
a binary code
the ASCII code
a source code
machine code
A syntax is a part of a langiuage definition which describes the rules used to build:
the sentences from a set of words
the data from digits
the symbols from a set of dots
the words from a set of symbols
Which of these would assist in making a string an integer?
int()
number()
stringint()
print()
Which of these functions would help print out a random number?
a) printrandom()
b) number()
c) random.randit()
The (a) module allows us to use functions that generate random numbers. (No caps)
Which of the following is the correct snippet of code for the function 'find'?
The function 'find' should be given a letter to find and a word to search within.
if char in word:
return True
else:
return False
while True:
find char in word
return True/False
if word has char:
return False
else:
return True
Return True;
Return False;
Which line has an error?
19
21
23
18
How is a try and catch used in python?
It is like an if then else which shows our error if there is one and it does not
It is used to check if a snippet of code has an error and if it does it allows us to handle the error without terminating the program
it tries a snippet of code then it catches the value that it sends, similar as a return
It returns an error and terminates the program so we may identify what was the issue
Which of the following is not a common error in python?
ZeroDivisionError
ValueError
SyntaxError
ListError
An error existing in the code is commonly called as
(a)
What is IDLE?
An acronym that stands for Integrated Development and Learning Environment for python
A version of Python
An acronym that stands for Interactive Development and Learning Extension
An acronym that stands for Individual Development Language Exclusive
What do you call a tool that lets you launch your code step-by-step and inspect it at each moment of execution?
A console
A debugger
An editor
A notepad
Python is an example of:
a natural language
a machine language
a high-level programming
an English language
What is a source code?
machine code executed by compilers
another name for a source file
a program written in a high-level programming language
a source of data that gets used in the python file
What python version is covered in this class?
Python3
Python2
Python5
Python
What is IDLE?
An acronym that stands for Integrated Development and Learning Environment for python
A version of Python
An acronym that stands for Interactive Development and Learning Extension
An acronym that stands for Individual Development Language Exclusive
Which of the following are correct statements?
True + 1 evaluates to 1
True and False evaluates to False
True or False evaluates to False
7+ False evaluates to False
09. Who created Python?
Guido ban Rossum
Guido van Rossum
Guido the Russian
Guodo van Rossum
How many lines does each of the following code examples output when run separately?
Example 1: two, Example 2: one, Example 3: one, Example 4: one
Example 1: two, Example 2: one, Example 3: one, Example 4: two
Example 1: two, Example 2: one, Example 3: two, Example 4: three
Example 1: one, Example 2: one, Example 3: one, Example 4: two
A complete set of commands is known as:
Instruction list
Code laws
Command-line
Command list
What is the grammar of a programming language?
syntax
indentation
punctuation
program
Why do you need to indent in Python?
To organize lines of code so that they're not messy
To group lines of code together inside a conditional or repeat
To print the answer of the input in the output of the system console
To run the interpreter of the IDE in the debugger of the editor
Which of the following will print 10?
print(7 + 3)
print("6 + 4")
print("5" + "5")
print("0" + 10)
A string does not have to be enclosed with quotation marks.
True
False
Int is the abbreviation used for integers.
True
False
_________________ is a decimal number.
Integer
Variable
String
Float
_________________ is a place holder for value.
varName =
Variable
Integer
Multiplier
Logic errors are the hardest errors to detect.
True
False
Kind of loop used when you know the number of times you want it to repeat
list
for
while
if
What will be the output?
name = "Dave"
print ("name")
Dave
name
"name"
"Dave"
Choose the correct output of the following code.
for i in range(10,15):
print(i)
10
11
12
13
14
15
10
11
12
13
14
11
12
13
14
15
11
12
13
14
What term is used to describe data passed into a function?
Variable
Loop
Constant
Parameter
Leo wants to create a function that will roll a dice. Which is the correct function definition header?
def dice roll ():
def diceroll ()
def diceroll ():
def diceroll []:
What is an algorithm?
A set of steps for performing a task, like a recipe.
To add something to the end; for example, adding letters onto the end of a string or adding elements to the end of a list or array.
A value passed to a function.
A rhythm designed for people named "Al."
A programming statement that allows a block of code to be repeated for a given range of values defines
function
while loop
for loops
applications
A named, reusable set of programming statements to perform a specific task defines
applications
algorithms
modules
functions
