SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Basic Python Programming
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. This keyword in the body of a conditional - gives an alternative execution.
del
%r
else
abs(a)
2. Function to empty the contents of a file - no recovery is possible
break
and
-=
truncate
3. adds an item to a list
def
class
int()
append()
4. This variable holds the arguments you pass to your Python script when you run it. Then you unpack it in your script so you have variables you can work with.
//=
insert()
argument variable
*=
5. Prints a string to the screen which will be Unicode.
%s
append()
*
%=
6. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101
>=
|
a//b
>>
7. Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y - here not in results in a 1 if x is a member of sequence y.
**=
*read
not in
=
8. An operator that removes a value from a list.
del
==
else
//=
9. Symbol to multiply things
not
for
*
raise
10. Greater than or equal symbol.
>=
print
=
file.truncate()
11. writes stuff to the file
%=
Variables
file.write(stuff)
-
12. absolute value
try
abs(a)
def
-
13. turns an object into a string
~
/
str()
/
14. The extension for Python scripts
a**b
.py
math.sqrt(a)
a%b
15. End header line.
:
^
#
+
16. floor division
argv
print()
n
a//b
17. ,multi-line comment hard-code,Fix (data or parameters) in a program in such a way that they cannot easily be altered by the user.
#
float
int()
18. Reads the contents of the file you can assign the result to a variable.
argument variable
round()
assignment
*read
19. Prevents a runtime error from stopping the program.
+=
str
:
except
20. returns the length of a string (number of characters)
len()
else
assignment
str
21. The keyword beginning a header that will create a loop.
:
for
is
**=
22. Turns a line into a comment instead of executable code.
int()
#
()
%s
23. A data type for representing numbers with fractional values.
abs(a)
%=
floating point number
24. Holds the value of something - e.g. oh_hi = 4 where oh_hi is the variable.
>>
insert()
Variables
%
25. This keyword attempts to do something that would cause the program to crash if it were not for this statement.
if
try
print
*=
26. A statement that displays a value on the screen.
except
//=
>=
print
27. Function to write something to a file
>
write
print
()
28. Symbol to subtract things from each other
pass
-
**=
**=
29. rounds a number to the number of decimal points you choose
round()
open()
**=
def
30. asks the user for a response and returns that response
input()
if
>>
//=
31. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011
is
~
if
-=
32. Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. a >> 2 will give 15 which is 0000 1111
close
/=
>>
del
33. Function to open or read a file
#
open()
file.truncate()
append()
34. End header line.
+
math.sqrt(a)
:
^
35. Adds something to a variable
while
readline
=
return
36. asks the user for a response and returns that response
open()
^
input()
read
37. Prints a string to the screen which is converted using repr()
readline
pass
~
%r
38. Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. a << 2 will give 240 which is 1111 0000
a%b
*
=
<<
39. Binary XOR Operator copies the bit if it is set in one operand but not both. (a ^ b) will give 49 which is 0011 0001
del
^
.py
>
40. Symbol used to create comments
<=
read
#
and
41. assignment operator
del
=
input()
>
42. exponentiation
argv
:
a**b
abs(a)
43. Symbol to subtract things from each other
=
in
int
-
44. This keyword in the body of a conditional allows chained conditionals.
/
str()
elif (Else if)
del
45. Less than symbol
int()
<
file.write(stuff)
insert()
46. single line comment
print()
readline
is not
#
47. A statement that assigns a value to a variable.
*
insert()
assignment
<
48. A logical operator which requires two expressions to both be true.
<
>
a//b
and
49. modulo
<<
a%b
format string
%
50. reads just one line of a text file & keeps track of where in the file you're at
floating point number
*write(stuff)
*
file.readline()