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. reads just one line of a text file & keeps track of where in the file you're at
file.readline()
|
readline
**=
2. An operator to check whether two variables refer to the same object.
~
if
>=
is
3. returns the length of a string (number of characters)
len()
-
print()
%d
4. This statement exits a function. The remaining lines of the function are not executed.
readline
return
input()
.py
5. Turns a line into a comment instead of executable code.
a**b
#
print()
argv
6. deletes an item from a list
+=
len()
.py
del
7. Symbol to multiply things
*
-=
^
close
8. square root
write
abs(a)
math.sqrt(a)
elif (Else if)
9. A statement that ends the current iteration of a loop but continues looping.
==
print()
continue
-
10. This keyword in the body of a conditional - gives an alternative execution.
else
&
+=
**=
11. Prints a string to the screen which is converted using repr()
:
//=
=
%r
12. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.
int
=
-
pass
13. writes stuff to the file
int()
+
=
file.write(stuff)
14. Greater than symbol
<<
is not
>
round()
15. Called Logical AND operator. If both the operands are true then then condition becomes true. (a and b) is true.
and
append()
insert()
-=
16. 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).
str()
is not
<<
-=
17. A statement that displays a value on the screen.
()
print
/
<
18. 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
=
*
^
<<
19. Adds a new line character
argument variable
or
%s
n
20. unction to read one line of a file
floating point number
.py
+=
readline
21. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101
in
%s
|
<=
22. This keyword attempts to do something that would cause the program to crash if it were not for this statement.
assignment
.py
def
try
23. Adds something to a variable
>=
=
%=
round()
24. 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
-=
>>
append()
file.readline()
25. Reads just one line of a text file.
-
==
*readline
argument variable
26. Prints a string to the screen which is a signed decimal.
%d
not
<
a//b
27. adds an item to a list
/=
argv
%d
append()
28. exponentiation
def
a**b
n
%
29. Greater than or equal symbol.
>=
^
Variables
a%b
30. Argument variable
>
<
argv
+
31. sets the file's current position
file.seek()
len()
math.sqrt(a)
a%b
32. Less than symbol
<
<<
%
while
33. Writes stuff to the file.
close
file.seek()
file.readline()
*write(stuff)
34. The keyword beginning a header that will create a new function.
%d
|
def
close
35. square root
%=
.py
/
math.sqrt(a)
36. modulo
a%b
%
%d
for
37. subtract AND assignment operator
*truncate
//=
elif (Else if)
-=
38. Symbol to add things together
truncate
~
+
close
39. A statement that breaks out of a loop.
readline
break
try
40. turns an object into an integer
int
int()
=
is
41. Adds something to a variable
else
=
*readline
.py
42. inserts an item inside a list at a certain index
-
insert()
<<
+=
43. This statement causes an exception.
raise
input()
()
#
44. exponent AND assignment operator
*read
**=
.py
round()
45. 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
^
<
not
len()
46. Holds the value of something - e.g. oh_hi = 4 where oh_hi is the variable.
Variables
def
argv
float
47. returns the length of a string (number of characters)
len()
print
for
readline
48. 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.
in
readline
argument variable
append()
49. adds an item to a list
+=
append()
readline
write
50. A data type for representing numbers with fractional values.
floating point number
*=
%d
math.sqrt(a)