Computer Science 1301 Final Questions

Flashcard
•
Science
•
University
•
Hard
Wayground Content
FREE Resource
Student preview

15 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What is an instance attribute in Python?
Back
An instance attribute is a variable that is bound to the instance of a class. Each object has its own copy of the instance attribute.
2.
FLASHCARD QUESTION
Front
What will be the output of the following code? numbers = {} letters = {} comb = {} numbers['Josh'] = 89 numbers['Alex'] = 95 letters[1] = 'B' letters[2] = 'A' comb['Numbers'] = numbers comb['Letters'] = letters print(comb)
Back
{'Numbers': {'Josh': 89, 'Alex': 95}, 'Letters': {1: 'B', 2: 'A'}}
3.
FLASHCARD QUESTION
Front
What does the 'items()' method do in a dictionary?
Back
The 'items()' method returns a view object that displays a list of a dictionary's key-value tuple pairs.
4.
FLASHCARD QUESTION
Front
What is an instance in object-oriented programming?
Back
An instance is a specific realization of a class. It is created when a class is instantiated.
5.
FLASHCARD QUESTION
Front
What is the purpose of the __init__ method in a class?
Back
The __init__ method is a special method in Python classes that initializes the instance attributes when an object is created.
6.
FLASHCARD QUESTION
Front
What is the output of the following code? my_dict={1:"A", 2:"B", 3:"C"} for i in my_dict.items(): print(i, end=" ")
Back
1: 'A' 2: 'B' 3: 'C'
7.
FLASHCARD QUESTION
Front
How do you define a class in Python?
Back
A class in Python is defined using the 'class' keyword followed by the class name and a colon. For example: class MyClass:.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Understanding Cognitive Development

Flashcard
•
12th Grade
11 questions
AP CSA Unit 1 Review

Flashcard
•
12th Grade
15 questions
Confusing Words Exercise AS-303

Flashcard
•
University
15 questions
Gerund & Infinitive (B1)

Flashcard
•
University
15 questions
Joints and Levers in the Human Body

Flashcard
•
12th Grade
10 questions
Classroom of the Elite Flashcard

Flashcard
•
Professional Development
15 questions
Lesson 2.1: Constructing Frequency Distributions

Flashcard
•
12th Grade
15 questions
Rules & Procedures Flashcard

Flashcard
•
12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Science
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University