Python/Python Mcq Set 16 Sample Test,Sample questions

adplus-dvertising

Question:
 In which direction is the turtle pointed by default?

1.North

2.South

3.East

4.West

Posted Date:-2022-01-02 02:43:41


Question:
 The function random.randint(4) can return only one of the following values. Which?

1. 4

2. 3.4

3. error

4.5

Posted Date:-2022-01-02 01:48:40


Question:
 What does print(os.geteuid()) print?

1.the group id of the current process

2. the user id of the current process

3.both the group id and the user of the current process

4.none of the mentioned

Posted Date:-2022-01-02 02:31:00


Question:
 What will be the output of the following Python code?

import sys
eval(sys.stdin.readline())
Computer

1.Error

2.‘Computer ’

3. Computer8

4.Computer

Posted Date:-2022-01-02 02:27:29


Question:
 What will be the output of the following Python code?

import sys
sys.stderr.write(“hello”)

1.‘hello’

2. ‘hello ’

3.hello

4.hello5

Posted Date:-2022-01-02 02:28:53


Question:
 What will be the output of the following Python code?

import sys
sys.stdin.readline()
Sanfoundry

1.‘Sanfoundry ’

2.‘Sanfoundry’

3. ‘Sanfoundry10’

4. Error

Posted Date:-2022-01-02 02:25:41


Question:
Fill in the blank such that the following Python code results in the formation of an inverted, equilateral triangle.

import turtle
t=turtle.Pen()
for i in range(0,3):
	t.forward(150)
	t.right(_____)

1. -60

2.120

3.-120

4.60

Posted Date:-2022-01-02 02:37:09


Question:
hat will be the output of the following Python code?
import turtle
t=turtle.Pen()
t.color(1,1,1)
t.begin_fill()
for i in range(0,3):
	t.forward(100)
	t.right(120)
              t.end_fill()

1.Blank page

2.A triangle filled in with the colour yellow

3.A triangle which is not filled in with any colour

4.error

Posted Date:-2022-01-02 02:42:25


Question:
The command used to set only the x coordinate of the turtle at 45 units is:

1. reset(45)

2.setx(45)

3.xset(45)

4.xreset(45)

Posted Date:-2022-01-02 02:53:18


Question:
The command which helps us to reset the pen (turtle):

1.turtle.reset

2. turtle.penreset

3.turtle.penreset()

4. turtle.reset()

Posted Date:-2022-01-02 02:36:41


Question:
The number of lines drawn in each case, assuming that the turtle module has been imported:

Case 1:
for i in range(0,10):
	turtle.forward(100)
	turtle.left(90)
Case 2:
for i in range(1,10):
	turtle.forward(100)
	turtle.left(90)

1.10, 9

2.9, 10

3.9, 9

4. 10, 10

Posted Date:-2022-01-02 02:36:11


Question:
The output of the function len(sys.argv) is _____

1.Error

2.1

3.0

4. Junk value

Posted Date:-2022-01-02 02:29:57


Question:
To obtain a list of all the functions defined under sys module, which of the following functions can be used?

1.print(sys)

2.print(dir.sys)

3.print(dir[sys])

4.print(dir(sys))

Posted Date:-2022-01-02 02:29:33


Question:
What does os.close(f) do?

1. terminate the process f

2. terminate the process f if f is not responding

3.close the file descriptor f

4.return an integer telling how close the file pointer is to the end of file

Posted Date:-2022-01-02 02:31:51


Question:
What does os.fchmod(fd, mode) do?

1.change permission bits of the file

2.change permission bits of the directory

3. change permission bits of either the file or the directory

4.none of the mentioned

Posted Date:-2022-01-02 02:32:16


Question:
What does os.getlogin() return?

1.name of the current user logged in

2.name of the superuser

3. gets a form to login as a different user

4.all of the mentioned

Posted Date:-2022-01-02 02:31:22


Question:
What does os.link() do?

1.create a symbolic link

2.create a hard link

3.create a soft link

4.none of the mentioned

Posted Date:-2022-01-02 02:33:29


Question:
What does os.name contain?

1. the name of the operating system dependent module imported

2.the address of the module os

3.error, it should’ve been os.name()

4. None of the mentioned

Posted Date:-2022-01-02 02:30:36


Question:
What does random.shuffle(x) do when x = [1, 2, 3]?

1. error

2.do nothing, it is a placeholder for a function that is yet to be implemented

3.shuffle the elements of the list in-place

4.none of the mentioned

Posted Date:-2022-01-02 01:50:51


Question:
What is the range of values that random.random() can return?

1.[0.0, 1.0]

2. (0.0, 1.0]

3.(0.0, 1.0)

4.[0.0, 1.0)

Posted Date:-2022-01-02 01:52:01


Question:
What the does random.seed(3) return?

1. True

2.None

3.3

4. 1

Posted Date:-2022-01-02 01:45:48


Question:
What will be the output of the following Python code, if the code is run on Windows operating system?

import sys
if sys.platform[:2]== 'wi':
	print("Hello")

1.Error

2. Hello

3.No output

4. Junk value

Posted Date:-2022-01-02 01:53:24


Question:
What will be the output of the following Python code, if the sys module has already been imported?

sys.stdout.write("hello world")

1.helloworld

2. hello world10

3. hello world11

4.error

Posted Date:-2022-01-02 02:24:25


Question:
What will be the output of the following Python code?

import sys
eval(sys.stdin.readline())
"India"

1. India5

2.India

3. ‘India ’

4.‘India’

Posted Date:-2022-01-02 02:26:38


Question:
What will be the output of the following Python code?

import sys
sys.argv[0]

1.Junk value

2.‘ ‘

3.No output

