In which direction is the turtle pointed by default?
1.North
2.South
3.East
4.West
The function random.randint(4) can return only one of the following values. Which?
1. 4
2. 3.4
3. error
4.5
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
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
What will be the output of the following Python code? import sys sys.stderr.write(“helloâ€)
1.‘hello’
2. ‘hello ’
3.hello
4.hello5
What will be the output of the following Python code? import sys sys.stdin.readline() Sanfoundry
1.‘Sanfoundry ’
2.‘Sanfoundry’
3. ‘Sanfoundry10’
4. Error
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
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
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)
The command which helps us to reset the pen (turtle):
1.turtle.reset
2. turtle.penreset
3.turtle.penreset()
4. turtle.reset()
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
The output of the function len(sys.argv) is _____
1.Error
2.1
3.0
4. Junk value
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))
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
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
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
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
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
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
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)
What the does random.seed(3) return?
1. True
2.None
3.3
4. 1
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
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
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’
What will be the output of the following Python code? import sys sys.argv[0]
1.Junk value
2.‘ ‘
3.No output
4.error
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
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
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
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
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
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
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
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
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
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
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
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()
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()
Which of the following cannot be returned by random.randrange(4)?
1.0
2.3
3.2.3
4.none of the mentioned
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)
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()
Which of the following functions does not accept any arguments?
1. position
2.fillcolor
3.goto
4. setheading()
Which of the following functions is not defined under the sys module?
1. sys.platform
2.sys.path
3. sys.readline
4.sys.argv
Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?
1.heading()
2.degrees()
3.position()
4.window_height()
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)
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))
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()
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
Which of the following will not be returned by random.choice(“1 ,â€)?
1. 1
2. (space)
3. ,
4.none of the mentioned
Which type of elements are accepted by random.shuffle()?
1.strings
2.lists
3.tuples
4.integers