CC103-1

CC103-1

University

40 Qs

quiz-placeholder

Similar activities

Oops Quiz

Oops Quiz

University

40 Qs

Câu hỏi về Excel

Câu hỏi về Excel

University

42 Qs

Communicative Language Teaching & Content-Based Instruction

Communicative Language Teaching & Content-Based Instruction

University

37 Qs

Pyetje mbi PHP dhe Zhvillimin e Uebit

Pyetje mbi PHP dhe Zhvillimin e Uebit

University

43 Qs

ICT4

ICT4

University

40 Qs

Nusing mod. 2 - Pt. 1

Nusing mod. 2 - Pt. 1

University

37 Qs

English quiz

English quiz

University

40 Qs

англ курс

англ курс

University

38 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?