

MCQOPTIONS
Saved Bookmarks
This section includes 1007 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
251. |
The command used to set only the x coordinate of the turtle at 45 units is: |
A. | reset(45) |
B. | setx(45) |
C. | xset(45) |
D. | xreset(45) |
Answer» C. xset(45) | |
252. |
In which direction is the turtle pointed by default? |
A. | North |
B. | North |
C. | East |
D. | West |
Answer» D. West | |
253. |
What is the output of the code shown below? 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) |
A. | A square filled in with the colour green |
B. | A square outlined with the colour green |
C. | Blank canvas |
D. | Error |
Answer» D. Error | |
254. |
What is the output of the code shown? 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() |
A. | Blank page |
B. | A triangle filled in with the colour yellow |
C. | A triangle which is not filled in with any colour |
D. | Error |
Answer» B. A triangle filled in with the colour yellow | |
255. |
Which of the following functions can be used to make the arrow black? |
A. | turtle.color(0,1,0) |
B. | turtle.color(1,0,0) |
C. | turtle.color(0,0,1) |
D. | urtle.color(0,0,0) |
Answer» E. | |
256. |
The output of the code shown below: import turtle t=turtle.Pen() t.color(0,0,1) t.begin_fill() t.circle(15) t.end_fill() |
A. | Error |
B. | A circle filled in with the colour red |
C. | A circle filled in with the colour blue |
D. | A circle filled in with the colour green |
Answer» D. A circle filled in with the colour green | |
257. |
What is the output of the functions shown below? 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) |
A. | Error |
B. | Two triangles, joined by a straight line |
C. | Two triangles, joined at one vertex |
D. | Two separate triangles, not connected by a line |
Answer» D. Two separate triangles, not connected by a line | |
258. |
What is the output of the code shown below? import turtle t=turtle.Pen() for i in range(0,5): t.left(144) t.forward(100) |
A. | Trapezium |
B. | Parallelepiped |
C. | Tetrahedron |
D. | Star |
Answer» E. | |
259. |
What are the outcomes of the code shown below? import turtle t=turtle.Pen() t.goto(300,9) t.position() |
A. | 300.00, 9.00 |
B. | 9, 300 |
C. | 300, 9 |
D. | 9.00, 300.00 |
Answer» B. 9, 300 | |
260. |
Which of the following functions does not accept any arguments? |
A. | position |
B. | fillcolor |
C. | goto |
D. | setheading() |
Answer» B. fillcolor | |
261. |
What is the output of the following 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) |
A. | Error |
B. | 1 square |
C. | 2 squares, at a separation of100 units, joined by a straight line |
D. | 2 squares, at a separation of 100 units, without a line joining them |
Answer» C. 2 squares, at a separation of100 units, joined by a straight line | |
262. |
What will be the output shape of the code shown below? import turtle t=turtle.Pen() for i in range(1,4): t.forward(60) t.left(90) |
A. | Rectangle |
B. | Trapezium |
C. | Triangle |
D. | Square |
Answer» E. | |
263. |
Fill in the blank such that the code shown below 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(_____) |
A. | -60 |
B. | 120 |
C. | -120 |
D. | 60 |
Answer» C. -120 | |
264. |
The command which helps us to reset the pen (turtle): |
A. | turtle.reset |
B. | turtle.penreset |
C. | turtle.penreset() |
D. | turtle.reset() |
Answer» E. | |
265. |
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) |
A. | 10, 9 |
B. | 9, 10 |
C. | 9, 9 |
D. | 10, 10 |
Answer» B. 9, 10 | |
266. |
What is the output shape of the code shown? import turtle t=turtle.Pen() for i in range(0,4): t.forward(100) t.left(120) |
A. | square |
B. | rectangle |
C. | triangle |
D. | kite |
Answer» D. kite | |
267. |
Which of the following can be used to create a symbolic link? |
A. | os.symlink() |
B. | os.symb_link() |
C. | os.symblin() |
D. | os.ln() |
Answer» B. os.symb_link() | |
268. |
Which of the following can be used to create a directory? |
A. | os.mkdir() |
B. | os.creat_dir() |
C. | os.create_dir() |
D. | os.make_dir() |
Answer» B. os.creat_dir() | |
269. |
What does os.link() do? |
A. | create a symbolic link |
B. | create a hard link |
C. | create a soft link |
D. | none of the mentioned |
Answer» C. create a soft link | |
270. |
Which of the following returns a string that represents the present working directory? |
A. | os.getcwd() |
B. | os.cwd() |
C. | os.getpwd() |
D. | os.pwd() |
Answer» B. os.cwd() | |
271. |
Which of the following functions can be used to read data from a file using a file descriptor? |
A. | os.reader() |
B. | os.read() |
C. | os.quick_read() |
D. | os.scan() |
Answer» C. os.quick_read() | |
272. |
What does os.fchmod(fd, mode) do? |
A. | change permission bits of the file |
B. | change permission bits of the directory |
C. | change permission bits of either the file or the directory |
D. | none of the mentioned |
Answer» B. change permission bits of the directory | |
273. |
What does os.close(f) do? |
A. | terminate the process f |
B. | terminate the process f if f is not responding |
C. | close the file descriptor f |
D. | return an integer telling how close the file pointer is to the end of file |
Answer» D. return an integer telling how close the file pointer is to the end of file | |
274. |
What does os.getlogin() return? |
A. | name of the current user logged in |
B. | name of the superuser |
C. | gets a form to login as a different user |
D. | all of the above |
Answer» B. name of the superuser | |
275. |
What does print(os.geteuid()) print? |
A. | the group id of the current process |
B. | the user id of the current process |
C. | both the group id and the user of the current process |
D. | none of the mentioned |
Answer» C. both the group id and the user of the current process | |
276. |
What does os.name contain? |
A. | the name of the operating system dependent module imported |
B. | the address of the module os |
C. | error, it should’ve been os.name() |
D. | none of the mentioned |
Answer» B. the address of the module os | |
277. |
The output of the function len(sys.argv) is ____________ |
A. | Error |
B. | 1 |
C. | 0 |
D. | Junk value |
Answer» C. 0 | |
278. |
To obtain a list of all the functions defined under sys module, which of the following functions can be used? |
A. | print(sys) |
B. | print(dir.sys) |
C. | print(dir[sys]) |
D. | print(dir(sys)) |
Answer» E. | |
279. |
What is the output of the code shown below? import sys sys.argv |
A. | ‘ ‘ |
B. | [ ] |
C. | [‘ ‘] |
D. | Error |
Answer» D. Error | |
280. |
What is the output of the code shown below is: import sys sys.stderr.write(“hello”) |
A. | ‘hello’ |
B. | ‘hello’ |
C. | hello |
D. | hello5 |
Answer» E. | |
281. |
What is the output of the code shown below? import sys sys.argv[0] |
A. | Junk value |
B. | ‘ ‘ |
C. | No output |
D. | Error |
Answer» C. No output | |
282. |
What is the output of the code shown below? import sys eval(sys.stdin.readline()) Computer |
A. | Error |
B. | ‘Computer’ |
C. | Computer8 |
D. | Computer |
Answer» B. ‘Computer’ | |
283. |
What is the output of this code? import sys eval(sys.stdin.readline()) "India" |
A. | India5 |
B. | India |
C. | ‘India’ |
D. | ‘India’ |
Answer» E. | |
284. |
What is the output of the following line of code, if the sys module has already been imported? sys.stdout.write("hello world") |
A. | helloworld |
B. | hello world10 |
C. | hello world11 |
D. | error |
Answer» D. error | |
285. |
What is the output of the code shown below, if the code is run on Windows operating system? import sys if sys.platform[:2]== 'wi': print("Hello") |
A. | Error |
B. | Hello |
C. | No output |
D. | Junk value |
Answer» C. No output | |
286. |
Which of the following functions is not defined under the sys module? |
A. | sys.platform |
B. | sys.path |
C. | sys.readline |
D. | sys.argv |
Answer» D. sys.argv | |
287. |
Which of the following functions can help us to find the version of python that we are currently working on? |
A. | sys.version |
B. | sys.version() |
C. | sys.version(0) |
D. | sys.version(1) |
Answer» B. sys.version() | |
288. |
What is the range of values that random.random() can return? |
A. | [0.0, 1.0]. |
B. | (0.0, 1.0]. |
C. | (0.0, 1.0) |
D. | [0.0, 1.0) |
Answer» E. | |
289. |
Which type of elements are accepted by random.shuffle()? |
A. | strings |
B. | lists |
C. | tuples |
D. | integers |
Answer» C. tuples | |
290. |
What does random.shuffle(x) do when x = [1, 2, 3]? |
A. | error |
B. | do nothing, it is a placeholder for a function that is yet to be implemented |
C. | shuffle the elements of the list in-place |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
291. |
Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))? |
A. | 0 |
B. | 1 |
C. | KeyError: 1 |
D. | none of the mentioned |
Answer» B. 1 | |
292. |
Which of the following will not be returned by random.choice(“1 ,”)? |
A. | 1 |
B. | (space) |
C. | , |
D. | none of the mentioned |
Answer» E. | |
293. |
Which of the following is equivalent to random.randint(3, 6)? |
A. | random.choice([3, 6]) |
B. | random.randrange(3, 6) |
C. | 3 + random.randrange(3) |
D. | 3 + random.randrange(4) |
Answer» E. | |
294. |
The function random.randint(4) can return only one of the following values. Which? |
A. | 4 |
B. | 3.4 |
C. | error |
D. | 5 |
Answer» D. 5 | |
295. |
Which of the following is equivalent to random.randrange(3)? |
A. | range(3) |
B. | random.choice(range(0, 3)) |
C. | random.shuffle(range(3)) |
D. | random.select(range(3)) |
Answer» C. random.shuffle(range(3)) | |
296. |
Which of the following cannot be returned by random.randrange(4)? |
A. | 0 |
B. | 3 |
C. | 2.3 |
D. | none of the mentioned |
Answer» D. none of the mentioned | |
297. |
What the does random.seed(3) return? |
A. | True |
B. | None |
C. | 3 |
D. | 1 |
Answer» C. 3 | |
298. |
What is the output of this function, assuming that the random library has already been included? random.shuffle[1,2,24] |
A. | Randomized list containing the same numbers in any order |
B. | The same list, that is [1,2,24]. |
C. | A list containing any random numbers between 1 and 24 |
D. | Error |
Answer» E. | |
299. |
Which of the following options is the possible outcome of the function shown below? random.randrange(1,100,10) |
A. | 32 |
B. | 67 |
C. | 91 |
D. | 80 |
Answer» D. 80 | |
300. |
Both the functions randint and uniform accept ____________ parameters. |
A. | 0 |
B. | 1 |
C. | 3 |
D. | 2 |
Answer» D. 2 | |