Computer Science 1a First Six Weeks

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

Which flow chart shape indicates decisions?

Diamond

Condition/control expression

The second item in the header is also known as the 'control expression' and it tells the loop when to stop running. The condition must evaluate to 'true', or the loop will not run. As soon as the condition becomes false, the loop will stop running.

Step expression

The third item in the header tells the loop how much to increment each time the loop runs. The step expression is the part of the for loop that is supposed to ensure that the loop will end. If the step expression increases in the wrong direction, the loop will never stop. It will be an infinite loop. If it counts down, instead, that would be considered decrement.

What is true about echo chambers?

The user will not get a variety of opinions.

for loop

This type of loop typically has a specific number of times that it will repeat. It is a useful loop if the number of repetitions is already known.

What correctly declares and initializes a boolean variable named isEmployed with the value 'true'?

boolean isEmployed = true;

What is true about the impact of computing on society?

buyers and sellers can find each other more easily.

What gives a user a lot of information that they tend to agree with already?

echo chambers

How many symbols or characters can the 'char' data type hold?

1

Condition

A condition appears as a statement inside of parentheses. The statement evaluates to either true or false. If the condition is true, then the code block runs, if the condition is false, the code block is skipped.

What causes filter bubbles?

Algorithms that attempt to keep the users attention.

What is wrong with this Java code- int taxRate; 4.7

An integer variable cannot hold a decimal value.

Which flow chart shape shows the DIRECTION of flow or sequence of events?

Arrow

What statement is true about flow chart arrows?

Arrows can only point in one direction

What type of data type holds the smallest integers?

Byte

What follows the naming convention for a 'constant' variable that should not have its value changed?

CHANGE (a constant should be all capitals)

Where is the CPU installed?

In the motherboard

/* */ Multiple line comment

Is considered to be a comment and is ignored by the complier. These symbols are used to include large comments in the code. Adding comments to the code make it more readable. The opening symbol /* must always be matched by a closing symbol */, and are only used to create multiple line comments. These symbols can also be used 'comment out' several lines of code temporarily when troubleshooting.

// Single line comment

It is considered to be a comment that is not code, and is ignored by the complier. It only affects one line, and it is important to add comments to explain what the code is doing. The two slashes are considered one symbol.

What describes the operation of a single CPU?

It only reads and executes one instruction at a time, but it does it very quickly.

Which statement describes the relationship between memory and the CPU?

Memory stores instructions that the CPU will execute.

What would be an example of a network policy?

Not connecting to the network with a personal device

Which flow chart shape shows the beginning or end of a process?

Oval

Which flow chart shape holds actions or activities?

Rectangle

What is the difference between 'phishing' and spear 'phishing'?

Spear phishing appears to come from someone you know, but phishing may come from somebody you don't know.

What is an example of a reference data type?

String

Which has more storage?

Terabyte

What is the difference between the operating system and software applications?

The application must make requests to the operating system for access to system resources, like memory or CPU time.

initialization expression

The first item in the header tells the loop where to start. Typically, an integer is declared in the initialization expression. t is also possible to declare a variable outside of the for loop if it is going to be used in other places in the code.

{ } Curly brackets

These are used to group together into a block. All the lines of code between { and } are indented one level, which is usually 2-3 spaces. This helps to separate code into functional areas. If there is an opening curly bracket { then there must be a closing curly bracket }. Failure to have matching curly brackets will cause a compile error. Several levels of matching curly brackets can be nested inside of each other. They would look like { { { } } }, so that the first and last curly brackets match each other, the inner-most curly brackets match each other, and so on. These symbols are required, not optional.

What is true about data and instructions when the computer is turned off?

They are stored in the harddrive

What is true about 'cookies'?

They are text files that can not run.

What is true about date collected by web browsers and social media sites?

They store shopping and browsing information so they can target advertisements to the user.

Variables with meaningful names

This can be similar to a comment in helping yourself and others to understand what the code is doing and what data it is using. A variable named 'taxesPaid' is more understandable than 'tp'. Meaningful variable names remove the strain and inaccuracy of remembering.

Code block

This is a section of code that is grouped together, usually enclosed within curly brackets { }. A code block can be as small as only one line, or it may contain hundreds of statements. When a conditional is followed by a code block, the code block will not run unless the conditional evaluates to 'true.'

; Semicolon

This is normally the end of a statement. Any line that does not end with a semicolon is part of a larger arrangement of code, such as a code block. This symbol is required, not optional.

header

This is the line that introduces the for loop. It always starts with the key word "for" followed by parenthesis. Never put a semicolon at the of the header. The last symbol on the header line is usually the opening curly bracket {, but that could also be moved to the line below.

Body

This is the part of the for loop that has one or more statements that execute each time the loop runs. They are typically shown inside of curly brackets. When the for loop finishes running, the next line of code after the body will run. The body may have many statements within the curly brackets { }. Empty curly brackets will still allow the loop to operate, but each time it runs, there will be no lines to execute within the body.

White space

This is used to make code easier to read.

Indenting

This is very helpful in making the code readable. There are very few rules. Remember to start indenting one level deeper after an opening curly bracket { and bring the indentation back out one level when you reach the matching curly bracket }. Typically, a level of indentation is 2-3 spaces. A tab is considered too deep for indenting.

Else

This structure can only come after an 'if' or an 'else if' structure. The else does not have a conditions and its code block will only execute if all other conditionals have been false. It is good coding practice, but not required, to include an else with any conditional, so that it can handle any unexpected cases.

Else if

This structure follows an 'if' structure, or another 'else if' structure. This allows the programmer to check many conditions. Only the first condition in this group that is true will execute. Any other condition in a group of if, else if, else if... will not run after the first true condition has executed.

Switch

This structure is used to check on variable for many different values, with a different code block for each possible value. Each condition is begun with the key word 'case', followed by the value that would make that case true. At the end of each code block is the optional word 'break.' When the execution reaches the word 'break', it will skip any subsequent lines and go to the end of the switch structure. If it does not encounter a 'break' statement, it will continue to execute the lines that follow.

If

This structure uses a condition in parenthesis. Curly brackets are optional if there is only one line in the code block that follows the condition, but a block that is larger than one line must have curly brackets.

How many possible outcomes does a diamond (decision) need to have?

Two or more

What best describes 'catfishing'?

Using a false identity to get the users trust

What is an example of an operating system?

Windows

Do-while loop

always runs at least one time

Which type of data types holds the smaller decimal numbers?

float

What is an example of a programming language?

java

What is an example of a line of code that only declares a variable, but does not initialize it?

long worldPopulation;

What is used to create new programs and applications?

programming language

What is an example of a peripheral?

the printer

What is most likely to let others track our browsing and shopping history?

third party cookies


Set pelajaran terkait

Chapter 4: Public Relations and Community Relations: A Contrast

View Set

CHAPTER 28 CARING FOR PATIENTS REQUIRING OXYGEN THERAPY OR TRACHOSTOMY

View Set

Business: Qualities of an Entrepreneur (C1; CAE; Advanced; IELTS Band 7.5+ Business English) englishwizards.pl

View Set