CIS 104 Exam 3 Review

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

java is a _____ oriented language

object

If a variable is not declared as static it cannot be directly used in a static method.However, it can be indirectly accessed as an ______ -_____

object attribute

If at least _____ operand is a ____ ____ number in the division the the answer will be a ___ ____ as well.

one floating point

System.out.println("Please enter length + "\n") is used to?

output results on the screen

in the structure of a java program what comes second?

package imports

If you need the operations in a statement to be done in a certain order, use?

parentheses

out is a ____ _____ member of _____

print stream System

The break statement is an immediate exit from the innermost switch, while, do-while, or for statement and the _____ executes the____ ____ after that.

program first statement

______ expressions evaluate to the ______ values true or false

relational boolean

Widely used in hashing functions, modulus produces the interger ____ after two numbers are divided

remainder

A ____ _____ specifies that a group of statements is to be repeated while some condition remains true

repetition structure (loop)

the _____ keyword is used to actually return the value after the method processing has completed

return

in addition to taking inputs in the form of parameters, methods also can ____ _____

return values

associativity of !

right to left

associativity of =

right to left

All statements in Java end with a?

semicolon

switch ( expression ) { case value1 : _________ break ; case value2 : ___________ break ; . . . default: ______________) break ; }

statement

even though it may contain many characters, think of a _____ as a single entity

string

nextLine gets a?

string

A ____ statement is provided because there is less clutter and it is easier to read.

switch

_______ ( expression ) { case value1 : statement(s) break ; case value2 : statement(s) break ; . . . default: statement(s) break ; }

switch

what provides an immediate exit from the innermost switch, while, do-while, or for statement?

break

what statement alters the flow of control in a program when used in while, do-while, for loops, and switch statements?

break

System.in.read does not input data in a friendly manner but instead as a?

byte stream

The ____ method should have a variable to receive the returned value

calling

you use a method by______ it

calling

Parentheses ____ the order in which operations are evaluated

change

Even if you don't need to change the order of execution, you can use parentheses to ____ a complex expression

clarify

The ____ for your program has a main method

class

a method in a _____ is a set of instructions or statements that provide some functionality by the class

class

in the structure of a java program what comes after the package imports?

class name

we use the import statement to make ____ with _____ we need available to us

classes methods

multiple arguments are separated by?

commas

Before using a variable you must give the ___ some information about the variable, you must ___ it

compiler declare

Data items in an array are stored_______ in _______

contiguously memory

Arrays can be composed from any____ ____ we need.

data type

what is a system class method for reading?

System.in.read

Which operator has second precedence right after ()?

!

Which operators have seventh precedence right after == != ?

&&

Which operator has higest precedence?

()

Which operators have third precedence right after ! ?

* / %

Which operators have fourth precedence right after */% ?

+ -

Which operators have fifth precedence right after + - ?

< <= > >=

Which operators have last precedence ?

=

Which operators have sixth precedence right after , < <= > >=?

== !=

in a switch statement the resulting value is compared with each of the___ _____ and if there is a match then the statements for that case are executed.

Case values

What are the two types of loops?

Counter-controlled and Event-controlled

What is this an example of? if (day == 0 ) { System.out.println ("Sunday") ; } if (day == 1 ) { System.out.println ("Monday") ; } if (day == 2) { System.out.println ("Tuesday") ; } if (day == 3) { System.out.println ("Wednesday") ; }

Multiple selection with if

what is a class with methods that analyze an input stream?

Scanner

We use ____ ___ as a helper class in our class work

Scanner class

switch ( expression ) { case value1 : statement(s) ________ ; case value2 : statement(s) ________ ; . . . default: statement(s) break ; }

break

in java what is used to create a program?

a class

what may contain many characters.

a string

Outside a method, a variable can be declared ______ and it is a _____ attribute

anywhere class

System.out.println("HelloWorld"); calls the method println() with a single ______ also called a ______

argument parameter

