CSCI 111 Final Exam

¡Supera tus tareas y exámenes ahora con Quizwiz!

A while-loop is an ___________ controlled loop

event

Declaring a constant

final double PI = 3.14159;

Logic error

produces incorrect results

What is the structure of a simple java program?

public class Welcome{ public static void main(String[]args){ System.out.println("Welcome to Java!"); } }

How to write a Switch with break

switch (num){ case 1: System.out.println("one"); break; case 2: System.out.println("two");

What are overloaded methods?

they enable you to define the methods with the same name as long as their signatures are different (different parameter list)

What is a while-loop that never evaluates to false?

Infinite loop

Syntax error

detected by a compiler

1110001 into a decimal number

(1 x 2^6) + (1 x 2^5) + (1 x 2^4) + (0 x 2^3) + (0 x 2^2) + (0 x 2^1) + ( 0 x 2^1) + (1 x 2^0) = 113

What are the numeric operations

+ - * / %

What are the assignment operators

+= -= *= /= %=

What is the syntax for method header?

modifier returnValueType methodName(list of formal parameters)

Construct an if-statement that outputs "hot" if the temp is above 90 degrees or "cold" if the temperature is below 55 degrees

((Attempt on paper))

What is assembly language?

-An assembler is used to convert assembly language programs into machine code

What is high level language?

-English like language

What is machine language?

-Written in binary code -set of primitive instructions

What are the 6 data types?

-byte -short -int -long -float -double

Writing a class in Java

-class is a template -an object is an instance of class -a class uses variables to define data fields & methods to define actions -constructors are invoked to create a new object and designed to perform initializing actions

How often for a for-loop execute?

A fixed number of times

What does 52 % 8 yield?

4 (the remainder)

What is a method?

A collection of statements grouped together to perform an operation

What is an array?

A data structure that represents a collection of the same types of data

Can an int be assigned to a double and vice versa?

An int can be assigned to a double but a double cannot be assigned to an int

Runtime error

Causes program to abort

What are the values in an array called?

Element

How is a constructor named?

It must have the same name as the class itself

What is a void method?

It preforms actions

Does a constructor have a return type?

No it does not have a return type and it is invoked using the new operator

Does a void method have a return statement?

No it does not return a value

What must formal and actual parameters match in? (3)

Number Order Data Type

What is an iteration?

One execution of a loop block

Public vs Private class

Public is acceptable to all clients, private is not

Using sample as your array name, how can you represent the length of an array?

Sample.length

Scope of a Variable

Start from the declaration of a variable and continues to the end of the block that contains the variable

Pass by Reference

The declared functions are declared as references, so any changes made to the reference can be passed through the argument

Naming a variable

Use lowercase letters unless it is multiple words, then use lowercase for the first letter, and uppercase each word after

Local Variable

Variable thats declared within the body of a method

Pass by Value

When invoking a method with an argument, the value of the argument is passed to a parameter

When is a while loop used?

When we don't know how many iterations are to be preformed

1110001 into a hexadecimal number

add a zero to the beginning 0111 / 0001 = 71

How to create an array

arrayRefVar = new dataType[arraySize]; ex: myList = new double[10]

A for-loop is a ___________ controlled loop

count

Declare & create an array

dataType[ ] arrayRefVar = new.dataType[arraySize];

How to declare an array

dataType[ ] arrayRefVar; ex: double[ ] myList;

Declaring a variable

int x; double radius; char a;

How to run a file?

java TestFile

How to compile a file?

javac TestFile.java

What do you call a method from the same class?

methodName(yyy,zzz)


Conjuntos de estudio relacionados

Radiation, Convection, and Conduction

View Set

10年文法不白學49-was和were的疑問句

View Set

Chapter 7 OCD and Trauma Related Disorders Multiple Choice

View Set

psychology quiz questions Matt Tolbert

View Set

World Geography: 5.1, 5.2, & 5.3

View Set

Chapter 32: Assessment of Hematologic Function Questions

View Set

Objective 5: Communication and Organizational Behavior

View Set

DNA- The structure of DNA 12.2 pg 344-348

View Set