Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Clean Code

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

Which is NOT a rule for meaningful names?

a)

Distinctive

b)

Short

c)

Pronounceable

d)

Intention Revealing

2.

A function should...

a)

Perform as many tasks as possible

b)

Have elaborate comments to explain what it does

c)

Be short, not complex and do one thing

d)

Have a short name

3.

Switch statements should...

a)

Contain all the implementations

b)

Never be used with constants

c)

Be used as much as possible

d)

Call functions that contain the implementations

4.

Comments...

a)

Can be used when names are not meaningful

b)

Should be added before every function

c)

Should be replaced with self explanatory code

d)

Make up for bad code

5.

Formatting is all about...

a)

Being petty

b)

Communication

c)

Performance

d)

Security

6.

Why should code lines be short and indented?

a)

To keep the code well organised

b)

For better performance

c)

So they'll do only one thing

d)

To reduce cognitive complexity

7.

Which is NOT a code smell?

a)

Agility

b)

Rigidity

c)

Opacity

d)

Fragility

8.

A clean code looks like it was written by...

a)

Someone else

b)

That guy from accounting

c)

Uncle Bob

d)

Someone who cares