hasattr() - correct answer ✔what method is used to safely check if a
class/object has a certain attribute
the first argument's value - correct answer ✔the first parameter of each
method is set by...
class X: - correct answer ✔the simplest possible class definition in python
can be expressed as:
except Exception as e: - correct answer ✔if you want to access and
exception object's components and store them in an object called e, you have
to use the following form of exception statement
s.write("Hello\n") - correct answer ✔there is a stream named s open for
writing. how do you write a line to the stream?
+ - correct answer ✔python strings can be "glued" together using the
operator:
the code is erroneous - correct answer ✔how many stars (*) does the
snippet print?
>s = '*****'
>s = s - s[2]
>print(s)
1 - correct answer ✔what is the value of the i variable when the loop
finishes?
, >i=0
>while i !=0:
->i=i-1
>else:
->i=i+1
<< and >> - correct answer ✔and operator able to perform bitwise shifts is
coded as
the variable becomes unavailable - correct answer ✔what is the value of the
i variable when the loop finishes its execution?
for i in range(10):
pass
check and execute the source code - correct answer ✔a compiler is a
program designed to:
two - correct answer ✔how many lines does the snippet output?
>for i in range(1,3):
->print("*",end="")
>else:
->print("*")
34.23 - correct answer ✔what is the value of the two literals .3423e2 and
3423e-2
3 - correct answer ✔what is the output of the snippet?