Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name:- Sakshi Jain #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Week 1/Python If-Else and For Loop(MCQs).md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Q1.What will the following code print out?
All done
- d)Small
All done
Answers:- d)Small

All done*


Q2.What will the following code will print out?
Expand All @@ -34,7 +36,7 @@ Q2.What will the following code will print out?
- b) -2 1 4
- c) -2 -1 0
- d) -2 1 5

Answers:- b) -2 1 4*
Q3.What is the value of x after the following nested for loop completes its execution?

x=0
Expand All @@ -47,18 +49,18 @@ Q3.What is the value of x after the following nested for loop completes its exec
- b) 90
- c) 99
- d) 9

Answers:- b) 90*
Q4. Which of the following is a valid for loop in Python?

- a) for(i=0; i < n; i++)
- b) for i in range(0,5):
- c) for i in range(0,5)
- d) for i in range(5)

Answers:- b) for i in range(0,5)*
Q5.When does the else statement written after loop executes?

- a) When break statement is executed in the loop
- b) When loop condition becomes false
- c) Else statement is always executed
- d) None of the above

Answers:- b) When loop condition becomes false*