C Sharp chapters 4-6 flash cards

C Sharp chapters 4-6 flash cards

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

This is used to make single-alternative decisions and can determine whether an action will occur.

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

1

All-time users

1

Favorites

0

Last updated

7 years ago

Date created

Mar 1, 2020

Cards (63)

Section 1

(50 cards)

This is used to make single-alternative decisions and can determine whether an action will occur.

Front

IF statement

Back

A single equal sign in a C sharp statement is called what?

Front

the assignment operator. (used to set a value, not compare 2 values. Illegal assignments will generate errors.)

Back

What is a loop with no statements called?

Front

Empty body

Back

This is used to determine if two expressions are both true

Front

Conditional AND operator (represented by a double ampersand (&&) and MUST have a complete Boolean expression on each side of it)

Back

When might a program with an infinite loop end?

Front

When the loop fails due to a failure in computer memory or hardware failures

Back

What is it called when variables inside a loop stop after the loop ends?

Front

out of scope

Back

What tool helps programmers plan a program's logic by writing plain English statements?

Front

Pseudocode

Back

A double equal sign in a C sharp statement is used for what?

Front

To test for equality. (WILL compare 2 different values in a statement)

Back

What is the value called that a user must supply to stop a loop?

Front

Sentinel Value

Back

What does a while loop consist of?

Front

1. the keyword: WHILE 2. a Boolean expression within parentheses 3. the loop body

Back

this keyword usually terminates a switch structure at the end of each case

Front

break

Back

This keyword is followed by one of the possible values that might equal the switch expression

Front

case

Back

What is it called when you subtract from the loop control variable?

Front

Decrementing

Back

These decisions will have 2 possible resulting actions.

Front

Dual-alternative decisions

Back

These are used to perform two different actions based on if an expression evaluates as TRUE or FALSE.

Front

IF-ELSE statement

Back

diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.

Front

Truth tables

Back

What is a good practice to follow when writing a switch?

Front

Include a default case (not required but strongly encouraged)

Back

What are some ways to improve loop performance?

Front

- Make sure the loop avoids unnecessary operations - consider the order of evaluation for short-circuit operators - Employ loop fusion - Use prefix incrementing rather than postfix incrementing

Back

This keyword is optionally used prior to any action that should occur if the test does not match any case

Front

Default

Back

What are the rules for using nested loops?

Front

1. The inner loop must be entirely contained within the outer loop 2. Loops can never overlap

Back

These operators work exactly as their conditional counterparts, but do NOT support short-circuit evaluation.

Front

Boolean logical AND (&) and Boolean logical OR (|)

Back

This keyword starts a structure and is followed immediately by a test expression enclosed in parentheses

Front

switch

Back

How can you distinguish each array element from the others in in array?

Front

By using a subscript (also called an index)

Back

This is used to execute a body of statements continuously as long as some condition continues to be true

Front

WHILE loop

Back

What is the technique of combining two loops into one?

Front

Loop fusion (Chapter 5 packet, p. 11 slide 1)

Back

Statements that precede a block are called what?

Front

Control statement

Back

When a loop has a predetermined number of iterations it is called?

Front

Definite loop OR counted loop

Back

Multiple decisions can be loaded into a single IF statement using what?

Front

AND/OR operators

Back

This operator is written as an exclamation point and negates the result of any Boolean expression.

Front

NOT operator (NOT operator has higher precedence than the && and || operators)

Back

One or more statements contained within a pair of curly braces { } is called what?

Front

block

Back

What loop always enters the loop without testing and checks at the "bottom" of the loop after one repetition?

Front

DO loop

Back

This is used when a programmer wants some action to occur even if only one of two conditions is met

Front

Conditional OR operator (written as two pipes (||) and must include a complete Boolean expression on each side of the operator)

Back

What is used to create definite loops and allow the expression to alter the loop control variable?

Front

FOR loop (also called the step value)

Back

A list of data items that all have the same data type and the same name is called what?

Front

Array

Back

3 things to know about "garbage"

Front

1. It's a term for an unknown value 2. The C# compiler helps to prevent seeing an incorrect total by requiring you to provide a starting value 3. C# will not use the garbage value that happens to be stored at an uninitialized memory location

Back

The objects in an array are called what?

Front

Array elements

Back

The DO loop is what kind of loop?

Front

a post-test loop; one in which the loop control variable is tested after the loop body executes

Back

What is a never-ending loop called?

Front

Infinite loop

Back

What are some frequent errors in C sharp decision making?

Front

- using the assignment (=) operator instead of the comparison operator(==) - inserting a semicolon after the Boolean expression in an IF statement - failing to block a set of statements with curly braces { } -failing to include a complete Boolean expression on each side of an && or || operator

Back

What is an operator that takes three parameters?

Front

a ternary operator. Syntax of a ternary operator: testExpression ? trueResult : falseResult;

Back

Which structure involves choosing between alternative courses based on a value in the program?

Front

Decision Structure

Back

One decision structure contained within another is called what?

Front

Nested IF statement

Back

This tests a variable against a series of exact matches

Front

switch structure

Back

Unintended by-products of logical operators that can mess up C sharp statements

Front

side effects

Back

What is it called when a loop control variable is altered by user input instead of arithmetic?

Front

Indefinite loop

Back

Why should you use prefix incrementing rather than postfix incrementing?

Front

Prefix incrementing (++x) runs faster than postfix incrementing (x++)

Back

Expressions in each part of an AND expression, evaluated only enough to determine if the entire expression is TRUE or FALSE.

Front

Short-circuit evaluation

Back

What tool would you use to plan out the steps of a program by drawing them as a series of shapes connected by arrows or lines?

Front

Flowchart

Back

What is it called when you add to the loop control variable?

Front

Incrementing

Back

Which structure method has steps follow each other unconditionally in the order they were written?

Front

Sequence Structure

Back

Section 2

(13 cards)

What to the following methods do? Array.BinarySearch() Array.Sort() Array.Reverse()

Front

BinarySearch is used to find an element in an array, Sort is used to sort an array's elements, and Reverse reverses the order of elements.

Back

Are arrays fixed in size?

Front

No; programmers can change the size of an array

Back

True or false: If a size is declared then a value must be listed for each element in an array?

Front

True; Any array element that has a declared sized must have a listed value

Back

What is a length property?

Front

a length property is a member of the System.Array class that automatically holds an array's length.

Back

How do you declare and create an array?

Front

double [] sales; sales = new double[20]; (this is just an example)

Back

Why is a sequential search so named?

Front

Because it searches each array and examines them in sequential order

Back

What command is used to create new objects in an array?

Front

new operator

Back

How do you access a multidimensional array?

Front

by running multiple subscripts to access the elements

Back

What is a one-dimensional array?

Front

A data structure that allows a list of items to be stored with the capability of accessing each item by using a single subscript

Back

What are the qualities of a jagged array?

Front

1. a one-dimensional array in which each element is another one-dimensional array 2. each row can be a different length

Back

What is the highest valid index value?

Front

19

Back

What is the list of values provided for an array?

Front

Initializer list example: int[ ] myScores = new int[5] {100, 76, 88, 100, 90}; int[ ] myScores = new int[ ] {100, 76, 88, 100, 90}; int[ ] myScores = {100, 76, 88, 100, 90};

Back

What is the purpose of parallel arrays?

Front

Parallel arrays allow a programmer to use the same subscript to access additional information

Back