Intro to Coding - Readable Code

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What are the best ways to improve the readability of code? Choose all that apply. Be consistent when naming variables, procedures, classes, and methods while you are writing. Use comments to include helpful information about the program for future use. Use indenting and line breaks to keep your code from being a solid block of information that is difficult to follow. Use # symbols as the first character of all variable names.

1. Be consistent when naming variables, procedures, classes, and methods while you are writing. 2. Use comments to include helpful information about the program for future use. 3. Use indenting and line breaks to keep your code from being a solid block of information that is difficult to follow.

Which of the following is true of code that is formatted for readability? Choose all that apply. It makes good use of indentation. It makes good use of line breaks. It is broken into meaningful segments. It is consistently aligned with the left margin without indentation.

1. It makes good use of indentation. 2. It makes good use of line breaks. 3. It is broken into meaningful segments.

Which of the following are benefits of formatting for readability? Choose all that apply. Less time will be required to maintain the program. Programs will be easier to debug. Programs will look better on the screen. Programs will be easier to understand.

1. Less time will be required to maintain the program. 2. Programs will be easier to debug. 4. Programs will be easier to understand.

Which of the following are reasons why it is important to write readable code? Choose all that apply. Readable code is easier to maintain. Readable code is easier to modify. Readable code is fun to write. Writing readable code saves time in the long run.

1. Readable code is easier to maintain. 2. Readable code is easier to modify. 4. Writing readable code saves time in the long run.

Select the best word or phrase that completes the sentence. A helpful comment is a comment that helps to document the program. lets future programmers know how the original programmer was feeling at the time. breaks up the flow of code so it is not boring. includes important events that were occurring at the time the original program was written.

1. helps to document the program.

Which of the following are characteristics of readable code? Choose all that apply. meaningful and consistent naming of variables and procedures variable names that are chosen at random helpful comments good use of indentation and line breaks

1. meaningful and consistent naming of variables and procedures 3. helpful comments 4. good use of indentation and line breaks

Select the best word or phrase that completes the sentence from the drop-down menu. Readable code includes the use of ? Helpful comments include information that ? ? is used to make the program easier to follow.

1. meaningful variable names 2. is helpful to anyone reviewing the code 3. Indentation

Which of the following are examples of the good use of indentation and line breaks? Choose all that apply. the use of line breaks to separate segments of code the use of indentation to create segments of code that are easy to identify the omission of line breaks so that code can be written without any interruption the use of indentation that hides segments of code

1. the use of line breaks to separate segments of code 2. the use of indentation to create segments of code that are easy to identify

Which of the following are reasons to format code into meaningful segments? Choose all that apply. to separate code that performs a task to hide variable definitions from the rest of the code to create code that is easier to read to make the program easier to follow

1. to separate code that performs a task 3. to create code that is easier to read 4. to make the program easier to follow

Why is readable code important? Choose all that apply. It is more fun to write. It makes the purpose and flow of a program easier to understand and follow. Anyone needing to work with the code in the future will have an easier time. It will save time when it is time to update the program.

2. It makes the purpose and flow of a program easier to understand and follow. 3. Anyone needing to work with the code in the future will have an easier time. 4. It will save time when it is time to update the program.

Which of the following represent the use of formatting to create readable code? Choose all that apply. Line breaks are used to separate every ten lines of code. Line breaks are used to separate segments of code. Indentation is used to create a pattern that is easy to follow. Indentation is used to make it easier to follow the flow of logic in the code.

2. Line breaks are used to separate segments of code. 4. Indentation is used to make it easier to follow the flow of logic in the code.

You are writing a program to calculate student grades. Which of the following would make good variable names? Var01, Var02, Var03, Var04 Test01, Quiz01, Test02, Quiz02 Dog01, Dog02, Dog03 X01, X02, X03, X04

2. Test01, Quiz01, Test02, Quiz02

You are writing a recursive code segment. Which of the following would be the most helpful comment? This code is recursive. This recursive code counts the nodes in a tree. This is efficient code. The purpose of this code is evident.

2. This recursive code counts the nodes in a tree.

Readable code includes the use of color and symbols to make the code look good. consistent and meaningful variable names, helpful comments, and formatting. variable names that do not vary from program to program. comments that include the programmers' reactions to a particular piece of code used.

2. consistent and meaningful variable names, helpful comments, and formatting.

Your program will be used by many departments at the university. Your comments will be important to their IT people. What would be a useful comment? This was a really hard part to write, but it finally works. I'm not sure what this does, but I don't have time to troubleshoot it. This segment returns a value that is used by the segment marked B.

3. This segment returns a value that is used by the segment marked B.

Select the best word or phrase that completes the sentence. Indentation and line breaks can be used to make sure the code takes up the entire screen at all times. create a decorative pattern within the code itself. make it easier to follow the code and identify which parts of the code belong together.

3. make it easier to follow the code and identify which parts of the code belong together.

Readable code includes the use of formatting to make the code look better. the use of dense lines of code without indentation. the use of comments that are of no use to future users of the program. line breaks that help a programmer follow the flow of the program.

4. line breaks that help a programmer follow the flow of the program.

Which of the following are reasons to use indentation in code? to create a pattern in the code to hide code to hide a segment of the code to make the code easier to read

4. to make the code easier to read


Ensembles d'études connexes

Lab 7: Retina, Macula and Fovea, Optic Disc and Optic Nerve

View Set

Lifespan Chap 32: Concepts of Care for Patients with Cardiac Problems

View Set

Combo of NY BAR Review cards by smjr1920

View Set

Chapter 26: EMT: Behavioral Emergencies Post study Questions

View Set

Chapter 29 The High-Risk Newborn: Problems Related to Gestational Age and Development

View Set

Public Speaking DE - Ch 12 Using Language

View Set

CWTS-6-Radio Frequency Fundamentals for Wireless LAN Technology

View Set