Open In App

Python-Quizzes | Python String Quiz | Question 3

Like Article
Like
Save Article
Save
Share
Report issue
Report

Question 3: What is the output of the following program?




line = "I'll come by then."
eline = "" 
for i in line: 
    eline += chr(ord(i)+3
print(eline)     


(A) L*oo frph e| wkhq1
(B) L*oo#frph#e|#wkhq1
(C) l*oo@frph@e|$wkhq1
(D) O*oo#Frph#E|#wKhq1


Answer: (B)

Explanation: This piece of code ciphers the plain text. Each character is moved to its 3rd next character by increasing the ASCII value. ‘I’ becomes ‘L’, thus option (c) and (d) are ruled out. ‘ ‘ has an ASCII value of 32, thus it’ll become 35(‘#’), thus option (a) is ruled out as, ‘ ‘ cannot remain to be ‘ ‘ in the ciphered text.

Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 18 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads