0% found this document useful (0 votes)
54 views4 pages

Quiz Result

Uploaded by

codewithkunal2
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)
54 views4 pages

Quiz Result

Uploaded by

codewithkunal2
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/ 4

Basics of Python

Conditions and Functions of Python

Quiz Result

Quiz Completion Time : 00:15:59

Wrong/Skipped

Right Answer

Your Score : 67%

Passing Score : 50%

Areas to Focus:

Lesson - Python Conditional Loops

Lesson - Python Strings

Lesson - Python Functions & File Handling

1. “Why do programmers use functions in programming?”

Your Answer : To decrease code reusability

Correct Answer : To reduce redundancy and make the code more modular

Description : Functions help in reducing redundancy and make the code more modular, leading to better
code organization and reusability. Therefore, the correct answer is d) To reduce redundancy and make the

Page 1 of 4
code more modular.

Question Reference From : Python Functions & File Handling

2. Which arithmetic operators cannot be used with strings?

Your Answer :*

Correct Answer :–

Question Reference From : Python Strings

3. Which of the following functions is not a built-in function in Python?

Your Answer : user_input()

Description : The user_input() function is not a built-in function in Python. The other options, range(),
print(), and input(), are all examples of built-in functions that are already defined within the Python
language. Therefore, the correct answer is d) user_input().

Question Reference From : Python Functions & File Handling

4. >>>"abcd"[2:] (output of the line is….?

Your Answer : cd

Question Reference From : Python Strings

5. On assigning a value to a variable inside a function, it automatically becomes a global variable.

Your Answer : False

Question Reference From : Python Strings

6. In Python 3 , the maximum value for an integer is 263-1 .


Your Answer : False

Question Reference From : Python Conditional Loops

7. “Which operator is frequently used to access individual characters in a string in Python?”

Your Answer : []

Description : The slice operator [] is commonly used for accessing individual characters in a string in
Python.It can also be used to access a range of characters in a string, or to slice a string into multiple parts.

Question Reference From : Python Strings

8. What are the two main types of functions?


Your Answer : Built-in function & User defined function

Page 2 of 4
Question Reference From : Python Functions & File Handling

9. What character encoding is commonly used to represent characters in Python strings?

Your Answer : ASCII or Unicode encoding

Description : Python strings are typically encoded using ASCII or Unicode, enabling the representation of
a wide range of characters and symbols.

Question Reference From : Python Strings

10. “Which keyword indicates the alternative execution path in an if-else statement?”

Your Answer : else

Description : The else keyword is used in an if-else statement to specify the alternative execution path
when the condition in the if statement is not met.

Question Reference From : Python Conditional Loops

11. x = ‘abcd’ For i in x Print (i.upper())

Your Answer : abcd

Correct Answer : ABCD

Question Reference From : Python Conditional Loops

12. How is the syntax for an if-else statement structured in Python?

Your Answer : if {condition} {action} else {alternative action}

Correct Answer : if {condition}:


{action}
else:
{alternative action}

Description : In Python, the if-else statement is structured using the if keyword followed by a condition.
The block of code to be executed is indented under the if statement, and the alternative block of code for
the else statement is indented similarly.

Question Reference From : Python Conditional Loops

13. “How is the mutability of a string in Python described in terms of data structure?”

Your Answer : Mutable

Correct Answer : Immutable

Description : In Python, strings are considered immutable, meaning that their content cannot be modified
or altered once they are created.

Page 3 of 4
Question Reference From : Python Strings

14. What is a notable characteristic of Python functions that contributes to code reusability and better
organization?"

Your Answer : Functions allow for code reusability and better organization

Description : Functions in Python enable code reusability and help in organizing code, making it more
manageable and easier to maintain.

Question Reference From : Python Functions & File Handling

15. Is it accurate to say that Python strings can only be defined using single quotes (' ') and not double quotes
(" ")?
Your Answer : False

Description : Python strings can be defined using either single quotes (' '), double quotes (" "), or triple
quotes (''' ''' or """ """). All three forms of quotation marks are valid for creating strings in Python.

Question Reference From : Python Strings

Page 4 of 4

You might also like