CMPSC 200 Final Exam PSU |
354 Questions and Answers
Computer - -a programmable electronic device that can store, retrieve, and
process data
- input - -data from the user is entered into the computer
- Processing - -the computer is instructed what to do you the program, often
using information that was input to the program
- Output - -input inputted or processed through the program is output to the
user
- High-level computer architecture - -the main memory stores programs and
program data in random access memory (RAM)
- CPU - -central processing unit
- CPU has two main components - -arithmetic and logic unit (ALU) -
mathematical operations
control unit - fetches the next instruction, decodes the instruction, and then
executes the instruction as appropriate
- Volatile memory - -temporary storage, information is lost when the power
to the memory is lost. typically faster or higher performing than non-volatile
memory
ex: RAM, DRAM (dynamic ram)
- Non-volatile memory - -permanent storage, information persists even after
power is lost. typically slower than volatile memory
ex: read-only memory (ROM), compact discs (CD), magnetic tape
- Program - -a set of instructions to perform specific tasks
- Algorithm - -a set step for "doing something"
- Operating systems - -allocated computer resources and allows
communication between the user and the computer
- High-level languages - -easy for humans to understand, but too difficult for
a computer to understand
, - Low-level languages - -harder for humans to understand, but easier for a
computer to convert to usable instructions
- Machine language - -generally quite difficult for humans to understand,
the binary digits that contain instructions that can be understood by the
computer
- Compiled - -code written by the programmer is reduced to a set of
machine-specific instructions prior to runtime. these instructions are saved
as executable files, which can be run
- MATLAB stands for - -Matrix laboratory
- Three phases of program writing - -Analyze, implement, maintain the code
- Analyze - -- specify what the program needs to do
- develop the algorithm(s) to solve your problem
- verify that what you have will work
- Implement - -- code the program
- test the program
- Maintain the code - -for large or long-term software systems, this can be
the most expensive part
- Constant - -a variable whose value is not intended to change
- Create script - -- where we are going to store commands
- they do not execute they are simply stored
- working in a script allows you to save your work
- clc - -clear the command window
- clear - -delete all the variables from the workspace
- To delete specific variables type - -clear(variable)
- Block comment - -%{..........%}
- must put writing on the next line from the first percent
- By doing .* it gives you - -an element by element operation
- A variable can - -contain multiple pieces of information
- abs(data#) - -absolute value
,- sqrt(#) - -square root
- nthroot(#,#) - -nth root (x,n)
- sign(#) - -signum function
- if the input is positive MATLAB will return the number +1
- if the input is negative MATLAB will return the number -1
- if the input is zero MATLAB will return the number 0
- rem(x,y) - -remainder of x divided by y
- exp(x) - -e^x
- log - -natural log
- X = round(#) - -round to the nearest integer
- X = fix(#) - -truncation function
- chops off the decimal place
- X = floor(#) - -round in the direction of the nearest integer towards
negative infinity
- X = ceil(x) - -round in the direction of the nearest integer towards positive
infinity
- X = factor(#) - -to get prime factors
- X = gcd(#,#) - -to get greatest common denominator
- X = lcm(#,#) - -to get least common multiple
- X = primes(#) - -to get all prime factors up to the number
- X = isprime(#) - -is the number prime
- 1 is true
- 0 is false
- X =rats(#) - -converts input into a fraction
- X = factorial(#) - -factorial
- X = sin(#) - -to get sin(x)
- X = asin(#) - -to get inverse sin(#)
, - X = sinh(#) - -to get hyperbolic sin (exponential)
- X = asinh(#) - -to get inverse hyperbolic sin
- Default degrees for MATLAB is - -radians
- X = sind(#) - -to get sin(#) in degrees
- help - -huge list of help
- must type in command window
- doc( ) - -will pull up the definition of things
- Array - -a container for multiple pieces of information
- transpose(data#) - -will return the original data#
- mean(data#) - -will find the mean of the data set
- median(data#) - -will find the median of the data set
- mode(data#) - -will find the mode of the data set
- sum(data#) - -will find the sum of the data set
- prod(data#) - -will find the product of the data set
- cumsum(data#) - -cumulative sum of the data set
- cumprod(data#) - -cumulative product of the data set
- sort(data#) - -sort the data set from lowest to highest number
- sort(data#, 'descend') - -sort the data in descending order
- sortrows(data#) - -sort the rows based on the 1st column
- sortrows(data#, #) - -sort rows based on the # column
- size(data#) - -size of the data set
- the first number will be the number of rows and the second number will be
the number of columns
- rows1 = NN1(#) - -extract first element of NN1
- cols1 = NN1(#) - -extract the second element of NN1
354 Questions and Answers
Computer - -a programmable electronic device that can store, retrieve, and
process data
- input - -data from the user is entered into the computer
- Processing - -the computer is instructed what to do you the program, often
using information that was input to the program
- Output - -input inputted or processed through the program is output to the
user
- High-level computer architecture - -the main memory stores programs and
program data in random access memory (RAM)
- CPU - -central processing unit
- CPU has two main components - -arithmetic and logic unit (ALU) -
mathematical operations
control unit - fetches the next instruction, decodes the instruction, and then
executes the instruction as appropriate
- Volatile memory - -temporary storage, information is lost when the power
to the memory is lost. typically faster or higher performing than non-volatile
memory
ex: RAM, DRAM (dynamic ram)
- Non-volatile memory - -permanent storage, information persists even after
power is lost. typically slower than volatile memory
ex: read-only memory (ROM), compact discs (CD), magnetic tape
- Program - -a set of instructions to perform specific tasks
- Algorithm - -a set step for "doing something"
- Operating systems - -allocated computer resources and allows
communication between the user and the computer
- High-level languages - -easy for humans to understand, but too difficult for
a computer to understand
, - Low-level languages - -harder for humans to understand, but easier for a
computer to convert to usable instructions
- Machine language - -generally quite difficult for humans to understand,
the binary digits that contain instructions that can be understood by the
computer
- Compiled - -code written by the programmer is reduced to a set of
machine-specific instructions prior to runtime. these instructions are saved
as executable files, which can be run
- MATLAB stands for - -Matrix laboratory
- Three phases of program writing - -Analyze, implement, maintain the code
- Analyze - -- specify what the program needs to do
- develop the algorithm(s) to solve your problem
- verify that what you have will work
- Implement - -- code the program
- test the program
- Maintain the code - -for large or long-term software systems, this can be
the most expensive part
- Constant - -a variable whose value is not intended to change
- Create script - -- where we are going to store commands
- they do not execute they are simply stored
- working in a script allows you to save your work
- clc - -clear the command window
- clear - -delete all the variables from the workspace
- To delete specific variables type - -clear(variable)
- Block comment - -%{..........%}
- must put writing on the next line from the first percent
- By doing .* it gives you - -an element by element operation
- A variable can - -contain multiple pieces of information
- abs(data#) - -absolute value
,- sqrt(#) - -square root
- nthroot(#,#) - -nth root (x,n)
- sign(#) - -signum function
- if the input is positive MATLAB will return the number +1
- if the input is negative MATLAB will return the number -1
- if the input is zero MATLAB will return the number 0
- rem(x,y) - -remainder of x divided by y
- exp(x) - -e^x
- log - -natural log
- X = round(#) - -round to the nearest integer
- X = fix(#) - -truncation function
- chops off the decimal place
- X = floor(#) - -round in the direction of the nearest integer towards
negative infinity
- X = ceil(x) - -round in the direction of the nearest integer towards positive
infinity
- X = factor(#) - -to get prime factors
- X = gcd(#,#) - -to get greatest common denominator
- X = lcm(#,#) - -to get least common multiple
- X = primes(#) - -to get all prime factors up to the number
- X = isprime(#) - -is the number prime
- 1 is true
- 0 is false
- X =rats(#) - -converts input into a fraction
- X = factorial(#) - -factorial
- X = sin(#) - -to get sin(x)
- X = asin(#) - -to get inverse sin(#)
, - X = sinh(#) - -to get hyperbolic sin (exponential)
- X = asinh(#) - -to get inverse hyperbolic sin
- Default degrees for MATLAB is - -radians
- X = sind(#) - -to get sin(#) in degrees
- help - -huge list of help
- must type in command window
- doc( ) - -will pull up the definition of things
- Array - -a container for multiple pieces of information
- transpose(data#) - -will return the original data#
- mean(data#) - -will find the mean of the data set
- median(data#) - -will find the median of the data set
- mode(data#) - -will find the mode of the data set
- sum(data#) - -will find the sum of the data set
- prod(data#) - -will find the product of the data set
- cumsum(data#) - -cumulative sum of the data set
- cumprod(data#) - -cumulative product of the data set
- sort(data#) - -sort the data set from lowest to highest number
- sort(data#, 'descend') - -sort the data in descending order
- sortrows(data#) - -sort the rows based on the 1st column
- sortrows(data#, #) - -sort rows based on the # column
- size(data#) - -size of the data set
- the first number will be the number of rows and the second number will be
the number of columns
- rows1 = NN1(#) - -extract first element of NN1
- cols1 = NN1(#) - -extract the second element of NN1