0% found this document useful (0 votes)
21 views

quiz_result (1)

Uploaded by

smhsiam79
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)
21 views

quiz_result (1)

Uploaded by

smhsiam79
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:08:23

Wrong/Skipped

Right Answer

Your Score : 80%

Passing Score : 50%

Your Strong Areas:

Lesson - Python Conditional Loops

Lesson - Python Strings

Lesson - Python Functions & File Handling

1. Is it true to say that Python strings are considered mutable, allowing their contents to be modified after
creation?

Your Answer : False

Description : Python strings are considered immutable, meaning that their contents cannot be changed
after they are created. Any attempt to modify a string results in the creation of a new string.

Page 1 of 4
Question Reference From : Python Strings

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

Your 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

3. Which keyword is used for function?

Your Answer : Def

Question Reference From : Python Functions & File Handling

4. >>>print('new' 'line') (output of the line is….?

Your Answer : Output equivalent to print ‘new\nline’

Correct Answer : Newline

Question Reference From : Python Strings

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


Your Answer : aBCD

Correct Answer : ABCD

Question Reference From : Python Conditional Loops

6. Which method of a stack adds a new element to the end of the stack?

Your Answer : Push()

Description : The Push() method in a stack adds a new element to the end of the stack, maintaining the Last
In First Out (LIFO) order.

Question Reference From : Python Strings

7. What is called when a function is defined inside a class?

Your Answer : Method

Question Reference From : Python Functions & File Handling

Page 2 of 4
8. 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

9. Strings are immutable in Python, which means that it cannot be modified.

Your Answer : True

Question Reference From : Python Strings

10. “How are strings generally declared in Python?”

Your Answer : Using single, double, or triple quotations

Description : Strings in Python are typically defined by enclosing a character or a sequence of characters in
single, double, or triple quotations.

Question Reference From : Python Strings

11. Which of the following is the use of function in python?


Your Answer : Functions are reusable pieces of programs

Question Reference From : Python Functions & File Handling

12. What are the two main types of functions?

Your Answer : Built-in function & User defined function

Question Reference From : Python Functions & File Handling

13. The output of executing string.ascii_letters can also be achieved by:


Your Answer : string.ascii_lowercase+string.ascii_uppercase

Question Reference From : Python Strings

14. "Which keyword is employed to commence a conditional statement in Python?

Your Answer : if

Description : The if keyword is used to start a conditional statement in Python, which allows the execution
of a block of code based on the evaluation of a specified condition.

Question Reference From : Python Conditional Loops

Page 3 of 4
15. What is the output of the code? True = False While True : Print(True) Break

Your Answer : True

Correct Answer : None

Question Reference From : Python Conditional Loops

Page 4 of 4

You might also like