IT101-2 Finals Flashcards

1
Q

Who created python?

A

Guido Van Rossum

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When was python created?

A

1991

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is python used for?

A

web development (server-side),
software development,
mathematics,
system scripting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Whenever you are done in the python command line, you can simply type __________ to quit the python command line.

A

exit()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

*indicate a block of code.

A

Indentations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Comments start with a ______, and Python will render the rest of the line as a comment

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A _________ is created the moment you first assign a value to it.

A

variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Rules of variables

A
  • Must start with letter or underscore
    -can’t start with number
    -can only contain alpha numeric and underscore
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

There are three numeric types in Python:

A

*int
*float
*complex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

is a named place in the memory where a programmer can store data and later retrieve the data using the variable “name”

A

variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You can change the contents of a variable in a later statement
T or F

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

We assign a value to a variable using the ________?

A

Assignment statement (=)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Order of operation for python

A

Pemdas
Parenthesis
Exponent
multiplication, division, and remainder
Addition subtraction
(from left to right)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When writing code - use __________

A

parenthesis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

You can also use str() and float() to convert between strings and integers

True or False

A

False
int() and float()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

you will not get an error if the string does not contain numeric characters while converting to int or float

T or F

A

F
You will get an Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

used to output variables

A

print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

execution of code statements (one line after another) – like following a recipe

A

Sequential

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

used for decisions, branching – choosing between 2 or more alternative paths.

A

Selection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

used for looping

A

repetition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Recall that Python has a type called __________, which can take two possible values, True and False

A

boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

An expression that evaluates to a true/false value is called a

A

Boolean expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Python, decisions are made with the ___________, also known as the __________________.

A

if statement
selection statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

If the boolean expression evaluates to TRUE, then the block of statement(s) inside the if statement is executed. If boolean expression evaluates to FALSE, then the first set of code after the end of the if statement(s) is executed

T or F

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

can be followed by an optional else statement, which executes when the boolean expression is FALSE.

A

An if statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a FALSE value.

A

else statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.

A

The elif statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

allows us to execute a statement or group of statements multiple times

A

loop statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Repeats a statement or group of statements while a given condition is TRUE

A

while loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

The loop iterates while the condition is false.
When the condition becomes true, program control passes to the line immediately following the loop.

T or F

A

F
Loop iterates when condition is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

A loop becomes ____________ if a condition never becomes FALSE.

A

infinite loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

If the _________ statement is used with a for loop, the ____ statement is executed when the condition becomes false.

A

else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.

A

For loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

is a block of organized, reusable code that is used to perform a single, related action.

A

A function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

The code block within every function starts with a ___________ and is ___________

A

colon (:) and is indented.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

The statement __________ exits a function, optionally passing back an expression to the caller

A

return [expression]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

A return statement with no argument returns an error

A

False
It returns as None

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

______________ can be accessed only inside the function in which they are declared,

A

local variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

__________ can be accessed throughout the program body by all functions.

A

global variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

is a Python object with arbitrarily named attributes that you can bind and reference.

A

A module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

You can use any Python source file as a module by executing an _______________ in some other Python source file.

A

import statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

The ________ built-in function returns a sorted list of strings containing the names defined by a module.

A

dir()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

powerful and flexible data structure in python that allows you to store and manipulate collections of elements

A

Lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Python lists can grow or shrink in size as needed making them flexinle for handling varying amounts of data

A

Dynamic storage and retrieval

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Lists are commonly used in _____ to iterate over the elements and perform operations on them

A

loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

to create a python list you need to use ____

A

[] square brackets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

List elements are accessed using their ________

A

indices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

the indices start from ____ for the first elements

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Lists can store elements of any data types
T or F

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

This list function return the number of elements present in a list

A

len()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

allows you to add an element at the end of the list

A

append()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

adds elements from another list to the end of the current list.

A

extend()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

allows you to insert an element at a specific index in the list

A

insert()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

function is used to remove the first occurrence of a specified element from the list

A

remove()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

used to remove and return the element at a specific index in a list

A

pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

removes all elements from the list

A

clear()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

returns the index of the first occurrence of a specified element in the list

A

index()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

returns the number of occurrences a specific element in the list

A

count()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

used to sort in the list ascending order.

A

sort()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

reverses the order of elements in the list

A

reverse()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

