Python Questions 1 to 20 MCQs | Python MCQs 01 |
1. Which character is used in Python to make a single-line comment?
7. If x=3.123, then int(x) will give ?
tom
sam
harry
- /
- //
- !
- #
- /
- //
- ''' '''
- #
- int
- float
- double
- integer
- int
- float
- str
- char
- int
- float
- str
- char
Solution:
⇛ Acording to precedence and associativity.
Step:1 first performed 3*5=15
Step:2 then, performed 15/5=3.0
[Note:In python, answer of division is always folat]
So, the ans is float.
⇛Output:
6. Which of the following is not a boolean expression?
- True
- 3==4
- 3+4
- 3+4==7
- 1
- 3
- 4
- 3.14
- int x
x=5 - int x=5
- x=5
- declare x=5
- abc=1,000,000
- a b c = 1000 2000 3000
- a,b,c=1000,2000,3000
- a_b_c=1,000,000
- 31 characters
- 63 characters
- 79 characters
- None
- _x = 1
- __x = 1
- __x__ = 1
- None of this
- __in__
- in
- it
- __it__
- char_1
- 1st_char
- oopec
- _
- True
- False
- ValueError
- TypeError
_ = '1 2 3 4 5 6' print(_)
- SyntaxError: EOL while scanning string literal
- SyntaxError: invalid syntax
- NameError: name '_' is not defined
- 1 2 3 4 5 6
tom
sam
harry
- print('''tom
\nsam
\nharry''') - print(”’tomsamharry”’)
- print(‘tom\nsam\nharry’)
- print('tom
sam
harry')
print(print(print("python")))
- None None python
- python
None
None - Python
- Error
word = "python" print(*word)
- python
- p y t h o n
- *python
- Error
- x^y
- x**y
- x^^y
- None of this
- 7
- 1
- 0
- 5
Comments
Post a Comment