Naming conventions Flashcards

1
Q

Name two types of naming conventions.

A

Camel case (camelCase)
Snake case (snake_case)
Hungarian notation (strInput)

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

Why are naming conventions important in source code?

A

Naming conventions provide a clear and consistent way to label program elements, ensuring easy understanding. Effective conventions convey an element’s purpose and, if needed, its data type, enhancing programmer efficiency.

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

Use the pseudocode below to answer the questions that follow:

Input strFileName
dAll ← {}
elTree ← fnReadFromFile( strFileName )
elRoot ← elTree.fnGetRoot()

For elSubEl in elRoot
dAll[elSubEl.fnGetEl(“height”)] ← elSubEl.fnGetAttrib(“height”)
EndFor

a) Which variable is a string?

b) What data structure is dAll?

c) What data structure is elRoot?

d) What naming convention is being used?

A

a) strFileName

b) Dictionary, as it takes (key, value) pairs.

c) Element of an XML tree.

d) Hungarian notation with user-defined prefixes.

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