Input and Output Operations in Python

Descrição

Coding Python Quiz sobre Input and Output Operations in Python, criado por PathaPadha Support em 27-10-2020.
PathaPadha Support
Quiz por PathaPadha Support, atualizado more than 1 year ago
PathaPadha Support
Criado por PathaPadha Support aproximadamente 4 anos atrás
928
0

Resumo de Recurso

Questão 1

Questão
What is the output of the following print() function print(sep='--', 'Ben', 25, 'California')
Responda
  • Syntax Error
  • Ben–25–California
  • Ben 25 California

Questão 2

Questão
What is the output of the following print() function ? print('%d %d %.2f' % (11, '22', 11.22))
Responda
  • 11 22 11.22
  • TypeError
  • 11 ’22’ 11.22

Questão 3

Questão
Use the following file to predict the output of the code. test.txt Content: aaa bbb ccc ddd eee fff ggg Code: f = open("test.txt", "r") print(f.readline(3)) f.close()
Responda
  • bbb
  • Syntax Error
  • aaa
  • aa

Questão 4

Questão
What will be displayed as an output on the screen x = float('NaN') print('%f, %e, %F, %E' % (x, x, x, x))
Responda
  • nan, nan, NAN, NAN
  • nan, NaN, nan, NaN
  • NaN, NaN, NaN, NaN,

Questão 5

Questão
What is the output of print('[%c]' % 65)
Responda
  • 65
  • A
  • [A]
  • Syntax Error

Questão 6

Questão
In Python3, Whatever you enter as input, the input() function converts it into a string
Responda
  • True
  • False

Questão 7

Questão
What is the output of print('%x, %X' % (15, 15))
Responda
  • 15 15
  • F F
  • f f
  • f F

Questão 8

Questão
Which of the following is incorrect file handling mode in Python
Responda
  • wb+
  • ab
  • xr
  • ab+

Questão 9

Questão
Which of the following is incorrect file handling mode in Python
Responda
  • r
  • x
  • t+
  • b

Questão 10

Questão
What is the output of the following code print('PYnative ', end='//') print(' is for ', end='//') print(' Python Lovers', end='//')
Responda
  • PYnative / is for / Python Lovers /
  • PYnative // is for // Python Lovers //
  • PYnative // is for // Python Lovers//
  • PYnative / is for / Python Lovers/

Questão 11

Questão
What is true for file mode x
Responda
  • create a file if the specified file does not exist
  • Create a file, returns an error if the file exists
  • Create a file if it doesn’t exists else Truncate the existed file

Questão 12

Questão
In Python3, which functions are used to accept input from the user
Responda
  • input()
  • raw_input()
  • rawinput()
  • string()

Semelhante

Python Quiz
karljmurphy
Think Python
tsilvo2001
Basic Python - Print Formatting
Rebecca Noel
What is Python?
Daniel Ingram
Python
54671
Know your Python!
educ8ict
Basic Python - Strings
Rebecca Noel
Study on IoT systems design
Tomasz Cieplak
Python
Kirstie Wu
OpenSource Programming
Faheem Ahmed
Basic Python - Lists
Rebecca Noel