InfyTQ Control Structures (Python) Quiz 1

Question 1

Time: 00:00:00
A loop becomes infinite loop if a condition never becomes ________

False

False

True

True

True or NULL

True or NULL

Null

Null

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Python programming language allows to use one loop inside another loop known as?

switch

switch

nested

nested

foreach

foreach

forall

forall

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Does python have switch case statement?

False

False

True

True

Python has switch statement but we can not use it.

Python has switch statement but we can not use it.

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Can we write if/else into one line in python?

Yes

Yes

No

No

if/else not used in python

if/else not used in python

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is an iteration in programming?

Variable

Variable

Steps counter

Steps counter

Fixed value

Fixed value

Random value

Random value

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What will be output of this expression:
'p' + 'q' if '12'.isdigit() else 'r' + 's'

pq

pq

rs

rs

pqrs

pqrs

pq12

pq12

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
False = True
while True:
    print(False)
    True = False
   break

Predict the output:

True

True

False

False

1

1

None of these.

None of these.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
string = "abcdef"
While z in string:
    print(z, end=" ")

Guess the output :

a b c d e f

a b c d e f

abcdef

abcdef

Error

Error

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
string = "abcdef"

z = "a"
while z in string:
    print(z, end = " ")

The output of the code will be:

z z z z ……

z z z z ……

a a a a a……..

a a a a a……..

a b c d e f  

a b c d e f  

abcdef

abcdef

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
string = 'abcd'

for z in range(string):

    print(z)

Predict the output.

abcd

abcd

a b c d

a b c d

Error

Error

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments