Font size
WorksheetsPython
Total questions: 55
Worksheet time: 42mins
What is the output of this function?
print("www.cisco.com".lstrip("w."))
(a)
Which of these methods uses whitespace characters to convert a string into a list?
Convert
Seperate
Replace
Join
Split
What is the output of this function?
alpha = "abcde"
print(min(alpha))
(a)
What is the output of this function?
alpha = "abcde"
print(alpha + "f")
(a)
What is the output of this function?
i_am = 'I\'m'
print(len(i_am))
(a)
What is the output of this function?
print("aAbByYzZaA".index("Z"))
(a)
What is the output of this function?
alpha = "vwxyz"
print(min(alpha))
(a)
Which of these assertions would result in an error?
assert 'alpha' == 'alpha'
None of these would result in an error
assert 10 == '10'
All of these would result in an error
assert 5 < 10
What is the output of this function?
print("pythoninstitute.org".lstrip(".org"))
(a)
What is the output of this function?
print("zeta".endswith("et"))
(a)
What is the output of this function?
print("theta".find('ha'))
(a)
Which of these methods will attempt to center a string inside a field of a specified width?
orient
middle
center
justify
align
What is the output of this function?
alpha = "abdefg"
print(alpha[-5:5])
(a)
Which of these is NOT an ASCII character?
A
z
/
!
These are all ASCII characters
What is the result of the function print("SiGmA-60".lower()) ?
sigma60
sigma
sigma-60
sigma-
siGmA-60
What is the output of this function?
print("theta".find('eta'))
(a)
What is the output of this function?
print("theta theta".rfind('the'))
(a)
What is the output of this function?
alphabet = "abcdefghijklmnopqrstuvwxyz"
print("f" not in alphabet)
(a)
What is the output of this function?
empty = "" print(len(empty))
(a)
What feature builds in additional alphabets to the ASCII database?
Universality
pip
Internationalization
Plugins
Dictionaries
Which of these functions will convert a code point value into a character?
chr
code
ordinal
ord
character
What is the result of the function print('aBcD'.capitalize()) ?
AbCd
abcD
Abcd
abcd
ABCD
What is the output of this function?
print(",".join(["omicron", "pi", "rho"]))
(a)
What is the output of this function?
alphabet = "abcdefghijklmnopqrstuvwxyz"
print("F" in alphabet)
(a)
What is the output of this function?
print("www.wisco.com".lstrip("w."))
(a)
What is the output of this function?
print('alpha' == 'alpha')
(a)
What is the output of this function?
print("www.wisco.com".rstrip(".com"))
(a)
Which of these keywords can be used to manually call an exception?
stop
raise
call
exception
error
Which of these functions will convert an entity into a list?
iterate
list
convert
items
separate
What is the output of this function?
greek = ['omega', 'alpha', 'pi', 'gamma']
print(sorted(greek)[-1])
(a)
Which of these terms refers to the brief result of the platform function?
brief
terse
short
alias
concise
What command displays the current pip version?
pip
pip software
pip show
pip --version
pip help
Why are random numbers in computing referred to as pseudorandom?
Random is reserved for nature, where pseudorandom is reserved for science
The numbers produced can only be valued between 1 and 100
Their values are determined using a pre-defined algorithm
The algorithm that produces the numbers only accepts positive values
The random values are hand-coded by an administrator
How would you load just the sin function from the math module using sine as an alias?
(a)
The Python Package Index is located at what site?
A random number generator uses what value in combination with an algorithm to produce a pseudorandom number?
the current CPU frequency
the current time
the current username
a seed value
the current PSU wattage
What function is used to modify a random number generator's algorithm's base value?
time
psu
seed
user
cpu
What keyword in a program allows a module to become usable?
try
start
load
import
init
How would you load just the pi variable from the math module using x as an alias?
(a)
What variable can be used to determine whether a program is being run directly or as a module?
__module__
__script__
__python__
__program__
__name_ _
Which of these variables contains a list of directories that Python searches for modules in?
ls
folders
list
dir
path
How would you load just the pi variable from the math module?
(a)
Which of these functions will display a list of a module's contents?
dir
help
show
list
ls
What command displays more information about the installed package pygame?
pip list pygame
pip all pygame
pip show pygame
pip display pygame
pip help pygame
Write a print function to show the variable tau from the math module.
(a)
What is returned by the python_implementation function when used on a standard Python install?
Python
CPython
py
Pypi
JPython
What is the highest possible number produced by this function?
print(randrange(0 , 100))
(a)
A piece of software required by another piece of software is referred to as a what?
base requirement
runtime
OS
dependency
library
What command displays all packages installed with pip?
pip help
pip all
pip list
pip show
pip packages
What character is used to browse down into subfolders within a package?
.
~-
_
/
Write a print function to show the variable pi from the math module.
(a)
What subfolder is created when loading a module?
__ init __
__package__
__python__
__pycache__
__module__
What file is required to be at the base directory of a python package?
__base__.py
__program__.py
__package__.py
__script__.py
__init.py__
What is the highest possible number produced by this function?
print(randrange(1 , 10))
(a)
How would you load the random module?
(a)
