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. Prints a string to the screen which is converted using repr()
+
#
argument variable
%r
2. 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
in
<<
argv
abs(a)
3. Function to empty the contents of a file - no recovery is possible
file.write(stuff)
~
%=
truncate
4. rounds a number to the number of decimal points you choose
round()
file.truncate()
^
&
5. A logical operator which compares two operands and produces True if they are equal and False otherwise
for
/=
del
==
6. Empties the file - watch out if you care about the file.
a**b
truncate
*truncate
readline
7. returns the length of a string (number of characters)
len()
str()
pass
argv
8. turns an object into a string
*=
str()
len()
#
9. Command to print to the screen
<<
print
*=
=
10. 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
n
+=
file.write(stuff)
^
11. Prints a string to the screen which is converted using repr()
-=
continue
del
%r
12. inserts an item inside a list at a certain index
insert()
*
len()
in
13. Holds the value of something - e.g. oh_hi = 4 where oh_hi is the variable.
write
()
Variables
14. Less than symbol
<
append()
pass
n
15. Evaluates to true if it finds a variable in the specified sequence and false otherwise. x in y - here in results in a 1 if x is a member of sequence y.
truncate
abs(a)
in
readline
16. A statement that breaks out of a loop.
-=
break
truncate
file.seek()
17. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011
-
*readline
~
a//b
18. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. x is not y - here is not results in 1 if id(x) is not equal to id(y).
else
is not
file.write(stuff)
()
19. Command to print to the screen
print
write
#
==
20. 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
*=
>>
a%b
elif (Else if)
21. Adds something to a variable
=
write
else
for
22. Greater than symbol
>
write
file.readline()
%d
23. modulus AND assignment operator
+=
%=
//=
#
24. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101
|
a**b
print
>
25. 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.
>>
%r
argument variable
readline
26. This keyword creates a new class object which is a user-defined type - like a factory for creating objects.
>>
a%b
write
class
27. Function to read the contents of a file
open()
and
#
read
28. Symbol to add things together
len()
=
a**b
+
29. add AND assignment operator
+=
%
-=
<<
30. Argument variable
argv
insert()
float
%=
31. returns the length of a string (number of characters)
abs(a)
write
len()
&
32. absolute value
^
abs(a)
^
and
33. Greater than or equal symbol.
try
floating point number
>=
class
34. inserts an item inside a list at a certain index
len()
insert()
argument variable
argv
35. modulus AND assignment operator
append()
%=
break
/
36. This keyword begins the simplest form of a conditional statement.
int
#
if
readline
37. Prints a string to the screen which is a signed decimal.
del
%d
()
for
38. A logical operator which negates an expression so that it returns a value of True if the expression is false.
not
()
|
del
39. single line comment
a//b
#
is
for
40. Symbol to subtract things from each other
file.write(stuff)
str()
str()
-
41. Function to empty the contents of a file - no recovery is possible
for
elif (Else if)
truncate
*truncate
42. Turns a line into a comment instead of executable code.
file.truncate()
//=
abs(a)
#
43. floor division
round()
a//b
not
break
44. The keyword beginning a header that will create a new function.
print
#
def
assignment
45. The keyword beginning a header that will create a loop.
.py
*truncate
for
int
46. The extension for Python scripts
file.seek()
.py
else
or
47. Symbol to subtract things from each other
=
-
not
try
48. multiply AND assignment operator
=
*=
file.truncate()
==
49. add AND assignment operator
>
+=
.py
~
50. Argument variable
argv
*read
print
<=