KAMSC Computer Science Semester 1 Final

Ace your homework & exams now with Quizwiz!

Negation (not) operator

!

Name the part of the for loop in extra parentheses: for(int j=0; [j<5], j++)

"if" conditional

Increment operator

++

Arithmetic operators

+, -, *, /, %

Arithmetic assignment operators

+=, -=, *=, /=, %=

Modulo

-% division with integer remainder -only works on int variables

Decrement operator

--

Machine language

-Binary code made up of 0s and 1s; usually this is data converted from a high-level language by a compiler. -Often used as a synonym for low-level programming language. -Each computer can only understand its own machine language (machine dependent). Level 1, so it is directly readable by the machine.

Assembly language

-Level 2, so it is not directly machine readable. It's translated by the language's own translator (assembler). Considered pneumonic devices. One to one correspondence (one assembly instruction=one machine instruction)

ASCII

-a code for representing English characters as numbers, with each letter assigned a number from 0 to 127 -American Standard Code for Information Interchange -8 bit code -subset of Unicode

#include <fstream>

-allows us to get file input and file output

#include <iostream>

-allows us to use cin, cout, keyboard, and monitor by pasting in code

What are the properties of functions?

-also called methods! (again) -always have ( )'s -may or may not have arguments (parameters) -an object's functions are accessed (invoked) via the dot (.) operator

An array allows you to have....

-as many variables as you want with the same name -uses an index (subscript) [ ] and always start at 0 because they are multiplying

Project

-copy of the IDE that is currently adapted to the platform (computer system) you are running on. Not the same on each computer! -hardware, software, language

Editor

-creates source code/module/file, which is the file that has the program in the high-level language -text file, not machine friendly

The six phases to execute a C++ program are...