4.error

Posted Date:-2022-01-02 02:27:57


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
for i in range(0,4):
	t.forward(100)
	t.left(90)
 
t.penup()
t.left(90)
t.forward(200)
for i in range(0,4):
	t.forward(100)
	t.left(90)

1. Error

2. 1 square

3. 2 squares, at a separation of100 units, joined by a straight line

4.2 squares, at a separation of 100 units, without a line joining them

Posted Date:-2022-01-02 02:38:10


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
for i in range(0,5):
        t.left(144)
        t.forward(100)

1.Trapezium

2.Parallelepiped

3.Tetrahedron

4.Star

Posted Date:-2022-01-02 02:39:25


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.clear()
t.isvisible()

1.Yes

2.True

3.No

4.False

Posted Date:-2022-01-02 02:54:35


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.color(0,0,1)
t.begin_fill()
t.circle(15)
t.end_fill()

1.Error

2.A circle filled in with the colour red

3.A circle filled in with the colour blue

4. A circle filled in with the colour green

Posted Date:-2022-01-02 02:40:36


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.color(0,1,0)
t.begin_fill()
for i in range(0,4):
	t.forward(100)
	t.right(90)

1. A square filled in with the colour green

2.A square outlined with the colour green

3. Blank canvas

4.error

Posted Date:-2022-01-02 02:43:16


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.forward(100)
t.left(90)
t.clear()
t.position()

1.0.00, 90.00

2.0.00, 0.00

3.100.00, 90.00

4.100.00, 100.00

Posted Date:-2022-01-02 02:55:03


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.goto(300,9)
t.position()

1.300.00, 9.00

2. 9, 300

3. 300, 9

4.9.00, 300.00

Posted Date:-2022-01-02 02:38:59


Question:
What will be the output of the following Python code?

import turtle
t=turtle.Pen()
t.right(90)
t.forward(100)
t.heading()

1. 0.0

2.90.0

3.270.0

4.360.0

Posted Date:-2022-01-02 02:54:11


Question:
What will be the output of the following Python functions?

import turtle
t=turtle.Pen()
for i in range(0,3):
	t.forward(100)
	t.left(120)
 
t.back(100)
for i in range(0,3):
	t.forward(100)
	t.left(120)

1.Error

2.Two triangles, joined by a straight line

3.Two triangles, joined at one vertex

4.Two separate triangles, not connected by a line

Posted Date:-2022-01-02 02:39:49


Question:
What will be the output shape of the following Python code?

import turtle
t=turtle.Pen()
for i in range(0,4):
	t.forward(100)
	t.left(120)

1.square

2.rectangle

3.triangle

4.kite

Posted Date:-2022-01-02 02:35:08


Question:
What will be the output shape of the following Python code?

import turtle
t=turtle.Pen()
for i in range(1,4):
	t.forward(60)
	t.left(90)

1. Rectangle

2.Trapezium

3.Triangle

4. Square

Posted Date:-2022-01-02 02:37:36


Question:
Which of the following can be used to create a directory?

1.os.mkdir()

2.os.creat_dir()

3.os.create_dir()

4.os.make_dir()

Posted Date:-2022-01-02 02:33:55


Question:
Which of the following can be used to create a symbolic link?

1. os.symlink()

2.os.symb_link()

3.os.symblin()

4. os.ln()

Posted Date:-2022-01-02 02:34:20


Question:
Which of the following cannot be returned by random.randrange(4)?

1.0

2.3

3.2.3

4.none of the mentioned

Posted Date:-2022-01-02 01:47:07


Question:
Which of the following functions can be used to make the arrow black?

1.turtle.color(0,1,0)

2.turtle.color(1,0,0)

3.turtle.color(0,0,1)

4. turtle.color(0,0,0)

Posted Date:-2022-01-02 02:41:49


Question:
Which of the following functions can be used to read data from a file using a file descriptor?

1.os.reader()

2.os.read()

3.os.quick_read()

4.os.scan()

Posted Date:-2022-01-02 02:32:43


Question:
Which of the following functions does not accept any arguments?

1. position

2.fillcolor

3.goto

4. setheading()

Posted Date:-2022-01-02 02:38:37


Question:
Which of the following functions is not defined under the sys module?

1. sys.platform

2.sys.path

3. sys.readline

4.sys.argv

Posted Date:-2022-01-02 01:52:59


Question:
Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?

1.heading()

2.degrees()

3.position()

4.window_height()

Posted Date:-2022-01-02 02:53:47


Question:
Which of the following is equivalent to random.randint(3, 6)?

1. random.choice([3, 6])

2.random.randrange(3, 6)

3. 3 + random.randrange(3)

4. 3 + random.randrange(4)

Posted Date:-2022-01-02 01:49:30


Question:
Which of the following is equivalent to random.randrange(3)?

1. range(3)

2.random.choice(range(0, 3))

3.random.shuffle(range(3))

4. random.select(range(3))

Posted Date:-2022-01-02 01:47:33


Question:
Which of the following returns a string that represents the present working directory?

1.os.getcwd()

2. os.cwd()

3. os.getpwd()

4.os.pwd()

Posted Date:-2022-01-02 02:33:06


Question:
Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))?

1.0

2. 1

3.KeyError: 1

4.none of the mentioned

Posted Date:-2022-01-02 01:50:25


Question:
Which of the following will not be returned by random.choice(“1 ,”)?

1. 1

2. (space)

3. ,

4.none of the mentioned

Posted Date:-2022-01-02 01:49:56


Question:
Which type of elements are accepted by random.shuffle()?

1.strings

2.lists

3.tuples

4.integers

Posted Date:-2022-01-02 01:51:26


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
Search
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!