WorksheetsCom prog reviewer prelims
Total questions: 100
Worksheet time: 2hrs 37mins
It is an electronic, programmable device that can store, retrieve, and
manipulate data
(a)
What are the two major components of a computer? ______ and ______
(a)
-tangible part of the computer
-composed of electronic and mechanical parts
(a)
-intangible part of the computer
- consists data and computer programs
(a)
Give the 5 examples of hardware.
(a)
where data and instructions needed by the CPU to
perform are stored
(a)
used to hold programs and data that the processor
is actively working on
(a)
used to hold programs and data for long term use
(a)
The following are examples of main memory except:
RAM
ROM
Cache
Flashdrive
The following are examples of secondary memory except:
RAM
Flashdrive
SD card
Hard Disk
an individual storage location in the
memory
(a)
the relative position of a memory cell in the
computer’s main memory
(a)
the information stored in a memory cell,
either a program instruction or data
(a)
-short for Binary Digit
- either a 0 or a 1
-smallest element a computer can deal with
- by grouping them together large range of values can be
represented
(a)
the amount of storage required to store a single character
(a)
How many bits make a byte?
(a)
-coordinate all computer operations
- perform arithmetic and logical operations on data
(a)
What does the CPU continuously do?
Run, Decode, Execute
Decide, Execute, Run
Fetch, Decode, Execute
Decode, Fetch, Execute
-can execute approximately
3.6 billions of instructions
per second
-able to produce complex
behavior at a speed
almost instantaneous to
human user
(a)
allows a computer system to interact with the outside world by
moving data in and out of the system
(a)
peripheral devices used to enter information for computation
e.g keyboard, mice, microphone
(a)
peripheral devices that receives data from the computer used for
observing the results of computation
e.g. monitor, printer, speaker
(a)
programs used by a computer to operate
(a)
collection of instructions that makes a computer
perform a specific task when executed
(a)
list of instructions that tell a computer what to do
(a)
programs that assist a computer user in accomplishing specific tasks
e.g. Microsoft Word, Google Chrome, Steam
(a)
-programs that are needed to keep all the hardware and applications software running
together smoothly
- interface between the hardware and the user applications
e.g. Operating systems like Windows, Linux, MacOS
(a)
translates a high-level computer program into machine language
e.g. GNU Compiler Collection (GCC)
(a)
-language directly understood by a computer
-collection of binary numbers understood by a specific CPU
(a)
-standardized communication technique for expressing
instructions to a computer
- like human languages each has it’s own syntax and grammar
(a)
-mnemonic codes that correspond to machine language instructions
- computer operations are represented by mnemonic codes rather than
binary numbers and variables can be given names rather than binary
memory addresses
(a)
- used to write programs that are independent of the CPU on which they will
be executed
- combine algebraic expressions and English symbols
- is not directly understood by a computer
(a)
rules of a specific programming language
(a)
‣ it defines how we can put together symbols, reserved words
and identifiers to make a valid program
(a)
refers to the meaning of a program statement and it’s
purpose and role in a program
(a)
also referred to as the Program Development Lifecycle
‣ basic steps in trying to solve a problem on a computer
Steps,
1. Problem Definition
2. Problem Analysis
3. Algorithm Design and Representation
4. Coding and Debugging
2
(a)
‣ a clearly defined problem is already half the
solution
‣ computer programming requires us to define the
problem first before we even try to create a solution
e.g
“Create a program that will determine the number of
times a name occurs in a list.”
(a)
‣ involves breaking up the problem into smaller and simpler
sub-problems
‣ read the problem statement carefully to obtain a clear idea of
the problem and to determine the inputs and outputs
1. identify the data you have to work with - inputs
2. identify the desired results - outputs
3. develop a list of formulas to specify the relationships between
the inputs and outputs
22
(a)
‣ list of steps for solving a problem
‣ a clear unambiguous specification of the steps needed to solve a problem
‣ is a well-ordered collection of unambiguous and effectively computable
operations that, when executed, produces a result and halts in a finite amount of
time.
(a)
After constructing the algorithm, it is now possible
to create the source code. Using the algorithm as
basis, the source code can now be written using
the chosen programming language.
(a)
‣ occur if there is syntax error in the code
‣ the compiler will detect the error and the program won’t compile
‣ the programmer won’t be able to form an executable program that a user can’t run until
the error is fixed
(a)
(a) <stdio.h>
int main() {
printf(“Hello World\n”);
return 0;
}
this includes a file called stdio.h which allows us
to use certain commands
(a)
stdio is short for (a) which
means it has commands for input like reading from
the keyboard and output like printing things on the
screen
‣ is a function “called” by the operating system when
the program is executed
‣ the name of the point where the program starts
‣ entry point of every program
(a)
used very often in C to group commands together
(a)
is the command used to display and print
text to the screen
(a)
‣ sends an exit signal/status to the operating system
‣ the end of the program has already been reached
(a)
‣ serve as inline documentation
‣ provide supplementary information to better
understand a program
‣ ignored by the preprocessor directive and compil
(a)
‣ spaces, blank lines and tabs
‣ used to separate words and symbols in a program
(a)
‣ define what a program statement means
‣ define the purpose or role of a program statement
(a)
‣ high-level programming language developed in
1972 by Dennis Ritchie at AT&T Bell Laboratories
‣ designed to write the UNIX operating system
‣ originally used primarily for systems programm
(a)
Who developed C?
(a)
When was C developed?
(a)
Where was C developed?
(a)
‣ a system program that modifies a C program prior to its compilation
(a)
‣ a command that gives instruction to the preprocessor
‣ begins with a number symbol (#) as its first nonblank character
(a)
‣ a collection of useful functions and symbols that may be accessed by a
program
‣ has a standard header file whose name ends with the symbols .h
(a)
‣ causes the preprocessor to insert definitions from a standard
header file into a program before compilation
‣ gives the program access to a library
‣ tells the preprocessor where to find the meanings of standard
identifiers used in the program
(a)
‣ notifies the C preprocessor to replace each occurrence of the identifier NAME by
value
‣ C program statements cannot change the value associated with the NAME
(a)
name that is replaced by a particular constant value before the program is sent to
the compiler
‣ an executing C program cannot change the value of a name defined as a constant
macro
(a)
‣ every C program has a main function
‣ marks the point where program execution begins
(a)
‣ remaining lines of the program enclosed in curly brackets
(a)
‣ a word that has special meaning in C and cannot be
used for other purposes
(a)
‣ a word that have special meaning but one that can be
redefined and used by a programmer for other
purposes
‣ redefinition is not recommended because C will no
longer be able to use it for its original purpose
(a)
‣ identifiers chosen by a programmer to name memory
cells that will hold data and program results
(a)
An identifier must consist of:
Letters
Digits
Underscores
Hashtags
An identifier can begin with a digit.
True
False
A C reserved word cannot be used as an identifier.
True
False
‣ a name associated with a memory cell whose value can
change as the program executes
(a)
‣ statements that communicate to the compiler the names of
variables in the program, the kind of information stored in
each variable and how that information will be represented in
memory
(a)
‣ a set of values and operations that can be performed on those values
(a)
‣ used to represent integers in C
‣ integers are positive and negative real numbers
‣ whole numbers are integers
‣ because of the finite size of a memory cell, not all integers
can be represented
(a)
‣ predefined data types
(a)
‣ used to represent real numbers in C
‣ real numbers has an integral part and a fractional part that are
separated by a decimal point
(a)
‣ used to represent an individual character value - a letter, a digit or a special symbol
‣ each value is enclosed in single quotes
‣ represented in the memory as an integer whose value
is determined by the code used by the C compiler
(a)
Meaning of ASCII
(a)
‣ follow after the declarations in a function
‣ C statements used to write or code the algorithm and
its refinements
(a)
‣ an instruction that stores a value or a computational
result in a variable
‣ used to perform most arithmetic operations in a
program
(a)
‣ alternative way of storing values or computational results into a
variable
‣ done by copying data from an input device into a variable
(a)
‣ an instruction that copies data from an input device into memory
(a)
‣ an instruction that displays information stored in memory
(a)
‣ C functions that perform input and output operations
(a)
‣ activating a function
(a)
‣ sequence of characters enclosed in quotes which specifies the form of the
output
(a)
‣ enclosed in round brackets following the function name
‣ provides information needed by the function
(a)
‣ variables or expressions whose values are displayed
(a)
‣ a symbol beginning with a % in a format string that indicates where to display
the output value
‣ an abbreviation for the type of data it represents
(a)
What do you call a symbol beginning with % in a format string that indicates where to display the output
value? *
Modulo
Placeholder/Format Specifier
Assignment Operator
Variable
‣ each operator manipulate two operands, which may be
constants, variables or other arithmetic expressions
(a)
( / )
‣ will compute the integral part of the result when applied to two positive integer
operands
(a)
( % )
‣ also known as the Modulo Operator
‣ returns the integer remainder of the result of dividing its first operand by its second
operand
(a)
‣ are operator with one operand
(a)
‣ an operator with two operands
(a)
‣ an expression with operands of different types
(a)
‣ the expression being evaluated and the variable to which it is assigned have
different data types
(a)
‣ also called subroutine, chunk of code, building block of a
program
‣ allow complicated programs to be divided into small
blocks – “divide and conquer”
‣ a named sequence of statements that performs some
useful procedure
‣ is a complete and independent program
‣ can be thought of as a “black box” that has passed one
or more input values and automatically returns a single
output value
(a)
‣ promotes code reuse by providing predefined
functions that can be used in your programs
(a)
‣ library containing predefined functions that can be
used to perform input and output operations
(a)
‣ standard math library containing predefined functions
that can be used to perform mathematical
computations
(a)