-edit: using an editor program to edit the file -preprocess: uses the preprocessor directives to make certain manipulations happen before compiling (like adding other files into the file -compile: translates the program into machine language -link: a linker is used to link the object code with the "missing" functions to produce an executable image -load: the loader takes the executable image from disk and transfers it to memory -execute: the CPU executes the program one instruction at a time

Procedural languages

-have inputs, code with functions (procedures) and then outputs -an example is BASIC, C, FORTRAN, Java, Pascal

Individual characters of a string are accessed through an...

-index (subscript) -Numbering of the characters begins at 0 for the first one, so the index of the last character is the length of the string -1 -subscripts are usually accessed through a for loop and loop counter

Name the part of the for loop in extra parentheses: for ([int j=0]; j<5, j++)

-initialization statement -int is the declaration type -j=0 is the loop counter variable

IDE

-integrated development environment; a programming environment that includes an editor, compiler, and debugger

RAM

-random access memory -if computer is not on it stores nothing -located in primary storage -volatile=temporary=main

Key word

-reverse word -words that cannot be identities and are always lowercase (for, int, if, return)

High-level languages

-single statements could be written to accomplish substantial tasks -Level 3. The more human friendly they are, the less machine friendly they are. -Includes object-oriented programming and procedural languages -translator programs called compilers convert high level language programs into machine language -interpreter programs directly execute high-level language programs without the need for compiling the programs into machine language

<< and >> are called ___ _____ when used with cin and cout

-stream operators (stream insertion operator for << and stream extraction operator for >>) -the interaction involving cin and cout is called conversational/interactive computing

A compiler finds syntax errors. What else does it do?

-translates the code into machine language. The direct translation is called the object code/module. It is not executable (.exe)

Control structures

-under the umbrella of repetition structures

String

-word input -object

The three C++ program file extensions are...

.cpp, .cp, .c++

Order of operations

1. Parentheses 2. multiplication/division/modulus from left to right 3. addition/subtraction from left to right

Unicode

16 bit code that our computers in class use

What are the variable sizes (amount of RAM memory)? int float double char

32 bit, 32 bit, 64 bit, 8 bit

Supercomputer

50's/60's size computers (many rooms)

One byte equals how many bits?

8

Relational operators

< , <=, >=, >

Equality Operators

==, !=

Give an example of an interpretive language, and a language that is both compiled and interpreted

BASIC; Java

The UNIX operating system used _____, which is the basis for C++

C -C++ was made because variations of C were coming out

operator overloading

Defining the behavior of most C++ operators for new types

Editor _ _ _ _ ______> _ _ _Compiler__> ______> three boxes-> __linker__> _ _ _ _ ______> _ _ Source Code Object Code .exe

Diagram of how things become executable

EBCDIC

Extended Binary Coded Decimal Interchange Code -developed for the IBM mainframe

KB MB GB TB

KB=kilobyte, 10^3 thousand bytes (1024!!!) MB=megabyte 10^6 million bytes (1024^2) GB=gigabyte 10^9 billion bytes TB=terabyte 10^12 trillion bytes

Can you put a semicolon at the end of a for loop?

NO HECK NO (makes it run only once)

Does C++ include strings?

No, but #include <string> does

Nested for-loop

a for loop that runs completely within another for loop

All computers do is...

add/multiply/compare things really fast

Identifier

anything the programmer creates

The five bases we translated are

base, decimal, hexadecimal, binary, octal

Bit =

binary digit

= and + are called ____ ____

binary operators (because they each have two operands, like num_1 + num_2 or num3=sum)

The smallest unit of storage is a ___, which is one character of information

byte

Interpreter

code translator that takes code one statement at a time, translates/executes it, but does not save it

Using multiple stream insertion operators (<< and >>) in a single statement is referred to as....

concatenating, chaining, or cascading stream insertion operations

Declaring a variable gives it a...

data type, size, reserving space in RAM for storing the value, and a name

All variables must be ____, but accumulators and counters must be ____

declared; initialized

object-oriented programming

designing a program by discovering objects, their properties, and their relationships. Includes SmallTalk, C++, Java, Python, Visual Basic

structure programming

easier to test, debug, and modify because you are organizing code in logical blocks

Bugs mean

errors

\ is called the ___ character

escape

Typeless languages

every data item occupies one word in memory and the burden of treating a data item as a whole number or a real number fell on the shoulders of the programmer -BCPL and B

The counter-control repetition structure is the...

for loop

Classes and objects have...

functions

Program

gives the computer instructions

the .length() operator counts...

how many characters there are in a string

Name the part of the for loop in extra parentheses: for(int j=0; j<5; [j++])

incrementation statement

Linker

links code from computer and combines it with your code

Variable

location in the computer's memory where a value can be stored for use by a program -all variables must be declared with a name and a data type before they are used in a program -FOUR MAIN PARTS ARE NAME, TYPE, SIZE, VALUE -each variable corresponds to a location in memory

Trace logic is used to find ____, which are ____

logic errors; when you say find sum but want it to multiply -trace logic is using cout statements to "make a picture of what I am doing"

0=off and 1=on. They are actually ____

magnetic spots/electrical impulses

Another name for a C++ function is a ____

method

The statement "using ____ std" aids us in using strings in a C++ program

namespace

The ___ operator is used to invoke an object's functions

overloading

The # operator is called the _____ _____ when used with commands like include

preprocessor directive

The three parts of a C++ system are...

program development environment, language, C++ standard library

The __ command is cout, while the ___ command is cin

prompt, receive

Literals are...

raw numbers in code (ie int dog = 7;)

Loop counters are declared in the loop so they can only be changed in the loop. The ____ of a variable is where it exists in the program

scope

cin >> reads in strings that are...

separated (delimited) by whitespace (tabs, returns, spaces)

Truncated

shortened; cut off (no rounding occurs)

Mainframe

size of a big room

Microcomputer

size of a computer that fits on a desk (phone, laptop)

Minicomputer (mid-range computer)

size of a desk

Run time/fatal error

special case that crashes code (most common error is the divide by zero error)

Initializing a variable gives it a...

starting value

A ___ in C++ is anything ending in a semicolon

statement

The semicolon is also called the _____ _____ and the ____ ______

statement terminator; statement delimiter

Algorithms are

step by step instructions

The debugger, which steps through commands, slowing things down, is also called a ___

stepper

Endl is called a ____ ____

stream manipulator

getline(cin, string) reads in...

strings that are determined by line returns

Substr means

substring

Any variables not declared will cause ____ errors, but variables that need to be initialized and aren't will cause _____ errors

syntax; logical

an infinite loop is when...

the program never stops. It is a logical error. -for (int j=0; j>5; j++) will never run because j is never greater than 5. This is the opposite problem

Computer systems include...

user, software, hardware

Concatenating

using + or += to join two or more strings together into one

Constant variables (const int) are...

variables that cannot change and give numbers/tasks a description, thus making it way easier to edit code

Data types are used to declare _____, while classes are used to declare _____

variables, objects

Syntax errors

violations of the rules of the language (no semicolon, spelling errors)

Platform independence/independent

when one computer can only talk to those kinds of computers

Do compiled programs execute faster than interpreted programs?

yes


Related study sets

Essential Words for Ielts Unit 4: Culture

View Set

Micro Lab 7 Bacteriophage, Fermentation, Environmentall Effects I and Antimicrobials

View Set

Chapter 2: Beginnings of English America, 1607-1660

View Set

automotive electrical I Chapter 5

View Set

Week 5 - Decision Making Under Uncertainty

View Set

Unmanned Aircraft Safety Guidelines

View Set