CSU - EXAM 1 - CS 214

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/188

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:44 AM on 10/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

189 Terms

1
New cards

True or False: Messy code is okay to meet a deadline. You can clean it up later.

False

2
New cards

True or False: Keeping code clean at all times is not a cost effective solution.

False

3
New cards

True or False: Adding more staff can maintain productivity with messy code.

False

4
New cards

True or False: Productivity decreases asymptotically to zero over time with messy code.

True

5
New cards

True or False: Longer names are generally better than shorter names since they can give more context.

False

6
New cards

True or False: Class names should only be nouns.

True

7
New cards

True or False: Solution domain names are preferable to problem domain names to make it easier for the programmer.

False

8
New cards

True or False: Names should reveal intention.

True

9
New cards

True or False: Most names provide meaningful context

in and of themselves.

10
New cards

True or False: Use encodings like member prefixes "m_" to distinguish names.

False

11
New cards

True or False: Different classes can use different words for the same concept.

False

12
New cards

True or False: Choosing good names requires a shared cultural background.

True

13
New cards

True or False: Names should vary in small ways.

False

14
New cards

True or False: Do not use single character variable names except for loop counters.

True

15
New cards

True or False: Clever names can help aid understandingand memory.

False

16
New cards

True or False: Names should be pronounceable.

True

17
New cards

True or False: The same name can be used for different purposesin different classes.

False

18
New cards

True or False: Once a variable

method

19
New cards

True or False: Including the data type along with the word "variable" provides a meaningful naming distinction

especially since modern IDEs obscure the distinction between variable namesand other words in programs.

20
New cards

Which is the best name for a List

flaggedLocations

21
New cards

One benefit of pronounceable names is their support for clarityandease in conversations.

True

22
New cards

Clean code suggests using searchable namesbut there is also support for very short names within a very local context.

True

23
New cards

Since the English language contains many words with overlapping meaning

names that incorporate different words for the same concept can be helpful throughout the code.

24
New cards

Which of the following help avoid disinformation when referring to List? (select all that apply)

Pick a preferred approach to naming collections of objects; Avoid "accountList" since the implementation detail may change

25
New cards

True or False: Method names should only be verbs or verb phrases.

True

26
New cards

True or False: Functions should do something or answer something

not both.

27
New cards

True or False: Functions should do 1 thing.

True

28
New cards

True or False: The bodies of try-catch blocks should be extracted into their own functions.

True

29
New cards

True or False: Throwing exceptions is preferred to returning error codes.

True

30
New cards

True or False: Duplicate code can often be eliminated with a function.

True

31
New cards

True or False: Switch statements are preferable to polymorphism.

False

32
New cards

True or False: Functions should change state of object rather than use output arguments.

True

33
New cards

True or False: Functions with 2 or more arguments can be confusing because of order.

True

34
New cards

True or False: Output arguments are preferable to input arguments.

False

35
New cards

True or False: Multiple arguments are preferable to argument objects.

False

36
New cards

True or False: Functions should have a single level of abstraction.

True

37
New cards

True or False: Functions should be small.

True

38
New cards

True or False: Three or more function arguments should be avoided.

True

39
New cards

True or False: Flag arguments are useful.

False

40
New cards

How many things should one function do?

1

41
New cards

The ideal number of arguments for a function is 0.

True

42
New cards

Command Query Separation indicates that a function could:(select all that apply)

Do something; Answer something

43
New cards

True or False: Dummy scopes/bodies do not need to be visible.

True

44
New cards

Java class implementations of objectsin clean code: a.) always have private properties b.) can provide public access to propertiesand utility functions for a clean code purpose c.) restrict other programmers from seeingthe internal implementation of classes d.) provide public access to all functions since these representthe clean code public behaviors of the object

b.) can provide public access to propertiesand utility functions for a clean code purpose

45
New cards

How can we create a single level of abstraction within a Java class? a.) write a single function to representthe level of abstractionand use flag parameters to execute various behaviors b.) write the Java class correctly the first time c.) have propertiesand functions that representthe ideas at a single level of abstraction d.) actually

the propertiesand functions within a Java class should not represent a single level of abstraction

46
New cards

True or False: A Java class should have a single responsibilityand its contents should be at a single level of abstraction.

True

47
New cards

