ProgrammingHybrids

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Hybrids Answers Compiled

What is the Diagram type we are learning to use in UMLet?

UML Class Diagram

What is the default file extension for UMLet diagrams?

.uxf

What is the difference between double and Double?

double is a primitive type; Double is a wrapper class.

What data type does the format specifier %s work with?

String

What data type does the format specifier %d work with?

Int

What data type does the format specifier %f work with?

double

What does %n do when used in a format String?

Write an operating system appropriate line terminator into the output.

What is version control?

Software that tracks changes to files.

Who created Git?

Linus Torvalds and the Linux community.

What is Git?

Git is a distributed (local and remote) version control system.

What is the Git command git init used for?

To create a new repository.

What is the command git commit used for?

To take a snapshot of files added to the staging area that have changes.

The heart of the programming process lies in planning the program’s logic.

True.

_____ errors are relatively easy to locate and correct because the compiler you use highlights every error.

Syntax

What term is used to refer to the computer instructions that are executed by a CPU?

Machine code
In java, every statement must end with which symbol?

A string variable can hold digits such as account numbers and zip codes.

True

The process of naming program variables and assigning a type to them is called ____ variables.

Declaring

The “building blocks” that Java programmers use to write computer programs are called ____?

Objects

Which statement about identifiers is correct?

Identifiers can be made up of letters, digits, and the underscore _ character.

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 the Above.

Declaring a class does not create actual objects.

True

The data components of a class that belong to every instantiated object are the class’s ____?

Instance Variables.

The access specifier in the declaration of instance variables should be _____

Private

A method header consists of which of the following parts?

An access specifier, a return type, a method name, and a list of the parameters (if any)

By using ____, you can use reasonable, easy to remember names for methods and concentrate on their purpose
rather than memorizing different method names.

Method overloading

Which one of the following refers to a number constant that appears in code without explanation?

Magic Number.

Which one of the following statements defines a constant with the value 123?

final int MY_CONST = 123;


Which one of the following operators computes the remainder of an integer division?

A short-circuit evaluation is where each part of an expression is evaluated only as far as necessary to determine
whether the entire expression is true or false.

True

A ____ expression is one that represents one of two states, usually expressed a true or false.

Boolean

String variables are usually not considered equal unless they have the same ____.

Spacing and case of each character.

What kind of operator is the <= operator?

Relational

What is a Method Call Stack?

An allocation of memory, used to store methods and their data.

What is the Heap?

An allocation of memory, used to store the reference types. (Objects)

What is a method call, within the Method Call Stack, referred to as?

Stack frame

What typically has more memory available, Method Call Stack or Heap Memory?

Heap Memory

Where are reference types (objects) stored in memory?

Heap

After creating a new Java project in Eclipse, to use version control with it, you need to create a _____ for tracking
changes to files.

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

Which project folder should be added to the .gitignore settings file inside your projects Git repository?

/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 > Commit


When memory mapping a variable with reference-type that does not reference an object, we place ____ into the
box representing the variable

null

When memory mapping a variable of primitive type, we place ____ in the box representing the variable.

The literal value

Are Strings in Java a reference type?

Yes

When memory mapping a reference type, we annotate the class name within ____.

<< and >>

When memory mapping an array, we use a rounded rectangle that contains ____ to represent array elements.

A column, or row of contiguous boxes

Given this code, what would a memory map look like? Sheep[] sheeps = null

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];

Write variable sheeps, draw an adjacent box with ref in it and an arrow to an array object, each element is null

Given this code, what would a memory map look like? Sheep[] sheeps = [new Sheep(), new Sheep()};

Write variable sheeps, draw an adjacent box with ref in it and an arrow to an array object, each element
references a Sheep object.

Given this code, what would a memory map look like? Sheep[] sheeps = new Sheep[200000];

Write variable sheeps, draw an adjacent box with ref in it and an arrow to an array object, given the size 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

Should constructors have console input/output?

No

Should accessors and-or mutators have console input/output?

No

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 filed 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 other answers for this question.

If you accidentally step into an API method, like System.in, what action(s) could you perform to return to your own
code and / or exit the debugging session?

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 step over.

All the above.

In Java, objects within the same class share common ____

Behavior

A method’s name and a list of parameter types together are its ____

Signature

The ____ clause of the decision is the part that executes only when the tested condition in the decision is false.

else

Forgetting to initialize and alter the loop control variable are common mistakes that programmers sometimes
make.

True

Which error type does the “off-by-one" error belong to?

Run-time error

When you search through a list from one end to the other, you are performing a ____

Linear Search

When an array myArray is only partially filled, how can the programmer keep track of the current number of
elements?

Maintain a companion variable that stores the current number of elements

In implementation hiding, the calling method needs to understand only the interface to the method that is called,
and it need not know how the method works internally

True

Which class category has static methods and constants, but no objects?

Utility class
The input to a method is called(n) _____?

Argument

How many overloaded versions of a method or constructor can you make?

As many as you want, provided each has a unique signature

Before a programmer pans the logic of the program, you must ____

Understand the Problem

A(n) ____ is a software package that provides an editor, a compiler, and other programming tools.

IDE

In a flowchart, the ____ is used to represent processing.

Rectangle

What are two uses for keyword “this” in the Java programming language?

Variable scope resolution, internal constructor calls

Any method in a class that is not an accessor, or mutator, can be generally referred to as _____

Work Method

Programmers say that variables and constant declared within a module are ____ only within that module.

In Scope

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy