Summary

This document contains multiple-choice questions on various topics of programming. It covers topics including Eclipse, version control (Git), memory mapping, and UML diagrams. The questions appear to be from a programming course.

Full Transcript

What is required inside the multi-line comment block (/ /) you place at the top of each source code file in this course? \- My full name, and my professors name \- Due date, and last modified date \- Description of the program \- all of the above all of the above After creating a project in Ec...

What is required inside the multi-line comment block (/ /) you place at the top of each source code file in this course? \- My full name, and my professors name \- Due date, and last modified date \- Description of the program \- all of the above all of the above After creating a project in Eclipse, and adding.java files they are located in the projects \_\_\_\_\_ folder. \- src \- documents \- bin \- api src When working in Eclipse, to edit and compile code you use the \_\_\_\_\_. \- Debug window \- JPA perspective \- Java perspective \- Web perspective Java perspective After downloading the Eclipse installer and extracting it, is there an installer for the program? \- no \- yes no Eclipse stores all of your projects inside a \_\_\_\_\_ folder. \- repository \- workspace \- desktop \- internet workspace You can also click the terms or definitions to blur or reveal them Hide definitions What was the output from the program in the hybrid 2 activity? \- 1.0 \- 0.9999999999999999 \- 1.0000000000000001 \- 1.1 0.9999999999999999 What was the actual value inside sum when we would expect 0.8 to have been assigned? (refer to the hybrid 2 activity) \- 0.8 \- 0.7999999999999999 \- 0.8888883209840987 \- 0.80000000000000001 0.7999999999999999 What is one way to get out of the Java API code, e.g. System.out.println(), if I accidentally step-into it while debugging? \- Use the Resume button so the program runs to completion \- Use the Red Terminate button to end the program \- Select the method name matching my method that I was debugging in the Debug View (far left side of screen), then use step over. \- all of the above. all of the above. What was the actual value inside sum when we would expect 0.3 to have been assigned? (refer to the hybrid 2 activity) \- 0.30000000000000004 \- 0.3 \- 0.29999999999999999 \- 0.34 0.30000000000000004 How do you set a breakpoint in Eclipse? \- double click on the grey-margin on the left side of the source code view. \- right-click on the grey-margin on the left side of the source code view and select toggle breakpoint in the drop-down menu. \- use the Run menu, and select toggle breakpoint from the menu. \- all of the above. What is the diagram type we are learning to use in UMLet? \- UML Class Diagram \- UML Sequence Diagram \- UML Activity Diagram \- UML Deployment Diagram UML Class Diagram What is the name of the template item for creating a simple UML class diagram? \- ActiveClass \- SimpleClass \- AbstractClass \- \ SimpleClass What is the default file extension for UMLet diagrams? \- txt \- java \- uxf \- class uxf How do you add a horizontal line in a UML Class Diagram in UMLet? \- you need to drag it across from the templates area \- you can enter two hyphens in the properties for the diagram, then hit enter \- UML Class diagrams do not use horizontal lines \- you need to use several underscore characters you can enter two hyphens in the properties for the diagram, th What is the difference between double and Double? \- double is a primitive type, Double is a wrapper class \- they are the same \- Double is a primitive type, double is a wrapper class \- We can only use Double in Java programs, double does not exist double is a primitive type, Double is a wrapper class What data type does the format specifier %s work with? \- int \- String \- double \- byte String What data type does the format specifier %d work with? \- int \- String \- double \- byte int What data type does the format specified %f work with? \- int \- String \- double \- byte double What does %n do when used in a format String? \- writes \"%n\" exactly as typed into the output \- write an operating system appropriate line terminator into the output \- this is the same as using \\n \- this is the same as using \\b What is version control? \- software that tracks changes to files \- software that controls versions \- software that generates new source code files automatically as needed software that tracks changes to files Who created Git? \- Oracle \- Linux Torvalds and the Linux community \- Microsoft Linux Torvalds and the Linux community What is Git? \- Git is a remote-only version control system \- Git is a distributed (local and remote) version control system \- Git is a local-only version control system Git is a distributed (local and remote) version control system What is the Git command git init used for? \- to copy an existing repository \- to add a file to an existing repository \- to create a new repository to create a new repository What is the Git command git commit used for? \- to take a snapshot of files added to the staging area that have changes \- to add a file to the staging area \- to notify Git to ignore a file(s) to take a snapshot of files added to the staging area that have changes You can also click the terms or definitions to blur or reveal them Hide definitions ##### What is the Method Call Stack? \- An allocation of memory, used to store methods and their data. \- An allocation of memory, used to store reference types (objects). \- Where methods go when the compiler executes them. An allocation of memory, used to store methods and their data. What is the Heap? \- An allocation of memory, used to store methods and their data. \- An allocation of memory, used to store reference types (objects). \- Where objects go when they are no longer needed. An allocation of memory, used to store reference types (objects). What is a method call, within the Method Call Stack, referred to as? \- a plate \- a counter \- stack frame stack frame What typically has more memory available, Method Call Stack or Heap memory? \- Method Call Stack \- Heap memory \- Both have the same amount. Heap memory Where are reference types (objects) stored in memory? \- Method Call Stack \- Heap \- Garbage Collector stores them Heap You can also click the terms or definitions to blur or reveal them Hide definitions The recommended setting for a HOME system environment variable in Windows when working with Git both inside Eclipse and via command line tools is? \- %USERPROFILE% \- C: \- C:\\Homework \- N: \%USERPROFILE% After creating a new Java project in Eclipse, to use version control with it, you need to create a \_\_\_\_\_ for tracking changes to files. \- Project \- Git deployment \- Repository \-.javaSettings file Repository To start tracking changes to the project files, as well as new.java files, you would right-click and use which of the following sub-menus. \- Team \> Add to Index \- Team \> Commit \- Git \> Init \- Git \> Commit Team \> Add to Index Which project folder should be added to the.gitignore settings file inside your project\'s Git repository? \- /src/ \- /bin/ \- /.gitignore/ \- /.project/ /bin/ After making changes to a source code file, I would right-click and use which of the following sub-menus to commit the changes with Git. \- Team \> Add to Index \- Team \> Commit \- Git \> Init \- Git \> Commit Team \> Commit You can also click the terms or definitions to blur or reveal them Hide definitions ##### When memory mapping a variable with reference-type that does not reference an object, we place \_\_\_\_\_ into the box representing the variable. \- ref \- null \- the literal value \- nothing null When memory mapping a variable of primitive type, we place \_\_\_\_\_ into the box representing the variable. \- ref \- null \- the literal value \- nothing the literal value Are Strings in Java a reference type? \- yes \- no yes When memory mapping a reference type, we annotate the class name within \_\_\_\_. \- { and } \- \\> \- \[\[ and \]\] \- \* **and** \* \\> When memory mapping an array we use a rounded-rectangle that contains \_\_\_\_\_\_ to represent array elements. \- a column, or row of contiguous boxes \- a single large rectangle \- literal values separated by spaces \- boxes with the indexes inside the array a column, or row of contiguous boxes You can also click the terms or definitions to blur or reveal them Hide definitions Given this code, what would a memory map look like? Sheep\[ \] sheeps = null \- I would write variable sheeps, and draw an adjacent box with null in it. \- I would draw a box with null in it. \- No need to diagram anything, it us null so there is absolutely nothing in memory. I would write variable sheeps, and draw an adjacent box with null in it. Given this code, what would a memory map look like? Sheep\[ \] sheeps = new Sheep\[2\]; \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, but each element is null. \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, and each element references a Sheep object. \- Sheep\[ \] on the left is empty so this is a syntax error, there will be nothing in memory as they program did not compile. I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, but each element is null. Given this code, what would a memory map look like? Sheep\[\] sheeps = { new Sheep(), new Sheep() }; \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, but each element is null. \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, and each element references a Sheep object. \- Sheep\[ \] on the left is empty so this is a syntax error, there will be nothing in memory as they program did not compile. I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, and each element references a Sheep object. Given this code, what would a memory map look like? Sheep\[\] sheeps = new Sheep\[200000\]; \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, but each element is null. \- I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, given the size I would only show two to three elements each with null inside. \- I would draw a box with only \[200000\] inside it. I would write variable sheeps, and draw an adjacent box with ref in it and an arrow to an array object, given the size I would only show two to three elements each with null inside. To note the data type of an array object in a memory map, I can place \_\_\_\_\_ inside the rounded rectangle representing the array object. \- \ \- \[\] DataType \- \[\] variableName \[\] DataType Should constructors have console input / output? \- No \- Yes No Should accessors and-or mutators have console input / output? \- No \- Yes No What is(are) the design problem(s) with the createReport() method, for class orange in Hybrid 11? \- Too many tasks inside one method. \- Mutating fields when this would not be expected. \- Modifying System.out with calls to println() that would not be expected. \- All of the other answers to this question are correct. All of the other answers to this question are correct. Why should we avoid using static for everything? \- We will only have one copy of the fields in memory, making it impossible to have objects with separate field values. \- If we use static for everything all of our variables will be constants and cannot be changed. \- Static methods are okay, who needs \'this\' anyway? We will only have one copy of the fields in memory, making it impossible to have objects with separate field values. Why should fields be marked private? \- To make it harder for external code to create side-effects in my class. \- So that the implementation of the class is hidden. \- Both of the other answers for this question. Both of the other answers for this question.

Use Quizgecko on...
Browser
Browser