a
!"#!$%$!&'(&)**+,($-../,0+)1.$+,$!203',$45+66/.$
!"#!$%$!&'(&)**+,($-../,0+)1.$+,$!203',$45+66/.$7'851/$9$:/.0
7'851/$9$:/.0 Z
#,.;/&. th
W
1. !203',$+.$),$/<)*=1/$'>? s
a machine language o
a natural language c
a high-level programming language R
2. #$@'*=1/0/$./0$'>$A,';$@'**),8.$+.$@)11/8? is
e
a machine list In
an instruction list s
a low-level list In
3. B3)0$+.$)$.'5&@/$@'8/C h
Another name for source file fi
Machine code executed by computers
A program written in a high-level programming language
4. B3)0$8'$2'5$@)11$)$@'*=50/&$=&'(&)*$;3+@3$8+&/@012$/</@50/.$+,.0&5@0+',.
;&+00/,$+,$)$=&'(&)**+,($1),(5)(/C
An interpreter
A translator
A compiler
5. B3)0$!203',$D/&.+',$+.$@'D/&/8$+,$03+.$@'5&./C
Python 1
Python 3
Python 2
6. B3)0$+.$"!203',C
A compiled language used to perform high-level programming functions
It is another name for Cython, a superset of the Python programming language
The default implementation of the Python programming language
7. B3)0$+.$EFG-C
It’s a Python version
It’s an acronym that stands for Interactive Development and Learning Extension.
It’s an acronym that stands for Integrated Development and Learning Environment for Python.
8. B3)0$8'$2'5$@)11$)$0''1$03)0$1/0.$2'5$1)5,@3$2'5&$@'8/$.0/=$H2$.0/=$),8$+,.=/@0$+0
)0$/)@3$*'*/,0$'>$/</@50+',C
An editor
A console
A debugger
9. I';$8+8$!203',J$03/$=&'(&)**+,($1),(5)(/J$(/0$+0.$,)*/C
Guido van Rossum named it to honor Python of Catana, a dramatic poet of the time of Alexander the Great
Guido van Rossum named it after the Pythonidae – afamily of large, novenomous snakes
Guido van Rossum named it to honor Monty Python’s Flying Circus, a BB comedy series popular in the 1970s
10. B3+@3$',$'>$03/$>'11';+,($+.$),$/<)*=1/$'>$)$!203',$K1/$/<0/,.+',C
pi
p
py
1. What is CPython?
It’s a programming language that is a superset of the C language, designed to produce Python-like performance with code
written in C
It’s a programming language that is a superset of Python, designed to produce C-like performance with code written in
Python
it’s the default, reference implementation of Python, written in the C language
It’s the default reference implementation of the C language, written in Python
2. What is the expected behavior of the following program?
print ("Hello!")
The program will output (“Hello!”) to the screen
The program will output Hello! to the screen
The program will output “Hello!” to the screen
The program will generate an error message on the screen
3. What is true about compilation? (Select two answers)
It tends to be slower than interpretation
The code is converted directly into machine code executable by the processor
Both you and the end user must have the compiler to run your code
It tends to be faster than interpretation
4. What do you call a file containing a program written in a high-level programming language?
A source file
A machine file
A code file
A target file
5. What is machine code?
A low-level programming language consisting of binary digits/bits that the computer reads and understands
A high-level programming language consisting of instruction lists that human can read and understands
A medium-level programming language consisting of the assembly code designed for the computer processor
A low-level programming language consisting of hexadecimal digits that make up high-level language instructions
6. What is the best definition of a script?
It’s a text file that contains instructions which make up a Python program
It’s an error message generated by the interpreter
It’s an error message generated by the compiler
It’s a text file that contains sequences of zeroes and ones
7. What do you call a command-line interpreter which lets you interact with your OS and execute Python
commands and scripts?
A console
A compiler
An editor
Jython
8. Select the true statements? (Select two answers)
Python 3 is backwards compatible with Python 2
Python is a good choice for creating and executing tests for applications
Python is free, open-source, and multiplatform
Python is a good choice for low-level programming, e.g., when you want to implement an effective driver
9. What is the expected behavior of the following program?
Prin("Goodbye!")
r
The program will output (“Goodby!”)
The program will output Goodbye! to the screen
The program will generate an error message on the screen
The program will output “Goodbye!”
10. What are the four fundamental elements that make a language?
An alphabet a lexis, phonetics, and semantics
An alphabet, a lexis, a syntax, and semantics
An alphabet, morphology, phonetics, and semantics
An alphabet phonetics phonology and semantics
AETN2302 Quiz 1
!"#!$%$!&'(&)**+,($-../,0+)1.$+,$!203',$45+66/.
7'851/$9$:/.0$#,.;/&.
Posted on November 3, 2019 by Admin 3 Comments
Last Updated on April 26, 2020 by Admin
!"#!$%$!&'(&)**+,($-../,0+)1.$+,$!203',$45+66/.$
!"#!$%$!&'(&)**+,($-../,0+)1.$+,$!203',$45+66/.$7'851/$9$:/.0
7'851/$9$:/.0
#,.;/&.
1. :3/$ /.<)=/$<3)&)<0/& $';/.$+0.$,)*/$0'$03/$>)<0$03)0$+0?
cannot be caught due to its high speed
escapes from source files into the computer memory
changes the meaning of the character next to it.
2. :3/$*/),+,($'>$03/$ ='.+0+',)1$=)&)*/0/& $+.$8/0/&*+,/8$@2$+0.?
name
appearance
position
3. :3/$*'.0$+*='&0),0$8+A/&/,</$@/0;//,$+,0/(/&$),8$B')0+,(C='+,0$,5*@/&.$1+/.$+,
03/$>)<0$03)0?
they are stored differently in the computer memory
they cannot be used simultaneously
integers cannot be literals, while floats can
4. :3/$
:3/$0x prefix means that the number after it is denoted as:
a decimal
a hexadecimal
an octal
5. :3/
:3/D$
D$// '=/&)0'&?
performs integer division
does not exist
performs regular division
6. :3/$&/.510$'>$03/$>'11';+,($)88+0+',?$
:3/$&/.510$'>$03/$>'11';+,($)88+0+',?$123 + 0.0
is equal to 123
is equal to 123.0
cannot be evaluated
7. E,12$',/$'>$03/$>'11';+,($.0)0/*/,0.$+.$0&5/$%$;3+<3$',/F
neither statement can be evaluated
multiplication precedes addition
addition precedes multiplication
8. G+(30C.+8/8$@+,8+,($*/),.$03)0$03/$>'11';+,($/H=&/..+',?D$
G+(30C.+8/8$@+,8+,($*/),.$03)0$03/$>'11';+,($/H=&/..+',?D$DD1 ** 2 ** 3 $D$;+11$@/
/I)15)0/8?
from left to right
in random order
from right to left
9. #$J/2;'&8$+.$)$;'&8$03)0?
is the most important word in the whole program
cannot be used as a variable name
is the key to the puzzle
10. #$I)15/$&/05&,/8$@2$03/D input ()DD$>5,<0+',$+.?
a float
an integer
a string
I
Lost
1111
240
power
2 ill
F I
a
121313T
E8 108
10214 112
4112 8
11 4 3
3104 0
4 0 1
AETN 2302 Applied Programming
Midterm
Sept 3, 2022
Select correct answer for the questions below (5 marks each total=100 marks)
1. What is a proper literals from the choices below?
a. “hello “007
b. “example” 17
c. “print” 9”
d. “your Name” “program”
2. What is the decimal value of 1011 binary number?
a. 22
b. 11
c. 20
d. 21
3. What is the output value for following Arithmetic operation program?
print ((2 ** 4), (2 * 4.), (2 * 4))
a. 16 8.0 8
b. 16 8 8.0
c. 8.0 16 8
d. 8 16 8.0
4. What is the output value for the following Arithmetic operation program?
print ((-2 / 4), (2 / 4), (2 // 4), (-2 // 4))
a. 4.0
b. 6.0 5 0.5 -0.5
c. 5 0.5 0 -5.0
d. -0.5 0.5 0 -1
5. What is the output of the following snippet?
print((2 % -4), (2 % 4), (2 ** 3 ** 2))
a. 215 2 2
b. 512 -2 2
c. -2 2 512
d. 2 -2 215
1
6. What is the output value for this following Arithmetic operation program?
print((5 * ((25 % 13) + 100) / (2 * 13)) // 2)
a. 11.0
b. 10.0
c. 11
d. 10
7. Variable name must begin with
a. Number
b. Letter
c. Underscore
d. Number or underscore
8. What is the output of the following snippet?
var = 1
account_balance = 1000.0
client_name = 'John Doe'
print(client_name, var * account_balance,)
print(var)
a. John Doe 1001.0
b. 1001.0 John Doe
c. John Doe 1000.0
d. John Doe
9. What is the output of the following snippet?
x = 3.0
y = 4.0
z = (x ** 2 + y ** 2) ** 0.5
print("z =", z)
a. z = 5.0
b. z=5
c. z = 89
d. z = 72
10. What is the output of the following snippet?
var = 9
var = 3
print(var)
2
a. 27
b. 12
c. 9
d. 3
11. What is the output of the following snippet?
a=6
b=3
a /= 2 * b
print(a)
a. 6.0
b. 6
c. 1.0
d. 12.0
12. What is the output of the following snippet?
x = int(input("Enter a number: ")) # The user enters 2
print(x * "5")
a. 65
b. 55.0
c. 55
d. 65.0
13. The escape character owes its name to the fact that it
a. Escape from source files into the computer memory
b. Cannot be caught due to its high speed
c. Changes the meaning of the character before to it
d. Changes the meaning of the character next to it
14. The most important difference between integer and floating-point numbers lies in the fact that
a. Integer cannot be literals, while float is
b. They stored differently in the Computer memory
c. They cannot be used simultaneously
d. Result between Integer and Float always be integer
15. Value returned by the input ( ) function is
a. String
b. an Integer
c. a float
d. a number
3
16. The input ( ) function is an example of a
a. User defined function
b. Predefined function
c. Built-in function
d. Module function
17. A block of code that performs a specific task is called
a. invoked
b. non-invoked
c. function
d. Decomposition
18. The two main version of Python are
a. Ver 2 and 3
b. Ver 1 and 2
c. Ver2 and 4
d. Ver 4 and 1
19. The meaning of the keyword parameter is determined by
a. Its position within the argument list
b. The argument’s name specified along with its value
c. Its connection with existing variables
d. Its value
20. What is the output of the following snippet?
z =7
y =5
x =3
x=y=z
print(x, y, z, sep= “ * “)
a. 3*3*3
b. 5*5*5
c. 3*5*7
d. 7*7*7
4
Home About Us "
ExamPoster
CISCO COMPTIA EC-COUNCIL MICROSOFT AMAZON CHECKPOINT F5 HUAWEI GOOGLE LPI-LINUX ITIL SANS PYTHON INSTITUTE
C++ INSTITUTE ALL EXAM
PE1 : Python Essentials 1 – Module 3 Test
Home » Python Institute » PE1 : Python Essentials 1: BASICS » PE1 : Python Essentials 1 – Module 3 Test
Last Updated on February 13, 2022 by Admin 2
Search
PE1 : Python Essentials 1 – Module 3 Test
Recent Posts
! PE : All Parts
What will happen when you attempt to
compile and run the following code?
Python Essentials What will happen when you attempt to
compile and run the following code?
PE1 : Python Essentials 1 PE2 : Python Essentials 2
PE1 : Module 1 Test PE2 : Module 1 Test
Meta
PE1 : Module 2 Test PE2 : Module 2 Test
PE1 : Module 3 Test PE2 : Module 3 Test Log in
Entries feed
PE1 : Module 4 Test PE2 : Module 4 Test
Comments feed
PE1 : Part 1 Summary Test PE2 : Part 2 Summary Test WordPress.org
Python Essentials — Final Test
1. How many stars (*) will the following snippet send to the console?
i = 0
while i <= 3 :
i += 2
print("+")
three
zero
one
two
2. After execution of the following snippet, the sum of the all vals elements will
equal to:
vals = [0, 1, 2]
vals.insert(0, 1)
del vals[1]
3
4
2
5
3. How many hashes( # ) will the following snippet send to the console?
for i in range(1):
print("#")
else:
print("#")
zero
three
two
one
4. How many hashes( # ) will the following snippet send to the console?
var = 0
while var < 6:
var += 1
if var % 2 == 0:
continue
print("#")
zero
three
two
one
5. What is the output of the following snippet?
my_list = [3, 1, -2]
print(my_list[my_list(-1)])
-2
-1
3
1
6. How many stars( # ) will the following snippet send to the console?
var = 0
while i <= 5:
i += 1
if vi % 2 == 0:
break
print("*")
three
two
one
zero
7. What is the output of the following snippet?
my_list = [1, 2, 3, 4]
print(my_list[-3:-2])
[2, 3]
[2, 3, 4]
[]
[2]
8. How many hashes( # ) will the following snippet send to the console?
var = 1
while var < 10:
print("#")
var = var << 1
two
eight
four
one
9. What is the output of the following snippet?
my_list_1 = [1, 2, 3]
my_list_2 = []
for v in my_list_1:
my_list_2.insert(0, v)
print(my_list_2)
[1, 2, 3]
[3, 2, 1]
[3, 3, 3]
[1, 1, 1]
10. Take a look at the snippet, and choose the true statements: (Select two answer)
nums = [1, 2, 3]
vals = nums
del vals[1:2]
nums is longer than vals
nums and vals are of the same length
nums and vals refer to the same list
nums is replicated and assigned to vals
11. What is the output of the following snippet?
my_list = [[0, 1, 2, 3] for i in rage(2)]
print(my_list[2][0])
1
2
0
the snippet will cause a runtime error
12. What value will be assigned to the x variable?
z = 10
y = 0
x = y < z and z > y or y > z and z < y
1
0
True
False
13. Which of the following sentences are true? (Select two answers)
nums = [1, 2, 3]
vals = nums[-1:-2]
nums and vals are two different lists
vals is longer than nums
nums and vals are of the same length
nums is longer than vals
14. What is the output of the following snippet?
a = 1
b = 0
c = a & b
d = a | be = a ^ b
print(c + d + e)
1
0
3
2
15. What is the output of the following snippet?
my_list = [1, 2, 3]
for v in range(len(my_list)):
my_list.insert(1, my_list[v])
print(my_list)
[1, 2, 3, 1, 2, 3]
[1, 2, 3, 3, 2, 1]
[1, 1, 1, 1, 2, 3]
[3, 2, 1, 1, 2, 3]
16. An operator able to check whether two values are equal is code as:
=
!=
==
===
17. The second assignment:
vals = [0, 1, 2]
vals[0], vlas[2] = vals[2], vals[0]
doesn’t change the list
reverses the list
shortens the list
extends the list
18. What is the output of the following snippet?
t = [[3-i for i in range (3)] for j in range (3)]
s = 0
for i in range(3):
s += t[i][i]
print(s)
4
7
02
6
19. The value eventually assigned to x is equal to :
x = 1
x = x == x
0
1
True
False
20. How many elements does the my_list list contain?
my_list = [i for i in range(-1, 2)]
two
three
four
one
! PE : All Parts
Python Essentials
PE1 : Python Essentials 1 PE2 : Python Essentials 2
PE1 : Module 1 Test PE2 : Module 1 Test
PE1 : Module 2 Test PE2 : Module 2 Test
PE1 : Module 3 Test PE2 : Module 3 Test
PE1 : Module 4 Test PE2 : Module 4 Test
PE1 : Part 1 Summary Test PE2 : Part 2 Summary Test
Python Essentials — Final Test
Copyright 2022 - ExamPoster
Home About Us "
ExamPoster
CISCO COMPTIA EC-COUNCIL MICROSOFT AMAZON CHECKPOINT F5 HUAWEI GOOGLE LPI-LINUX ITIL SANS PYTHON INSTITUTE
C++ INSTITUTE ALL EXAM
PE1 : Python Essentials 1 – Module 4 Test
Home » Python Institute » PE1 : Python Essentials 1: BASICS » PE1 : Python Essentials 1 – Module 4 Test
Last Updated on February 13, 2022 by Admin 2
Search
PE1 : Python Essentials 1 – Module 4 Test
Recent Posts
! PE : All Parts
What will happen when you attempt to
compile and run the following code?
Python Essentials What will happen when you attempt to
compile and run the following code?
PE1 : Python Essentials 1 PE2 : Python Essentials 2
PE1 : Module 1 Test PE2 : Module 1 Test
Meta
PE1 : Module 2 Test PE2 : Module 2 Test
PE1 : Module 3 Test PE2 : Module 3 Test Log in
Entries feed
PE1 : Module 4 Test PE2 : Module 4 Test
Comments feed
PE1 : Part 1 Summary Test PE2 : Part 2 Summary Test WordPress.org
Python Essentials — Final Test
1. Which of the following lines properly starts a function using two parameters, both
with zeroed default values?
def fun (a=b=0) :
def fun (a=0, b=0) :
fun fun (a=0, b) :
fun fun (a, b=0) :
2. What is the output of the following snippet?
def fun(x):
if x % 2 == 0:
return 1
else:
return
print(fun(fun(2)) + 1)
1
None
the code will cause a runtime error
2
3. Which of the following statement are true? (Select two answers)
The None value can be assigned to variables
The None value cannot be used outside functions
The None value can be used as an argument of arithmetic operators
The None value can be compared with variables
4. The following snippet:
def func_1(a):
return a ** a
def func_2(a):
return func_1(a) * func_1(a)
print(func_2(2))
will output 2
will output 16
will output 4
is erroneous
5. What code would you insert instead of the comment to obtain the expected output?
Expected output:
a
b
c
Code:
dictionary = {}
my_list = ['a', 'b', 'c', 'd']
for i in range(len(my_list) - 1):
dictionary[my_list[i]] = (my_list[i], )
for i in sorted(dictionary.key()):
k = dictionary[i]
# Insert your code here.
print(k["0"])
print(k['0'])
print(k)
print(k[0])
6. The following snippet:
def func(a, b):
return a ** a
print(func(2))
is erroneous
will output 2
will output 4
will return None
7. What is the output of thee following snippet?
def fun(inp=2, out=3):
return inp * out
print(fn(out =2))
2
6
4
the snippet is erroneous
8. Assuming that my_tuple is a correctly created tuple, the fact that tuples are
immutable means that the following instruction:
my_tuple[1] = my_tuple[1] + my_tuple[0]
can be executed if and only if the tuple contains at least two elements
is illegal
may be illegal if the tuple contains string
is fully correct
9. A function defined in the following way: (Select two answers)
def function(x=0):
return x
may be invoked with exactly one argument
must be invoked with exactly one argument
must be invoked without any argument
may be invoked without any argument
10. What is the output o the following snippet?
def fun(x):
x += 1
return x
x = 2
x = fun(x + 1)
print(x)
3
5
the code erroneous
4
11. What is the output of the following snippet?
my_list = ['Mary', 'had', 'a', 'little', 'lamb']
def my_list(my_list):
del my_list[3]
my_list[3] = 'ram'
print(my_list(my_list))
[‘Mary’, ‘had’, ‘a’ ,’lamb’]
[‘Mary’, ‘had’, ‘a’ ,’ram’]
[‘Mary’, ‘had’, ‘a’ ,’little’, ‘lamb’]
no output, the snippet is erroneous
12. What is the output of the following snippet?
def f(x):
if x == 0:
return 0
return x + f(x - 1)
print(f(3))
6
the code is erroneous
1
3
13. What is the output of the following snippet?
tup = (1, 2, 4, 8)
tup = tup[1:-1]
tup = tup[0]
print(tup)
the snippet is erroneous
(12)
(2, )
2
14. What is the output of the following snippet?
def fun(x):
global y
y = x * x
return y
fun(2)
print(y)
the code will cause a runtime error
4
None
2
15. What is the output of the following snippet?
dictionary = {'one': 'two', 'three': 'one', 'two': 'three'}
v = dictionary['one']
for k in range(len(dictionary)):
v = dictionary[v]
print(v)
three
one
(‘one’, ‘two’, ‘three’)
two
16. Select the true statements about the try-exception block in relation to the following
example. (Select two answers.)
try:
# Some code is here...
except:
# some code is here...
if you suspect that a snippet may raise an exception, you should place it in the try block
The code that follows the try statement will be executed if the code in the except clause
runs into an error.
The code that follows the except statement will be executed if the code in the try clause
runs into an error.
If there is a syntax error in code located in the try block, the except branch will not handle
it, and a SyntaxError exception will be raised instead.
17. Which one if the following lines properly starts a parameterless function definition?
def fun:
def fun():
function fun():
fun function():
18. What is the output of the following snippet?
def fun(x, y, x):
return x + 2 * y + 3 * z
print(fun(0, z=1, y=3))
9
0
3
the snippet is erroneous
19. What is the output of the following code?
try:
value = input("Enter a value: ")
print(value/value)
except:
print("Bad input...")
except ZeroDivisionError:
print("Very bad input...")
except TypeError:
print("Very very bad input...")
except:
print("Booo!")
Booo!
Bad input...
Very very bad input...
Very bad input...
20. What is the output of the following snippet?
def ant():
print(var + 1, end ='')
var = 1
any()
print(var)
12
22
11
21
21. The fact that tuples belong to sequence types means that:
they can be indexed and sliced like lists
they can be extended using the .append() method
they can be modified using the del instruction
they are actually lists
22. A built-in function is a function which:
is hidden from programmers
has been placed within your code by another programmer
has to be imported before use
comes with Python, ans is an integer part of Python
! PE : All Parts
Python Essentials
PE1 : Python Essentials 1 PE2 : Python Essentials 2
PE1 : Module 1 Test PE2 : Module 1 Test
PE1 : Module 2 Test PE2 : Module 2 Test
PE1 : Module 3 Test PE2 : Module 3 Test
PE1 : Module 4 Test PE2 : Module 4 Test
PE1 : Part 1 Summary Test PE2 : Part 2 Summary Test
Python Essentials — Final Test
Copyright 2022 - ExamPoster