Python/MCQ Introduction to Python Section 1 Sample Test,Sample questions

Question:
 Which of the following is not a token?

1.//

2.“X”

3.##

4.23


Question:
 Write the output of the following code :
>>> s = None
>>> s

1.Nothing will be printed

2.None

3.Shows Error

4.None of the above


Question:
An escape sequence is represented by __________ slash followed by one or two characters.

1.back

2.forward

3.double

4.None of the above


Question:
Each statement in python is terminated by ___

1.Semicolon(;)

2.Colon(:)

3.Comma(,)

4.None of the above


Question:
Identifier name can be of maximum ____________ character

1.63

2.79

3.53

4.any number of


Question:
Identify the invalid identifier.


b. 

c. 

d. 

1.Keyword

2.token

3.operator

4.and


Question:
Operators of same precedence are executed from _____

1.left to right

2.right to left .

3.in any order

4.None of the above


Question:
Output of print(7 % 21) is ____

1.3

2.7

3.Error

4.None of the above


Question:
Smallest element of of python coding is called ________

1.Identifiers

2.Token

3.Keywords

4.Delimiters


Question:
Statement below “function definition” begin with spaces called ____

1.Indentation

2.Condition

3.Definition

4.None of the above


Question:
What type of error is returned by the following statement?
def abc(a):
print(a)

1.ErrorIndentation

2.IndentationError

3.SpaceError

4.No error in the given statement


Question:
What type of error is returned by the following statement?
print(eval(13))

1.SyntaxError

2.TypeError

3.ValueError

4.No Error in this statement


Question:
What will be the data type of the following variable?

1.= ‘101’

2.Integer

3.String

4.Float


Question:
Which keyboard key is used to run python programs?

1.F6

2.F5

3. F + n

4.Ctrl + r


Question:
Which keyword is used to define a function in python?

1.def

2.define

3.new

4.None of the above


Question:
Which method is used to find the memory location of variable?

1.id( )

2.add( )

3.type( )

4.None of the above


Question:
Which of the following assignment will return error?

1.a = b = c = 89

2.a = 6, b = 8

3. a, b, c = 1, 2, 3

4.None of the above


Question:
Which of the following can not be used as an identifier?

1.eval

2.max

3.pass

4.All the above


Question:
Which of the following is invalid identifier?

1._

2._1st

3.1stName

4.While


Question:
Which of the following is invalid variable name?
a. 

1.Sum1

2. Num_1

3. Num1

4. N1


Question:
Which of the following is not correct about python?

1.Python is an open source language.

2.Python is based on ABC language.

3.Python is developed by Guido Van Rossum

4.None of the above


Question:
Which of the following is not correct about python?

1.Python is an open source language.

2.Python is based on ABC language.

3.Python is developed by Guido Van Rossum

4.None of the above


Question:
Which of the following is not in Python Character Set.

1.Letters : A-Z or a – z

2.Digits : 0 – 9

3.Whitespaces : blank space, tab etc

4.Images : Vector


Question:
Which of the following is not the mode of interacting with python?

1.Interactive Mode

2.Script Mode

3.Hybrid Mode

4.None of the above


Question:
Which of the following is valid operator?

1.in

2.on

3.it

4.at


Question:
Which of the following is wrong in reference to naming of variable?

1.Keywords are not allowed for variable names.

2.Spaces are not allowed for variable names.

3.ariable names can start from number.

4.Special symbols are not allowed


Question:
Which of the following statement is calculating x raise to power n?

1.x * n

2.x ** n

3.n ** x

4.x ^ n


Question:
Which of the following symbol is used to write comment?

1.?

2.//

3.#

4.**


Question:
Which statement is adding remainder of 8 divided by 3 to the product of 5 and 6?

1.8 % 3 + 5 * 6

2.8/3 + 5 * 6

3.8 // 3 + 6.5

4.None of the above


Question:
Which statement will display square of number (n)

1.print(n * n)

2. print(math.pow(n,2)) # math module is already imported

3.All of the above

4.Only First


Question:
Write the output of the following code :
>>> 7+2//1**2 > 5+2**2//3
a. 

b. 

1.True

2.False

3.Error

4.None of the above


Question:
Write the output of the following code :
>>> a=9
>>> x=str(a)
>>> b=5
>>> y=str(b)
>>> x+y

1.14

2.9.5

3.9

4.None of the above


Question:
Write the output of the following code :
>>> x = 4 - 7j
>>> print(x.imag, x.real)

1.4.0 -7.0

2.-7.0 4.0

3.Error

4.None of the above


Question:
Write the output of the following code :
x=2
y=3
x+y+5
print(x+y)

1.10

2.5

3.Error

4.None of the above


Question:
Write the output of the following code:
x=2
x=5
x=x+x
print(x)

1.7

2.4

3.10

4.error


Question:
Write the output of the following.
def abc():
     print("abc")

1. abc

2.Error

3.0

4. No Output


Question:
Write the output of the following.
m, n, p = 1, 2, 3
print(m, n, p)

1.1, 2, 3

2.1 2 3

3.Print 1, 2 and 3 vertically

4.Error


Question:
Write the output of the following:
a=8
def abc(a):
      print(a)
abc(7)

1.8

2.Error

3.No Output

4.7


Question:
Write the output of the following:
print(‘Hello, world!’);print(“H”)

1.Hello world H

2.Hello worldH

3.Hello world H

4.error


Question:
Write the output of the following:
print(range(0,8,2))

1.0,2,4,6

2.range(0, 8, 2)

3.Error

4.None of the above


Question:
___ spaces should be left for indentation.

1.3

2.4

3.5

4.0


Question:
____________ escape sequence is used for horizontal tab.
a. 


b. 	

c. T

d. No

1./n

2./t

3.T

4.No


Question:
________________ method is used to find the data type of a variable.

1. type( )

2.dtype( )

3. typed( )

4.None of the above


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Python Practice Papers
  53. python mcq question and answer
  54. Test
Learn MCQ Introduction to Python Section 1,Learn Python Objetive choice questions and answers,Python Multiple choice questions and answers,Python objective, Python questions , Python answers,Python MCQs questions and answer
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!