Question-15: How do you represent octal number in Python program?

  1. Number should start with 0x (Zero-x)
  2. Number should start with x0 (x-zero)
  3. Number should start with O-0 (O-zero)
  4. Number should start with 0-O (zero-O)

Answer: D

Exp:  

Octal Numbers

  • If Number value is preceded by (0-o), which is zero and “O” . It represent octal values.
  • Octal values can hold each integer value between 0 to 7

print(0o444)

print(0o666)

print(0o777)

  • If you use value bigger than 7, it would give error.

print(0o888)

 

Hexadecimal number

  • This should be preceded by 0X (Zero-X)

print(0x44)

print(0X666)

print(0x777)

print(0x15)

 

 

Why Dont you prepare for Python Certifications and Interview Questions with 250+ Questions and Answer : Check Here

Real Exam Number of Questions: 70 Questions
Real Exam Pass Score: 70%
Time Allotted: 90 minutes to complete exam