System.out.println("Please enter length + "\n") ______ to the function are listed inside parentheses "()"

arguments

what is a collection of data items that share the same name and the same data type.

array

____ _____ take two expressions as operands

binary operators

The ______ causes program control to jump to the closing brace of the switch structure.

break

usually the last statement in a switch statement should be a?

break

The scanner class converts the input stream into tokens, You can convert these tokens into the needed ____ ______ by using the various next methods •nextInt to get an integer •nextLine to get a string

data type

The declaration statement has _____ _____the of the variable followed by the_____ ____

data type variable name

what is the basic form of a variable?

datatype variable;

A variable declared within a method can only be used from the point of _______ to the end of the ______

declaration method

_____ should be placed at the beginning of a method before any executable statements

declarations

The visibility or scope of a variable depends on where they are _______.

declared

Within a method, a variable must be ______ before it is used

declared

A switch statement will compile without a____ _______, but always consider using one.

default case

The fractional part of any answer is _______ with integer division.

discarded

A ________ block is always executed at least once

do-while

how is a do-while loop constructed?

do{statement}while(condition);

Each data items is known as an ______ of the array. An array's elements can be accessed individually.

element

int i = sc.nextInt(); is an example of?

external method

when you include the name of the object you instantiated that contains them its called?

external method

Once an array is instantiated, its size remains ____.

fixed

with counter-controlled repetition, a ______ loop is the best choice

for

The initialization of the loop control variable, the loop continual condition test, and increment of control variable are handled in the?

for loop structure

how is a for loop constructed?

for(expression1;expression2;expression3){statement}

_____ -_____ are declarations of local variables. The values passed are assigned to those variables.

formal parameters

the type of value return is indicated in the ______ of the method

header

in the structure of a java program what comes first?

header comments

Java has some ___ ____ that take a byte stream and repurpose it for certain uses

helper classes

what statement can be used with while loops?

if statement

what is the structure of an if statement?

if(condition){statement}

what is the structure of an if-else statement?

if(condition){statement}else{statement}

we use the ______ statement to make classes with methods we need available to us

import

If a method and its class are not available in the base java, you use an _____ ___ to incorporate it into your program

import statement

Each data items is known as an element of the array. An array's elements can be accessed ______.

individually

declaring variables you can use the basic form datatype variable; and you can also give ___ ____ which looks like datatype variable = ______;

initial value expression

for(exp1;exp2;exp3){statement} what is exp1?

initialization

System.out.println("Please enter length + "\n") would prompt the user to ____ needed data.

input

Expression or identifier must be of type?

int, char, short, or byte

nextInt gets an?

interger

Integer division occurs if both operands are ______.

intergers

in a modulus operation both operands must be?

intergers

______ is a collection of interacting objects

java

System.out.println("HelloWorld"); is an example of?

java statement

associativity of &&

left to right

associativity of * / %

left to right

associativity of + -

left to right

associativity of < <= > >=

left to right

associativity of == !=

left to right

associativity of ||

left to right

associativity of ()

left to right/inside-out

Formal parameters are declarations of ____ _____. The values passed are assigned to those variables.

local variables

Methods only have acces to their own ____ -______

local variables

I you need to test multiple conditions in order to make a decision, use -______ _____.

logical operators

____ -______ combine simple conditions to make complex conditions

logical operators

for(exp1;exp2;exp3){statement} what is exp2?

loop continuation test

Every program must have a ___ ___

main method

in the structure of a java program what comes after the class name?

main method

what is the starting point for your program?

main method

Methods only have access to their own local variables. This includes _______

main()

a _____ in a class is a set of instructions or statements that provide some functionality by the class

method

println() is a ?

method

you use a ____ by calling(invoking) it

method

Formal parameters are declarations of local variables. The values passed are assigned to those variables. Other local variables can be declared within the____ -______.

method body

System.out.print statement is a?

method call

You can add other _____ and call them from main.

methods

You can import ______ from external packages like Scanner but you will also need to write your own _____ to provide the solution to the business problem

methods

nextInt, next, nextLine, are all?

methods

what are a key part of classes?

methods

what implement the operations we need to perform to solve the problem?

methods

what implements algorithms?

methods

logical operators test ____ -____

multiple decisions

What is this an example of? if (day == 0 ) { System.out.println ("Sunday") ; } else if (day == 1 ) { System.out.println ("Monday") ; } else if (day == 2) { System.out.println ("Tuesday") ; } else if (day == 3) { System.out.println ("Wednesday") ; } else if (day == 4) { System.out.println ("Thursday") ; } else if (day == 5) { System.out.println ("Friday") ; } else if (day = 6) { System.out.println ("Saturday") ; } else { System.out.println ("Error - invalid day.") ; }

multiple selection with if-else

your own methods are called by just their _______(along with parameters)

name

An array is a collection of data items that share the same _____ and the same ___ ___.

name data type

what means one loop is embedded inside another?

nesting

"\n" denotes a?

newline

is it uncommon to see nested for loops?

no

in a ______ statement the resulting value is compared with each of the case values and if there is a match then the statements for that case are executed.

switch

You can easily add new cases to a ____ statement but that becomes involed with the cluttered nested _______ structure

switch if-else

_____ is a class which is a collection of data and functionality, having computer system related capability

system

System.in.read is a ___ _____ method

system class

in the structure of a java program what comes after the main method?

the body of the program

what in a switch statement is executed first?

the expression

Scanner class converts the input streams into?

tokens

for(exp1;exp2;exp3){statement} what is exp3?

update of control variable

int width; boolean answer; are examples of ?

variable declarations

If a _____ is not declared as static it cannot be directly used in a _____ method

variable static

in an event controlled repetition what loop would you use if it was potential a block my never execute?

while

with event controlled repetition a ____ loop is the best choice

while or do-while

how is a while loop constructed?

while(condition){statement}

Java has three repetition structures what are they?

while, for, and do-while

can a nested loop be inside any other control structure?

yes

can any control structure (sequence, selection, or repetition) be nested?

yes

can loops be nested?

yes

is a if-else structure more efficient than a if structure?

yes

is a nested if else and a switch statement equally efficient?

yes

Which operators have eighth precedence right after && ?

||


Set pelajaran terkait

Evolution of Plants and Angiosperms Study Guide

View Set

Lists in python (Codecademy - Python 3)

View Set

Musculoskeletal (Ch. 35-37) med-surg II

View Set

Module 14 - Infancy and Childhood - Retrieval Practice & Review

View Set

Marketing Quiz (Ch. 12, 13, 14, 15)

View Set

Exam 3 Immune/Respiratory questions

View Set

Chapter 21 World History, Sec 2,3,4

View Set

Lean Six Sigma Green Belt - Week 1: Introduction to LSS

View Set