Home / Engineering / Problem Solving and Python Programming MCQs / Page 29

# Problem Solving and Python Programming MCQs | Page - 29

Dear candidates you will find MCQ questions of Problem Solving and Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.

## `Q. 281) ,9))`

(A) 9
(B) 3
(C) too many arguments for pop() method
(D) 4

## `Q. 282) Which of the statements about dictionary values if false?`

(A) more than one key can have the same value
(B) the values of the dictionary can be accessed as dict[key]
(C) values of a dictionary must be unique
(D) values of a dictionary can be a mixture of letters and numbers

## `Q. 283) If a is a dictionary with some key-value pairs, what does a.popitem() do?`

(A) removes an arbitrary element
(B) removes all the key-value pairs
(C) removes the key-value pair for the key given as an argument
(D) invalid method for dictionary

## `Q. 284) ][1])`

(A) [2,3,4]
(B) 3
(C) 2
(D) an exception is thrown

## `Q. 285) ,2,3],"check")`

(A) syntax error
(B) {1:”check”,2:”check”,3:”check”}
(C) “check”
(D) {1:none,2:none,3:none}

## `Q. 286) If b is a dictionary, what does any(b) do?`

(A) returns true if any key of the dictionary is true
(B) returns false if dictionary is empty
(C) returns true if all keys of the dictionary are true
(D) method any() doesn’t exist for dictionary

## `Q. 287) To open a file c:\scores.txt for writing, we use `

(A) outfile = open(“c:\\scores.txt”, “w”)
(B) outfile = open(“c:\\scores.txt”, “w”)
(C) outfile = open(file = “c:\\scores.txt”, “w”)
(D) outfile = open(file = “c:\\scores.txt”, “w”)

## `Q. 288) To open a file c:\scores.txt for appending data, we use `

(A) outfile = open(“c:\\scores.txt”, “a”)
(B) outfile = open(“c:\\scores.txt”, “rw”)
(C) outfile = open(file = “c:\\scores.txt”, “w”)
(D) outfile = open(file = “c:\\scores.txt”, “w”)

## `Q. 289) Which of the following statements are true?`

(A) when you open a file for reading, if the file does not exist, an error occurs
(B) when you open a file for writing, if the file does not exist, a new file is created
(C) when you open a file for writing, if the file exists, the existing file is overwritten with the new file
(D) all of the mentioned