CS 105 Quiz 1 Review Flashcards

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/48

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering core concepts, error types, syntax, and memory terms from CS 105 Quiz 1 notes.

49 Terms

1
New cards

Program

Instructions for a computer.

2
New cards

Programming language

Syntax (a way) to write programs.

3
New cards

Operating system

The greater program that runs a computer (ex: windows).

4
New cards

Designer (role and steps)

Makes a plan to solve a problem.

Inputs – Process (modifying input) – Outputs

5
New cards

Test plan

Series of tests done that have an expected outcome.

6
New cards

Decomposition

Breaking down into simpler stems.

7
New cards

Syntactic Errors

Non allowed sequence in the language; spelling errors, missed punctuation.

8
New cards

Semantic Errors (also called…)

Run time errors:

Logic, formula, or conversion errors; non-expected results produced (ex: infinite loop).

9
New cards

Thematic Errors

Errors caused by not solving the correct problem.

10
New cards

Warning

Message indicating code does not fail, but compiler thinks there may be a problem.

11
New cards

Error

Finds error and fails to compile.

12
New cards

Source Code

The original code to solve a problem written in human coding language.

13
New cards

Compiling

Turning source code into binary language/computer understandable language.

14
New cards

Linking

Bringing in libraries to a code.

15
New cards

Executable

(.exe) the result of compiling and linking for a computer to run.

16
New cards

White space

Spacing not recognized by compiler.

17
New cards

Variables

Stored values that can change (need to be declared – stated to exist).

18
New cards

Initialization

Value given at declaration.

19
New cards

Assignment

Value given later in an execution statement.

20
New cards

Identifiers

Identify a variables (case sensitive), can not start w/ a digit, cannot contain spaces, cannot use c++ keywords, usually lowerUpperAfter.

21
New cards

Main memory

Storage of main data in a computer.

22
New cards

Bit

11 or 00 = on or off.

23
New cards

Byte

Stores a keystroke (88 bits).

24
New cards

Constant

An identifier that has a non changing value (const int ALLUPPERCASE=#) which must be initialized.

25
New cards

Literal constants

Used directly in code; Characters in '', string in "".

26
New cards

Output stream

cout <<

27
New cards

Input stream

cin >>

28
New cards

Standard Template Library (STL)

Library of all worldwide C++ functions.

29
New cards

Expression

Sequence of identifiers and operaters for evaluation.

30
New cards

Operator

Modifies values (=, +, -, etc.).

% is remainder

(Ex: 5%4 is 1)

31
New cards

Operand

Value being modified by an operator.

32
New cards

Precedence

Which operation has greater importance (multiplication, addition, assignment).

<p>Which operation has greater importance (multiplication, addition, assignment).</p>
33
New cards

Associativity

Equal level precedence procedure (left to right).

34
New cards

Types of control

o   Sequential (normal): execution proceeds one after the other

o   Selection (if-then-else): dependent on conditions

o   Iteration (looping): repeating until condition(s) are met

35
New cards

If else statement

If statements – If true then statement executed

  • if (condition) { statement; statement;  }

  • Contains <, >, >= (greater than or equal to), <= (less than or equal to), == (equal to), != (not equal to)

    • Nested if statements: an if statement within a larger if statement

  • Else statement

    • If (condition) {statement(s);}

      • Else {statement(s);}

o   Cascaded if/else statements: an if statement containing an else statement with its own ifs/else’s

36
New cards

Compound Statements

one or more statements in a set of curly braces - must be used for multiple statements in if/else conditionals

37
New cards

Boolean values

Boolean values: true or false

  • If/else break down to bool

  • Can be =true or =false


<p>Boolean values: true or false</p><ul><li><p class="MsoListParagraphCxSpMiddle">If/else break down to bool</p></li><li><p class="MsoListParagraphCxSpLast">Can be =true or =false</p></li></ul><p></p>
38
New cards

Logical Operators (+what has precedence?)

o   && (both statements are true), | | (one or the other statements are true)

o   && has precedence over | | (followed by assignment)

39
New cards

Switch Case Statement

  • selects from multiple actions/cases

  • Can only be integer or character

—

  • switch (condition)

  • { switch #: 

  • statement; break;

  • …

  • default: '

  • statement; break;}

*if this is a CHAR situation, MUST BE IN ‘ ‘

40
New cards

Types of Control

Types of control

  • Sequential (normal): execution proceeds one after the other

  • Selection (if-then-else): dependent on conditions

  • Iteration (looping): repeating until condition(s) are met


41
New cards

do/While loop

while (condition)

{ statements)

OR

Do { statement(s);}

while (condition);

42
New cards

For

For (statement 1; condition; statement 2)

{action(s)}

—

ex: for (i=0; i<integer; i++)

{ A1 [i] = i+i }

43
New cards

Strings

  • #include <string>

  • “strings have to be in double quotes”

  • string1[#] ← allows to acess induvidual charecters

  • string1.length() ← gives length of it

  • can be added: string1 = “a” + string1 + “b”


44
New cards

input failure

  • bad input = failed state

  • if (!cin)

  • cin. clear()

  • cin.ignore(200, ‘\n’)

dash is opposite way of comments (//which go from down to up btw)


45
New cards

Files

file: place for permanent data storage

  • #include <fstream>

  • ofstream variableName1;

  • ifstream variableName2;

  • variableName1.open(“datafile.txt”);

  • variableName1 << num1 << “ “ << num 2 …

  • variableName1.close();

  • variableName2.open(“datafile.txt”);

  • variableName2 >> num1 >> num2 >> …

  • variableName2.close()


<p>file: place for permanent data storage</p><ul><li><p>#include &lt;fstream&gt;</p></li><li><p>ofstream variableName1;</p></li><li><p>ifstream variableName2; </p></li><li><p>variableName1.open(“datafile.txt”);</p></li><li><p>variableName1 &lt;&lt; num1 &lt;&lt; “ “ &lt;&lt; num 2 …</p></li><li><p>variableName1.close();</p></li><li><p>variableName2.open(“datafile.txt”);</p></li><li><p>variableName2 &gt;&gt; num1 &gt;&gt; num2 &gt;&gt; …</p></li><li><p>variableName2.close()</p></li></ul><p></p>
46
New cards

Functions

name () ←can be executed over and over

  • function name: identifier to call function [name]

  • Function parameters/argument: value passed into function for use by function code

    • copy of the value of the parameter is passed

    • Pass-by-value: changing the value of the parameter in the function does not change the original value

  • Function return value: value returned to function when calling back

  • Function prototype: declaring a function and how it is called

    • used by the compiler to signal syntax errors

  • If no return value, the type is void

  • Scope: area of a program within which a variable can be recognized

—

#include <iostream>

returnType functName (parameter type, paramater type); // prototype

using namespace std;

int main ()

…


double funtName(double a, double b);

a + a = b;


47
New cards
48
New cards
49
New cards