0% found this document useful (0 votes)
131 views6 pages

Module 1

Nil

Uploaded by

Nagamani V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views6 pages

Module 1

Nil

Uploaded by

Nagamani V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Graded Quiz due Jun 4, 2024 13:24 IST

Question 1
1/1 point (graded)
After executing the following lines of code, what value does x hold?

x=1

x=x+1


Answer
Correct:
The value x = x + 1 changes the value of x when it's self-assigned. It proves beneficial to update x
with its current value, such as x = 1 + 1 in this scenario.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 2
1/1 point (graded)
What is the output of the following operation 1+3*2?

10

12

7

Answer
Correct: Python follows the standard mathematical conventions.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 3
1/1 point (graded)
What data type does the value "7.1" represent?

Character

Float

String

Integer


Answer
Correct: As the element is enclosed in quotes, it is a string type.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 4
1/1 point (graded)
What is the output of the following code segment? int(False)

False

Error
1


Answer
Correct: Converting a Boolean False to an integer results in the value 0.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 5
1/1 point (graded)
In Python, what is the output of the following operation: '5'+'6'?

'5'

'11'

'56'

11


Answer
Correct:
When the '+' operator is used with strings, it does not add them together like it does with
numbers. Instead, it concatenates them, meaning it joins them together to form a new string.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 6
1/1 point (graded)
Given myvar = 'hello', how would you return myvar as uppercase?

upper(myvar)
myvar.find('hello')

myvar.upper()

len(myvar)


Answer
Correct:
The upper method returns a copy of the string in which all case-based characters have been
converted to uppercase.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 7
1/1 point (graded)
What is the output of the following: str(1)+str(1)?

11

'2'

'11'


Answer
Correct: It converts the integers into strings and then concatenates these strings.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 8
1/1 point (graded)
What is the output of the following: "ABC".replace("AB", "ab")?

‘abc’

'ABc'

‘ABC’

'abC'


Answer
Correct:
The replace method returns a copy of the string by substituting all instances of the old substring.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

Question 9
1/1 point (graded)
After the operation x = 2/2 in Python 3, what data type does variable x hold?

char

int

str

float


Answer
Correct: Regular division in Python 3 always produces a float as the result.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)


Question 10
1/1 point (graded)
For the string “Fun Python” stored in a variable , what will be the output of ?

‘Fun P’

'Python'

'Pytho'

Error


Answer
Correct: The code will return ‘Fun P’.

Submit You have used 1 of 2 attempts

 Correct (1/1 point)

You might also like