INSY 3300 Python Final

30 flashcardspar Alejandro
Réviser ces flashcardsGratuit · répétition espacée · iPhone, Android, Mac et web

Toutes les cartes

1
What does input() always return?
A string
2
Which operator performs floor division in Python?
  • /
  • //
  • %
  • *
3
What sequence does range(2, 10, 3) produce?
2, 5, 8
4
Which logical operator checks that a value is outside a range?
or
5
How many times does the inner body run for an outer range(3) and an inner range(4)?
  • 7
  • 3
  • 12
  • 4
6
What is a void function?
A function that runs its statements and returns no value (None)
7
What happens if you use a local variable from a different function?
A NameError
8
What does file mode 'w' do to existing contents?
Erases them
9
Which part of try/except runs only when no exception occurs?
  • finally
  • except
  • else
  • try
10
What does list.sort() return?
None, because it sorts in place
11
What does b = a do when a is a list?
Makes b point to the same list, not a copy
12
What is [10, 20, 30, 40, 50][1:4]?
  • [10, 20, 30, 40]
  • [20, 30, 40]
  • [20, 30, 40, 50]
  • [10, 20, 30]
13
Are Python strings mutable or immutable?
Immutable
14
What does find() return when the substring is not found?
-1
15
What does 'hello'[
-1] return?
16
What does d.get('c', 0) return if 'c' is not a key?
0
17
How do you create an empty set?
set(), because {} makes an empty dictionary
18
How do set remove() and discard() differ when the item is missing?
remove() raises KeyError; discard() does not
19
What is {1, 2, 3} ^ {3, 4}?
  • {3}
  • {1, 2, 3, 4}
  • {1, 2, 4}
  • {1, 2}
20
Which file mode is used to unpickle with pickle.load?
'rb'
21
What does __init__ do in a class?
Runs automatically when an object is created and initializes its attributes
22
Which parameter must be the first one in every method of a class?
  • cls
  • this
  • self
  • obj
23
What is an accessor method?
A getter that returns an attribute value without changing it
24
What does class Car(Automobile) mean?
Car inherits from Automobile, an "is a" relationship
25
Which SQLite type corresponds to a Python float?
  • REAL
  • INTEGER
  • TEXT
  • BLOB
26
What must a primary key never be?
NULL, and it must be unique
27
What does cur.fetchone() return when no rows remain?
None
28
Which call saves INSERT, UPDATE and DELETE changes?
conn.commit()
29
Which wildcard in a LIKE pattern matches any characters?
  • ?
  • &
  • #
  • %
30
What does CREATE TABLE IF NOT EXISTS prevent?
An error from recreating an existing table on every run
Réviser les 30 cartes gratuitement

Plus de flashcards : Informatique

A+ Core 1 Domain 1 Acronyms37 cartesInformatique · Anglaisatalnagiict32 cartesInformatique · AnglaisKidistOS Virtualization25 cartesInformatique · Anglais—Griffith—1.2.3 SOFTWARE DEVELOPMENT20 cartesInformatique · AnglaisSabs2023Data Storage and Databases15 cartesInformatique · AnglaisAyaanSYO-601 Log files10 cartesInformatique · Anglaisr3lykSoftware Architecture and Quality Attributes (Wk3)209 cartesInformatique · AnglaisSamLinux4 decks · 252 cartesInformatiqueAndrewNetwork Security: OSPF Routing Protocol83 cartesInformatique · AnglaisDiandreiDatabases68 cartesInformatique · AnglaisXyzboltCS4432 - Database Query Optimization (Week 6 & 7)55 cartesInformatique · Anglaisaliciadrei microprocessor 146 cartesInformatique · AnglaisDiandrei

Tous les decks : Informatique

Révise ces decks dans l’app

Gratuit sur iPhone, Android, Mac et le web. Ajoute n’importe quel deck à ton compte en un tap.

Télécharger dans l’App StoreDisponible sur Google Play
Réviser les 30 cartes gratuitement