Identifiers and Reserved Words Flashcards

(19 cards)

1
Q

What is a name in a Python program called?

A

Identifier

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

What types of names can be considered identifiers in Python?

A

Class name, function name, module name, variable name

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

What characters are allowed in Python identifiers?

A

Alphabet symbols, digits, underscore

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

What happens if an invalid character is used in an identifier?

A

Syntax error

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

Is it valid to start an identifier with a digit?

A

No

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

Are identifiers in Python case sensitive?

A

Yes

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

What does it indicate if an identifier starts with an underscore (_)?

A

It is private

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

Can reserved words be used as identifiers in Python?

A

No

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

What is the maximum length for Python identifiers?

A

No length limit, but lengthy identifiers are not recommended

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

Which of the following is a valid Python identifier? ‘total123’, ‘123total’, ‘ca$h’, ‘abc_abc

A

total123, abc_abc

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

How many reserved words are available in Python?

A

33

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

List three examples of reserved words in Python.

A
  • True
  • False
  • None
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are reserved words in Python?

A

Words reserved to represent some meaning or functionality

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

What do all reserved words in Python contain?

A

Only alphabet symbols

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

Which reserved words in Python contain uppercase letters?

A
  • True
  • False
  • None
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Is ‘a = true’ a valid statement in Python?

17
Q

Is ‘a = True’ a valid statement in Python?

18
Q

What does it indicate if an identifier starts with two underscores?

A

It indicates a strongly private identifier

19
Q

What are identifiers that start and end with two underscores called?

A

Language defined special names or magic methods