🌍 All Study Guides📊 Dashboard📰 Blog💡 About
IBM Applied AI to IBM AI Developer Professional Certificate • STUDY MODE

PRACTICE QUIZ

QUESTION 1 OF 34

What is the type of the following: 0 Explanation, as there is no decimal the number is of type int. You can also use the type function to verify your results.

A
float
B
intCorrect Answer
QUESTION 2 OF 34

What is the type of the following number: 3.12323 Explanation, as there is a decimal the number is of type float. You can also use the type function to verify your results.

A
floatCorrect Answer
B
int
QUESTION 3 OF 34

What is the result of the following: int(3.99) Explanation. In Python, if you cast a float to an integer, the conversion truncates towards zero, i.e.you just get rid of the numbers after the decimal place. So for 3.99 you just get rid of the ".99" leaving 3. PRACTICE QUIZ

A
3Correct Answer
B
3.99
QUESTION 4 OF 34

What is the result of the following operation: 11//2

A
5.5
B
5Correct Answer
Explanation:

this is correct, the symbol // means integer value. Therefore you must round the result down.

QUESTION 5 OF 34

what is the value of x after the following is run:

A
x=4
B
x=x/2
C
2.0Correct Answer
D
4.0
Explanation:

the value x=x/2 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 4 or x=4/2. We can also see that the result is a float. PRACTICE QUIZ

QUESTION 6 OF 34

What is the result of the following: Name[0] ( Image S3Q1 ) Explanation, The index 0 corresponds to the first index

A
"M"Correct Answer
B
"i"
C
"n"
QUESTION 7 OF 34

What is the result of the following: Name[-1] ( Image S3Q2 ) Explanation, the index -1 corresponds to the last index

A
"o"
B
"n"Correct Answer
C
"M"
QUESTION 8 OF 34

What is the output of the following: print("AB\nC\nDE") DE CD E C DE (CORRECT)

A
ABC
B
AB
C
AB
Explanation:

when the print function encounters a \n it displays a new line

QUESTION 9 OF 34

What is the result of following? "hello Mike".find("Mike") If you are unsure, copy and paste the code into Jupyter Notebook and check. Explanation, the method finds the starting index of a substring MODULE 1 GRADED QUIZ

A
6,7,8
B
5
C
6Correct Answer
QUESTION 10 OF 34

What is the value of x after the following lines of code? x=2 x=x+2

A
4Correct Answer
B
2
Explanation:

the value x=x+2 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 2 or x=2+2.

QUESTION 11 OF 34

What is the result of the following operation 3+2*2 ? Explanation, Python follows the standard mathematical conventions

A
3
B
7Correct Answer
C
9
QUESTION 12 OF 34

What is the result of the following code segment: type(int(12.3)) Explanation, in this code, we first cast or convert the float to an integer, then use the type function to determine the type

A
str
B
float
C
intCorrect Answer
QUESTION 13 OF 34

What is the result of the following code segment: int(True) Explanation, when you cast a boolean True to an integer you get a 1

A
1Correct Answer
B
0
C
error
QUESTION 14 OF 34

In Python, what is the result of the following operation: '1'+'2' ? Explanation, the '+' applied to strings does not add strings but concatenates them

A
3
B
'3'
C
'12'Correct Answer
QUESTION 15 OF 34

Given myvar = 'hello' , how would you return myvar as uppercase?

A
len(myvar)
B
myvar.find('hello')
C
myvar.upper()Correct Answer
QUESTION 16 OF 34

What is the result of the following : str(1)+str(1) ? Explanation, the integers are cast to a string, and the strings are concatenated

A
'11'Correct Answer
B
2
QUESTION 17 OF 34

What is the result of the following: "ABC".replace("AB", "ab") ? Explanation, the method replace returns a copy of the string with all occurrences of the old substring

A
'abC'Correct Answer
B
'ABc'
QUESTION 18 OF 34

In Python 3, what is the type of the variable x after the following: x=1/1 ? Explanation, in Python 3, regular division always results in a float

A
floatCorrect Answer
B
int
QUESTION 19 OF 34

What is the value of x after the following lines of code? x=1 x=x+1

A
1
B
2Correct Answer
C
4
Explanation:

the value x=x+1 changes the value of x, if x is assigned to its self. It's helpful to replace the value of x with its current value in this case 1 or x=1+1.

QUESTION 20 OF 34

What is the result of the following code segment: int(False) Explanation, when you cast a boolean False to an integer you get a 0

A
1
B
0Correct Answer
C
error
QUESTION 21 OF 34

What is the result of the following: 'hello'.upper() ? Explanation, upper returns a copy of the string in which all case-based characters have been converted to uppercase.

A
'HELLO'Correct Answer
B
'Hello'
C
'hello'
QUESTION 22 OF 34

What is the result of the following operation 1+3*2 ? Explanation, Python follows the standard mathematical conventions

A
7Correct Answer
B
12
C
8
QUESTION 23 OF 34

What is the result of the following : str(1+1) ? Explanation, the argument is first evaluated 1+1=2, then the result is cast to a string.

A
'2'Correct Answer
B
'11'
QUESTION 24 OF 34

What is the result of the following: "123".replace("12", "ab") ? Explanation, the method replace returns a copy of the string with all occurrences of the old substring

A
'ab3'Correct Answer
B
'123ab'
QUESTION 25 OF 34

What is the type of the following "7.1" Explanation, the type is string

A
float
B
stringCorrect Answer
QUESTION 26 OF 34

In Python 3, what is the type of the variable x after the following: x=2/2 ? Explanation, in Python 3, regular division always results in a float

A
floatCorrect Answer
B
int
QUESTION 27 OF 34

What is the type of the following: 0 

A
float
B
intCorrect Answer
QUESTION 28 OF 34

What is the type of the following number: 3.12323 

A
floatCorrect Answer
B
int
QUESTION 29 OF 34

What is the result of the following: int(3.99) 

A
3Correct Answer
B
3.99
QUESTION 30 OF 34

What is the result of the following operation:  11//2

A
5.5
B
5Correct Answer
QUESTION 31 OF 34

What is the result of the following: Name[0]

A
“M”Correct Answer
B
“i”
C
“n”
QUESTION 32 OF 34

What is the result of the following: Name[-1]

A
“M”Correct Answer
B
“i”
C
“n”
QUESTION 33 OF 34

What is the output of the following: print(“AB\nC\nDE”)

A
ABC
B
DE
C
AB
D
CD
E
E
F
C
QUESTION 34 OF 34

What is the result of following? 

A
6,7,8
B
5
C
6Correct Answer

Ready to test your recall?

What is the type of the following: 0 Explanation, as there is no decimal the number is of type int. You can also use the type function to verify your results.

A
float
B
int

How confident are you in this answer?