creates a shallow copy of the list

A

copy()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

provide a powerful set of tools for manipulating and managing lists

A

list functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

a concise and pythonic way of generating lists

A

List comprehension

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

List comprehension does not allow it to be nested
T or F

A

F
it is allowed to be nested to allow complex lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

is used to apply the int() function to each element to in the input list

A

map()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

used to include only certain elements

A

filter()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

this is generally faster and more efficient compared to traditional loops when dealing with simple operations on lists

A

List comprehension

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

an ORDERED collection of elements enclosed in parentheses ()

A

Tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

Tuples are immutable
True or false

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

Elements cannot be modified once they are defined

A

Immutable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

tuples are typically created by enclosing elements within ____ and separating them with _________

A

parentheses ()
Comma ,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

Individual elements within a tuple can be accessed using __________

A

indexing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

involves creating a tuple by assigning values to it

A

tuple packing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

allows you to assign individual elements of a tuple to separate variables

A

tuple unpacking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

Tuples can be concatenated using the “*” operator?
T or F

A

False you use “+”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

Tuples can be repreated using the “x” operator
T or F

A

False you use the “*”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

to check if an element exists in a tuple use the _____ keyword

A

in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

tuples are _______, meaning their element cannot be changed after creation

A

immutable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

you can convert lists and vice versa using the list() and tuple() function
T or F

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

Functions can only return single values as a tuple
T or F

A

False it can return multiple values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

is an immutable unordered collection of UNIQUE elements

A

set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

Sets are widely used for performing ___________ such as union, intersection and difference

A

mathematical set operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

sets can be created using _________

A

