answers 100% correct 2025
program - correct answers consists of instructions executing one at a time. A
program starts in main(), executing the statements within main's braces { },
one at a time. Each statement typically appears alone on a line and ends with
a semicolon, as English sentences end with a period. The programmer-
created sequence of instructions is called a program, application, or just app.
basic instruction types - correct answers input, process, and output
input - correct answers A program gets data, perhaps from a file, keyboard,
touchscreen, network, etc.
process - correct answers A program performs computations on that data,
such as adding two values like x + y.
output - correct answers A program puts that data somewhere, such as to a
file, screen, network, etc.
variable - correct answers Programs use variables to refer to data, like x, y,
and z
computational thinking - correct answers creating a sequence of instructions
to solve a problem, will become increasingly important for work and everyday
life
algorithm - correct answers A sequence of instructions that solves a problem
, scanner - correct answers is a text parser that can get numbers, words, or
phrases from an input source such as the keyboard. The following code at the
top of a file enables the program to get input: import java.util.Scanner; Getting
input is achieved by first creating a Scanner object via the statement: Scanner
scnr = new Scanner(System.in);. System.in corresponds to keyboard input.
Then, given Scanner object scnr, the following statement gets an input value
and assigns x with that value: x = scnr.nextInt() ;
basic input - correct answers Programs commonly get input values, perform
some processing on that input, and put output values to a screen or
elsewhere. Input is commonly gotten from a keyboard, a file, fields on a web
form or app, etc.
The following code at the top of a file enables the program to get input: import
java.util.Scanner;
Basic output: Text - correct answers The System.out.print construct supports
output. Outputting text is achieved via: System.out.print("desired text");. Text
in double quotes " " is known as a string literal. Multiple output statements
continue printing on the same output line.
newline - correct answers System.out.println (note the ln at the end, short for
"line"), starts a new output line after the outputted values, called a newline. A
common error is to type the number "1" or a capital I, as in "in", instead of a
lower case l as in "print line". A new output line can also be produced by
inserting \n, known as a newline character, within a string literal. Ex:
Outputting "1\n2\n3" outputs each number on its own output line. \n consists
of two characters, \ and n, but together are considered as one newline
character. Good practice is to use println to output a newline when possible,
as println has some technical advantages not mentioned here.
outputting a variable's value - correct answers Outputting a variable's value is
achieved via: System.out.print(x); Note that no quotes surround x. println()
could also be used.