MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
chr( ord (’A’) )
A
A
B
B
C
a
D
error
Explanation: 

Detailed explanation-1: -Python ord() Function The ord() function returns the number representing the unicode code of a specified character.

Detailed explanation-2: -chr() function is a library function in Python, it accepts a value (ASCII code) and returns characters. Statement chr(ord(’A’)) evaluation – ord(’A’) will return 65 and then chr(65) will return character value of ASCII code 65, thus, it will return ‘A’.

Detailed explanation-3: -Python chr() and ord() By Vijaykrishna Ram / January 19, 2020 February 16, 2023. Python’s built-in function chr() is used for converting an Integer to a Character, while the function ord() is used to do the reverse, i.e, convert a Character to an Integer.

Detailed explanation-4: -Python ord() and chr() are built-in functions. They are used to convert a character to an int and vice versa. Python ord() and chr() functions are exactly opposite of each other.

There is 1 question to complete.