CC103-1

CC103-1

University

40 Qs

quiz-placeholder

Similar activities

Câu hỏi về Dataframe trong Python

Câu hỏi về Dataframe trong Python

University

35 Qs

The Self in Western and Oriental / Eastern Thought

The Self in Western and Oriental / Eastern Thought

University

35 Qs

What British value and belief motivates the following behaviour? (1m)

What British value and belief motivates the following behaviour? (1m)

University

36 Qs

FINMA PART2

FINMA PART2

University

38 Qs

MARLAW WEEK 5 Quiz

MARLAW WEEK 5 Quiz

University

40 Qs

Đề Cương Ôn Tập Giữa Kỳ 2 - Môn Tin Học

Đề Cương Ôn Tập Giữa Kỳ 2 - Môn Tin Học

University

45 Qs

uts (🙏)

uts (🙏)

University

37 Qs

CC103-1

CC103-1

Assessment

Quiz

Others

University

Hard

Created by

ALVIN CERTEZA

FREE Resource

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? class A: def __init__(self): self.var = 1 a = A() print(a.var)

0

1

None

Error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? class A: def __init__(self): self.val = 5 def get_val(self): return self.val a = A() a.val = 10 print(a.get_val())

5

10

None

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is called when an object is created? class B: def __init__(self): print("Object created")

__new__()

__init__()

__str__()

__call__()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output? class A: def __str__(self): return "Hello" a = A() print(a)

Hello

A

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? class Parent: def greet(self): print("Hello from Parent") class Child(Parent): pass c = Child() c.greet()

Error

Nothing

Hello from Parent

Hello from Child

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following defines inheritance correctly? class Base: pass class Derived(Base): pass

class Base(Derived)

class Derived -> Base

class Derived(Base)

Derived inherits Base()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code print? class A: def __init__(self): self.data = "A" class B(A): def __init__(self): super().__init__() self.data = "B" b = B() print(b.data)

A

B

AB

Error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?