A Java class(in the course):(select all that apply

Is a data type; Can include both multiple pieces of dataand multiple functions; Is used to implement a data structure; Is used to implement an object

48
New cards

The Single Responsibility Principle:(select all that apply

Suggests creating functions that have a single responsibility; Suggests creating Java classes that have a single responsibility

49
New cards

True or False: I should consider breaking a Java class into two or more Java classes whenthe propertiesand functions can easily be separated.

True

50
New cards

True or False: Classes with high cohesion are candidates to split.

False

51
New cards

True or False: Classes should have low cohesion.

False

52
New cards

True or False: Classes should be small.

True

53
New cards

True or False: Classes that have large numbers of instance variables are more cohesive.

False

54
New cards

True or False: Maximum cohesion occurs when every method uses every instance variable.

False

55
New cards

True or False: Low coupling means a more flexible system.

True

56
New cards

True or False: The isolation of low coupling makes it harder to understandthe elements of the system.

False

57
New cards

True or False: Classes should be organized to reduce the risk of change.

False

58
New cards

True or False: Objects hide their data behind abstractionsand expose functions that operate on that data.

True

59
New cards

True or False: Variables should be kept private so others cannot depend on them.

True

60
New cards

True or False: Protected or package scoped variablesand methods can simplify testing.

True

61
New cards

True or False: Objectsand data structures are fundamentally the same thing.

False

62
New cards

True or False: Active records are quintessential data structures often augmented with navigational methods like saveand find.

True

63
New cards

True or False: Data Transfer Objects(DTOs)that have public variablesand no functions are useful.

True

64
New cards

True or False: Data Transfer Objects are quintessential objects.

False

65
New cards

Following command query separation guidanceand eliminating output arguments guidance along with guidance to be consistent — error handling guidance(preference)is to: a.) return error codes for queries(accessors)b.) prefer exceptions to returning error codes c.) return error codes for commands(mutators)d.) only code the happy pathand ignore potential errors

b.) prefer exceptions to returning error codes

66
New cards

True or False: Exceptions do not require informative messages since the stack trace is available.

False

67
New cards

True or False: Returning Null is preferred to throwing an exception.

False

68
New cards

True or False: Returning a special case object is preferred to returning Null.

True

69
New cards

True or False: Returning Null leads to programming errors.

True

70
New cards

True or False: Passing Null parameters to methods should be avoided.

True

71
New cards

True or False: It is better to throw an exception than return an error code.

True

72
New cards

True or False: The calling code is cleaner when you return an error code.

True

73
New cards

True or False: A function that handles errors should do nothing else.

True

74
New cards

True or False: Many code bases are completely dominatedby error handling

making it unnecessarily difficult to see what they do.

75
New cards

True or False: Tests can depend on each other.

False

76
New cards

True or False: In TDD

you should only write the code necessary to make the currently failing test pass.

77
New cards

True or False: Testsand production code should be written together.

True

78
New cards

True or False: A JUnit test function should only test a single concept.

True

79
New cards

True or False: Readability is the key to clean tests.

True

80
New cards

True or False: Tests should run quickly.

True

81
New cards

True or False: Tests can be written after you designand implement the code.

False

82
New cards

True or False: Domain-specific languages help you write clean tests.

True

83
New cards

True or False: Production code should be written before any tests.

False

84
New cards

True or False: The number of assert statementsin a single JUnit test function should be minimized.

True

85
New cards

True or False: A JUnit test function is only allowed to have one assert statement.

False

86
New cards

True or False: The testing code needs to be as efficientas the production code.

False

87
New cards

True or False: Some tests can require manual evaluation.

False

88
New cards

True or False: In TDD

you write all of your code before any tests.

89
New cards

True or False: In TDD

you write all of your tests before you write any code.

90
New cards

True or False: In TDD

you must write a failing unit test before you write the code for it.

91
New cards

True or False: Tests lessen the fear of making changes to the code.

True

92
New cards

True or False: Test code does not need to be clean code.

False

93
New cards

True or False: Unit tests keep code flexible

maintainable

94
New cards

True or False: Comments can be misleading

imprecise.

95
New cards

True or False: Comments that explain intent behind a decision can be useful.

True

96
New cards

True or False: Comments that amplify the importance of something that seems inconsequential can be useful.

True

97
New cards

True or False: Comments that warn of consequences can be useful.

True

98
New cards

True or False: Comments on closing braces can be useful.

True

99
New cards

True or False: Comments to clarify use of code you cannot change can be useful.

True

100
New cards

True or False: Many informative comments can be replaced by better variableand function names.

True