CS Chapter 1 Flashcards

(28 cards)

1
Q

What is computational thinking?

A

the thought process needed to build correct, precise, logical programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When was Java first publicly released? Who was the main developer?

A

1995; James Gosling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a computer program?

A

specific set of ordered operations for a computer to perform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is input?

A

a program gets data from the user (through keyboard, touchscreen, etc.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is process in terms of input and output?

A

A program performs computations on the user input data, such as adding two values like x + y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is output?

A

A program puts that data somewhere, such as to a file, screen, network, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Variable

A

used to store information to be referenced and manipulated in a computer program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Algorithm

A

a sequence of instructions that solves a problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Problem solving

A

creating a methodical solution to a given task

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

main()

A

entry point to start the execution of a program; executes program within its curly braces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

semicolon

A

placed at the end of every statement, as English sentences end with a period

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What code enables a program to get input?

A

import java.util.Scanner;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Scanner

A

Java class used to obtain input from the user in the form of words, number, and phrases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to use Scanner

A

Scanner scnr (or any name) = new Scanner(System.in);

x = scnr.nextInt();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

string literal

A

text in “double quotes”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

System.out.print(“”) vs System.out.println(“”)

A

System.out.println() starts a new line after the desired text

17
Q

newline character

A

\n; written within string literals to being new lines. Ex. 1\n2\n3\n

18
Q

Comment

A

Text a programmer adds to code, to be read by humans to better understand the code but ignored by the compiler

19
Q

single-line comment

A

starts with // and includes all the following text on that line; commonly appear after a statement on the same line

20
Q

multi-line comment

A

starts with /* and ends with */, where all the text in between is part of the comment; also known as a block comment

21
Q

Whitespace

A

refers to blank spaces between items within a statement and blank lines between statements; mostly ignored by compiler

22
Q

Whitespace Guidelines

A
  1. Use blank lines to separate conceptually distinct statements
  2. Indent lines the same amount
  3. Align items to reduce visual clutter
  4. Use a single space before and after any operators to make statements more readable
23
Q

Compiler

A

converts high level program into executable program using Java bytecode; scans code line-by-line; recognizes end of statement by semicolon; ignores comments and most whitespace

24
Q

Syntax error

A

violate programming rules on how symbols can be combined to create a program; ex. forgetting to use semicolon, uninitialized and undefined variable

25
Good Practice for fixing errors reported by the compiler
1. Focus on FIRST error message, ignoring the rest. 2. Look at reported line of first error message. If error found, fix. Else, look at previous few lines. 3. Compile, repeat.
26
Logic errors
error (bug) that occurs while a program is running; program doesn't run as intended; sometimes indicated by compiler warning
27
What practice, involving compiling is good for beginners?
compiling frequently after writing a few lines of code will prevent too many errors from occurring
28
javac -Xlint yourfile.java
enables all recommended warnings