Subject / 929 questions

Programming MCQs

Page 35 of Programming multiple-choice questions with answers. Tap an option to check yourself.

Page 35 of 47

Question 681 DBMS and SQL

Which statement best describes a candidate key?

Correct answer C. A minimal superkey, with no proper subset that is also a superkey

Open question
Question 682 Python

When does the finally clause of a try statement execute?

Correct answer D. Always, whether or not an exception occurred in the try block

Open question
Advertisement
Question 689 Python

What is the role of the __init__ method in a Python class?

Correct answer C. It initialises a newly created instance, typically setting its attributes

Open question
Advertisement
Question 690 Python

How does a @staticmethod differ from a @classmethod in Python?

Correct answer B. A static method receives no implicit first argument, while a class method receives the class as cls

Open question
Question 694 Python

What is the effect of decorating a method with @property?

Correct answer B. The method can be accessed like an attribute, without parentheses

Open question
Advertisement
Question 697 Python

Which values can random.randint(1, 6) return?

Correct answer D. Any integer from 1 to 6, including both 1 and 6

Open question