curly braces {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

You can use this function to add a single element in a set

A

add()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

you can use this fucntion to add multiple elements in a set

A

update()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

removes specified element from the set if it does not exist it will raise an error

A

remove()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

this removes an element and if it does not exist it will not raise an error

A

discard()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

removes a random item from a set

A

pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

This set operations combines returns a combination of two sets

A

Union

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

symbol of union

A

|

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

This set operation return what’s common between two sets

A

Intersection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

Symbol of intersection

A

&

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

returns the difference between 2 sets or more

A

difference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

symbol of difference

A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

returns what is unique in both sets

A

Symmetric difference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

symbol of symmetric difference

A

\^

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q

to test if a set is a subset use

A

issubset()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q

to test if a set is a superset use

A

issuperset()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q

Sets only store unique elements, you can use them to store duplicates.
T or F

100
Q

Allows you to store and retrieve data in key-value pairs

A

Dictionary

101
Q

Another name of dictionary

A

Associative array or hash table

102
Q

T or F
Dictionary is an ordered collection

A

F it is unordered

103
Q

Dictionary key must be ______ and ______

A

unique and immutable

104
Q

Dictionaries are created using

A

{} curly braces

105
Q

To retrieve the value associated with a specific key use the _________

A

square bracket [] with the key inside

106
Q

If you try to access a key that does not exist it will raise an index error
T or F

A

F it will raise a KeyError

107
Q

You can use the ______ method which returns a default value if they key is not found

108
Q

to remove an element from the dictionary you can use the

A

pop() or del Keyword

109
Q

to copy a dictionary use

A

copy() or dict() constrictor

110
Q

the most common approach is to loop through its keys
T or F

111
Q

How is dict separated

A

it is separated by colon (:), and the elements are separated by commas (,)

112
Q

Question

113
Q

a sequence of characters

114
Q

computers do not deal with characters they deal with___________

A

numbers (binary)

115
Q

Conversion of character to number is called ______ and the reverse is called ___________

A

encoding
decoding

116
Q

___________ and _________ are some of the popular encodings used.

A

ASCII and Unicode

117
Q

In python a string is a sequence of _________ characters

118
Q

was introduced to include every character in all languages and bring uniformity in encoding

119
Q

You can access individual characters using

120
Q

Trying to access a char out of index range will raise an

A

indexerror

121
Q

An index must be an integer any other type will result in

122
Q

Strings are Immutable
T or F

123
Q

To delete tge string entirely is possible using the

A

del keyword

124
Q

returns an enumerate object, it contains the index and value of all the items

A

enumerate()

125
Q

starts with a backslash and is interpreted differently

A

escape sequence

126
Q

To ignore the escape sequence inside a string place a

A

r or R infront of the string

127
Q

is available with the string object is very versatile and powerful for FORMATTING strings

128
Q

format strings contain ___________ as place holders

A

curly braces{}

129
Q

Format are separated from the field name using

130
Q

is a module to manipulate and manage date and time information

131
Q

the handling for date time is

A

datetime.datetime

132
Q

you need to import datetime before ytou use it
T or F

133
Q

To format datetime objects use

A

strftime()

134
Q

to perfrom arithmetic operations in datetime use

135
Q

to work with timezones in datetime objects use

A

pytz library

136
Q

are named locations on disk to store related information

137
Q

store the data in the form of characters.

A

Text files

138
Q

store entire data in the form of bytes.

A

Binary files

139
Q

are generally available in .jpg, .gif or .png formats.

A

Image files

140
Q

CRUD meaning

A

Creat read update delete

141
Q

we use _________ function to open a file

142
Q

represents a temporary block of memory

143
Q

What does w open mode does?

A

Write data into file

144
Q

What does “r” does

A

Read data from the file

145
Q

What does a does?

A

append data to the file?

146
Q

What does w+ do?

A

to write and read data of a file

147
Q

What does r+ do?

A

To read and write data into file

148
Q

What does a+ do?

A

To append and read data of file.

149
Q

What does x do?

A

open file in exclusing creation mode.

150
Q

To close a file use __________

151
Q

closing is mandatory
T or F

152
Q

When a file is not closed a problem will lead to

A

insufficient memory.

153
Q

to create a fille use

A

open() method

154
Q

to create a new file which parameters do you need?

155
Q

TO read data from text file use

156
Q

the____________ method returns a list of remaining lines of the entire file

A

readlines()

157
Q

To delete you much import

A

the os module and run the os.remove() function

158
Q

to know the current directory

A

os.getcwd()

159
Q

to make a sub directory

A

os.mkdir(‘mysub’)

160
Q

to change directory

A

os.chdir()

161
Q

to rmeove directory

A

os.rmdir()

162
Q

to rename directory

A

os.rename()

163
Q

what is the error if not found using os.chdir()

A

FileNotFoundError

164
Q

What happens when you delete a directory that has something inside of it

165
Q

What does csv mean?

A

Comma separated Value

166
Q

Do you need to import a csv file to use it?
T or F

167
Q

how to read in csv

A

csv.reader()

168
Q

How to write in csv

A

csv.writer()

169
Q

how to write a row of data in csv

A

writerow()

170
Q

disrupts the flow of instructions

171
Q

this is optional and is used for code that needs to be executed regardless of whether an exception occurred or not

172
Q

you can raise exceptions using the

A

raise statement

173
Q

What does function overloading mean (in python)?

The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved.

An individual object of a certain class. An object obj that belongs to a class Circle, for example, is an instance of the class Circle.

the function overloads and kills the computer

A user-defined prototype for an object that defines a set of attributes that characterize any object of the class. The attributes are data members (class variables and instance variables) and methods, accessed via dot notation.

A

The assignment of more than one behavior to a particular function. The operation performed varies by the types of objects or arguments involved.

174
Q

Which of these is not a fundamental features of OOP?

Encapsulation

Instantiation

Inheritance

Polymorphism

A

Instantiation

175
Q

Which of the following best describes inheritance?

Means of bundling instance variables and methods in order to restrict access to certain class members

Focuses on variables and passing of variables to functions

Allows for implementation of elegant software that is well designed and easily modified

Ability of a class to derive members of another class as a part of its own definition

A

Ability of a class to derive members of another class as a part of its own definition

176
Q

Which of the following is the most suitable definition for encapsulation?

Focuses on variables and passing of variables to functions

Means of bundling instance variables and methods in order to restrict access to certain class members

Allows for implementation of elegant software that is well designed and easily modified

Ability of a class to derive members of another class as a part of its own definition

A

Means of bundling instance variables and methods in order to restrict access to certain class members

177
Q

Which of the following is required to create a new instance of the class?

A value-returning method

A constructor

A None method

A class

A

A constructor

178
Q

Which of the following statements is most accurate for the declaration x = Circle()?

x contains an object of the Circle type.

x contains an int value.

x contains a reference to a Circle object.

You can assign an int value to x.

A

x contains a reference to a Circle object.

179
Q

Which of the following best describes polymorphism?

Means of bundling instance variables and methods in order to restrict access to certain class members

Focuses on variables and passing of variables to functions

Ability of a class to derive members of another class as a part of its own definition

Allows for objects of different types and behaviour to be treated as the same general type

A

Allows for objects of different types and behaviour to be treated as the same general type

180
Q

Which of the following represents a template, blueprint, or contract that defines objects of the same type?

A method

A class

An object

A data field

181
Q

Which of the following best describes inheritance?

Focuses on variables and passing of variables to functions.

Allows for implementation of elegant software that is well designed and easily modified.

Means of bundling instance variables and methods in order to restrict access to certain class members.

Ability of a class to derive members of another class as a part of its own definition.

A

Ability of a class to derive members of another class as a part of its own definition.

182
Q

Suppose B is a subclass of A, to invoke the __init__ method in A from B, what is the line of code you should write?

B.__init__(self)

A.__init__(self)

B.__init__(A)

A.__init__(B)

Q

A

A.__init__(self)

183
Q

What is Instantiation in terms of OOP terminology?

Modifying an instance of class

Deleting an instance of class

Creating an instance of class

Copying an instance of class

A

Creating an instance of class

184
Q

Which of the following statements are correct?

An object can contain the references to other objects.

A reference variable refers to an object.

An object may contain other objects.

A reference variable is an object.

A

An object can contain the references to other objects.

Correct: A reference variable refers to an object.

185
Q

What is an instance in python?

A running program.

The creation of an instance of a class.

A special kind of function that is defined in a class definition.

An individual object of a certain class.

A

An individual object of a certain class.

186
Q

What is the purpose of a constructor in Python?

To declare variables.

To handle exceptions.

To initialize objects when they are created.

To define methods.

A

To initialize objects when they are created.

187
Q

In Python, polymorphism enables objects of different classes to be treated as instances of a common_________

A

superclass

188
Q

What is polymorphism in object-oriented programming, and how does it benefit software design?

A

Answer
Polymorphism allows us to use methods in a child class that have the same named method in the parent class, it benefits software design by allowing methods to be reusable by being used interchangeably in different classes, it allows the code to be used more flexibly, which lets it be maintained easily.

189
Q

Encapsulation helps protect the internal state of an object from unauthorized access.

T
True
F
False

190
Q

Classes can be instantiated multiple times to create multiple objects.

T
True
F
False

191
Q

A constructor in Python is defined using the ___________ method.

192
Q

Inheritance allows a derived class to have access to private members of the base class by default.

T
True
F
False

193
Q

Field

A

Variable that stores the state of an object.
Variable that stores the state of an object.

194
Q

Object

A

Instance of a class.

195
Q

Interface

A

A common method signature for implementation.

196
Q

Decorator

197
Q

1
Single Inheritance

A

A subclass inherits from one superclass.

198
Q

2
Multilevel Inheritance

A

A subclass inherits from another subclass.

199
Q

Abstract Method

A

Declared but not implemented in the abstract class.

200
Q

Concrete Method

A

Fully implemented method that can be used.

201
Q

In Python, all methods must have a return type specified.

T
True
F
False

202
Q

Which of the following is NOT a principle of object-oriented programming?

Abstraction.

Multiple Inheritance.

Encapsulation.

Polymorphism.

A

Multiple Inheritance.

203
Q

Encapsulation

A

Using private variables with getters and setters.

204
Q

2
Inheritance

A

A Dog class inherits from an Animal class.

205
Q

3
Polymorphism

A

Different shapes implementing a draw() method.

206
Q

4
Constructor Overloading

A

Using default parameters in constructors.

207
Q

The ______ parameter in Python methods refers to the instance of the class.

208
Q

Encapsulation involves bundling data and methods within a single unit called a _______

209
Q

Explain the concept of encapsulation in object-oriented programming. How does it contribute to the security and maintainability of code?

A

Answer
Encapsulation is the bundling of data and methods that operate in a single unit. Encapsulation contributes to security and maintainability of code by restricting access of the data, making it harder for outsiders to get access to the data.

210
Q

Abstraction

A

Simplifying complex reality.

211
Q

2
Method Overriding

A

Subclass provides specific implementation for an inherited method.

212
Q

3
Data Hiding

A

Restricting access to certain attributes.

213
Q

4
Dynamic Typing

A

Variables can change data type.

214
Q

Inheritance allows a class to inherit properties and behaviors from another class, referred to as the

A

base class

215
Q

class

2
def

3
super()

4
@property

A

Defines a new class.

Defines a new method.

Calls a method from the superclass.

Creates a getter method.

216
Q

Classes

2
Encapsulation

3
Inheritance

4
Methods

A

Blueprints for creating objects.

Hiding the internal state of an object.

Acquiring properties from another class.

Functions that define the behavior of objects.

217
Q

An abstract class cannot be instantiated directly and serves as a ____________ for other classes.

218
Q

What is the Syntax to create a Frame ?

win.frame(options)

Frame(window,options)

Both of the above

None of the above

A

Frame(window,options)

219
Q

Correct way to draw a line in canvas tkinter ?

create_line(canvas)

line()

canvas.create_line()

None of the above

A

canvas.create_line()

220
Q

Which of the following is correct ?

GUI is the part of the canvas

Both of the above

None of the above

canvas is the part of the GUI

A

canvas is the part of the GUI

221
Q

It is a container used for grouping and organizing the widgets.

All of the above

canvas

window

frame

222
Q

How we import a tkinter in python program ?

from tkinter import *

import tkinter

import tkinter as t

All of the above

A

All of the above

223
Q

Creating line are come in which type of thing ?

GUI

Canvas

None of the above

Both of the above

224
Q

A window is an instance of tkinter’s Tk class.

T
True
F
False

225
Q

How pack() function works on tkinter widget ?

None of the above

According to left,right,up,down

According to row and column vise

According to x,y coordinate

A

According to left,right,up,down

226
Q

Which of the following geometry managers are available in tkinter? choose 3 answers

.grid()

.flex()

.table()

.place()

.pack()

A

.grid()

.place()

.pack()

227
Q

What we use to change the back ground color any widget ?

background

bground

bg

fg

228
Q

Tkinter tool in python provide the

GUI

Database

OS commands

All of the above

229
Q

How the grid() function put the widget on the screen ?

None of the above

According to x,y coordinate

According to row and column vise

According to left,right,up,down

A

According to row and column vise

230
Q

It is a method we use to hold the screen waiting for events to happen ?

mainloop() function

Stop() function

None of the above

pause() function

Q

A

mainloop() function

231
Q

How the place() function put the widget on the screen ?

According to x,y coordinate

According to row and column vise

None of the above

According to left,right,up,down

A

According to x,y coordinate

232
Q

What is the use of the pack() function for the tkinter widget ?

To define a size of the widget

To perform a task by a widget

To organize the widgets in blacks before placing them on the screen

To destroy the widget

A

To organize the widgets in blacks before placing them on the screen

233
Q

To change the color of the text in the Label widget, what we use ?

bg

cchng

color

fg

234
Q

fg in tkinter widget is stands for ?

foreground

forgap

forgrid

background

235
Q

Essential thing to create a window screen using tkinter python?

To define a geometry

All of the above

call tk() function

create a button

236
Q

For what purpose, the bg is used in Tkinter widget ?

To change the color of widget

To change the size of widget

To change the background of widget

To change the bordergrid of widget

237
Q

GUI stands for

Global user interaction

Graph user interaction

Graphical user interaction

Graphical user interface

238
Q

Which of the correct way to set the geometry of the window ?

geometry(x y)

geometry(“300x400”)

geometry(300,400)

geometry(300;400)

239
Q

To get the multiple line user data, which widget we use ?

Entry

Text

Label

Canvas

240
Q

Which of the following function are used to get the data from the Entry field in Python Tkinter ?

get()

gettext()

getdata()

getEntry()

241
Q

Which of the following is used to call a function by the Button widget in tkinter python ?

call

command

contact

execute

242
Q

To delete any widget from the screen which function we use ?

stop()

delete()

destroy()

break()

243
Q

What is the correct syntax of destroy in tkinter ?

destroy(object)

object.destroy()

object(destroy)

delete(object)

244
Q

Which of the following we can able to delete using destroy() function ?

I. Button

II. Label

III. Frame

I only

I and II

II and III

I, II and III

245
Q

Text widget refers to the multi-line and non-editable text.

T
True
F
False

246
Q

Which of the following is clickable in GUI programming ?

I. Button

II. Checkbutton

III. Label

I only

I and II

II and III

I, II, and III