McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Electrical Engineering , Civil Engineering , Mechanical Engineering .
Chapters
201. |
Hence the result of this expression is 27.2. |
A. | 4.7 – 1.5 |
B. | 7.9 * 6.3 |
C. | 1.7 % 2 |
D. | 3.4 + 4.6 |
Answer» C. 1.7 % 2 |
202. |
Which keyword is used for function? |
A. | fun |
B. | define |
C. | def |
D. | function |
Answer» C. def |
203. |
Which are the advantages of functions in python? |
A. | reducing duplication of code |
B. | decomposing complex problems into simpler pieces |
C. | improving clarity of the code |
D. | all of the mentioned |
Answer» D. all of the mentioned |
204. |
What is called when a function is defined inside a class? |
A. | module |
B. | class |
C. | another function |
D. | method |
Answer» D. method |
205. |
Lambda contains block of statements. |
A. | true |
B. | false |
Answer» B. false |
206. |
min(101*99, 102*98) |
A. | 9997 |
B. | 9999 |
C. | 9996 |
D. | none of the mentioned |
Answer» C. 9996 |
207. |
How are keyword arguments specified in the function heading? |
A. | one-star followed by a valid identifier |
B. | one underscore followed by a valid identifier |
C. | two stars followed by a valid identifier |
D. | two underscores followed by a valid identifier |
Answer» C. two stars followed by a valid identifier |
208. |
print(foo()) |
A. | 0 |
B. | 1 |
C. | error |
D. | none of the mentioned |
Answer» C. error |
209. |
How are variable length arguments specified in the function heading? |
A. | one star followed by a valid identifier |
B. | one underscore followed by a valid identifier |
C. | two stars followed by a valid identifier |
D. | two underscores followed by a valid identifier |
Answer» A. one star followed by a valid identifier |
210. |
What is the value stored in sys.argv[0]? |
A. | null |
B. | you cannot access it |
C. | the program’s name |
D. | the first argument |
Answer» C. the program’s name |
211. |
How are default arguments specified in the function heading? |
A. | identifier followed by an equal to sign and the default value |
B. | identifier followed by the default value within backticks (“) |
C. | identifier followed by the default value within square brackets ([]) |
D. | identifier |
Answer» A. identifier followed by an equal to sign and the default value |
212. |
Where are the arguments received from the command line stored? |
A. | sys.argv |
B. | os.argv |
C. | argv |
D. | none of the mentioned |
Answer» A. sys.argv |
213. |
To open a file c:\scores.txt for reading, we use |
A. | infile = open(“c:\\scores.txt”, “r”) |
B. | infile = open(“c:\\scores.txt”, “r”) |
C. | infile = open(file = “c:\\scores.txt”, “r”) |
D. | infile = open(file = “c:\\scores.txt”, “r”) |
Answer» B. infile = open(“c:\\scores.txt”, “r”) |
214. |
To read the remaining lines of the file from a file object infile, we use |
A. | infile.read(2) |
B. | infile.read() |
C. | infile.readline() |
D. | infile.readlines() |
Answer» D. infile.readlines() |
215. |
What is the current syntax of remove() a file? |
A. | remove(file_name) |
B. | remove(new_file_name, current_file_name,) |
C. | remove(() , file_name)) |
D. | none of the mentioned |
Answer» A. remove(file_name) |
216. |
Which of the following mode will refer to binary data? |
A. | r |
B. | w |
C. | + |
D. | b |
Answer» D. b |
217. |
What is the difference between r+ and w+ modes? |
A. | no difference |
B. | in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+ |
C. | in w+ the pointer is initially placed at the beginning of the file and the pointer is at the end for r+ |
D. | depends on the operating system |
Answer» B. in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+ |
218. |
How do you get the name of a file from a file object (fp)? |
A. | fp.name |
B. | fp.file(name) |
C. | self. name (fp) |
D. | fp. name () |
Answer» A. fp.name |
219. |
Which function overloads the + operator? |
A. | add () |
B. | plus () |
C. | sum () |
D. | none of the mentioned |
Answer» A. add () |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.