Thursday, November 27, 2014

Final Exam Review

Cramming for tests, vs. learning the material:

The more times you use a neural pathway, the larger that pathway becomes, and the easier it is to use - ie - the more time you spend studying, the more practice problems you solve, the easier it gets, the better established your neural pathways become.

Exam Schedule:
http://www.lonestar.edu/examschedule.htm


Mon 1201 → Final on Mon Dec 8th @ 5:30-7:20

Tu/Th1201→Final on Tues Dec 9th @ 8:00-9:50
Fri 9:00     → Final on Fri   Dec 12th@ 9:00-10:50
Fri 11:00 →   Final on Fri Dec 12th @ 11:00-12:50

For the Upcoming Test & Team evaluation:

  • Come prepared (be there early, with pencil and calculator.  You will not be allowed to use the computers.)
  • Skim through entire test before starting
  • Do the easy problems first
  • keep track of the time
  • Go for partial credit - don't leave anything blank - if you know it's wrong, explain that you know it is wrong, and write down your thinking process.
  • Show all of your work. 
  • Don't erase your work - just put a single line through it (you might get more partial credit)


  •  Check over your answers, and re-check them. Don't leave early.

    Warning: To prevent cheating, each test will be slightly different, so don't copy what your neighbor is doing!   

Final Team Evaluation:

Finish this BEFORE coming to the test. 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Review:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~

Intro to C++ : link

What is in your program?

#include "StdAfx.h"
#include "iostream" 
#include instructs the pre-processor to include another file (the file SrdAfx.h, and iostream or in out stream in this case)

C++ has a library of many codes like "iostream" you can use to save yourself time & hassle.
http://www.cplusplus.com/reference/iostream/

iostream - input and output program, lets you use "cin" and "cout" to allow a user to imput data into the program, and for the program to output data back to the user.

StdAfx.h namespace, reduces compile & processing time
http://www.cplusplus.com/articles/1TUq5Di1/


int main ()  
the first function, where the program actually begins.

 
 {} Surrounds the function
{ start
end}

int birthmonth,birthyear; - defining your variable types.
int = integer, tells it that "birthmonth" is going to be a whole number like "6" not "6.34915"
(Float = if you want to use something like 6.34915...)

if statements - if (x) then do (y)


     cout <<"Hello World"<<endl; Outputs "Hello World" to the user

;  C++ syntax, ends the command

    system("PAUSE")
or 
getch()Pauses the screen "press any key to continue"

    return 0; error check, if you get to the "0" it means the main function has executed and ended

 Commenting 
// HW.cpp : Defines the entry point for the console application.

//


For the test - study the age calculator code - if I changed it, could you figure out what the code is doing?  what does it output?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example #1:

1. If the user inputs:  

birthmonth = 14

birthyear = 2000

currentmonth = -2

currentyear = 1972

output = ???


2. If the user inputs:  

birthmonth = 10

birthyear = 2000

currentmonth = -2

currentyear = 1972

output = ???


// Age Calc.cpp : Program to calculate someone's exact age.

//

#include "stdafx.h"
#include<iostream>
#include<conio.h>


using namespace std;


int main(int argc, _TCHAR* argv[])

{

       int birthmonth,birthyear;

       int currentmonth,currentyear;
       int agey,agem;
       cout << "\n\n\t\t\t Age Calculator\n\n";
       cout<<"Enter Your Birth Year(Eg:1989):";
       cin>>Birthyear;
       cout<<"\n\nEnter Your Birth Month(Eg:7):";
       cin>>birthmonth;
       if(birthmonth > 12 || birthmonth < 1)
       return 1;
      
       cout<<"\nEnter The Current Month(Eg:7):";
       cin>>currentmonth;
       cout<<"\nEnter The CurrentYear(Eg:2010):";
       cin>>currentyear;

       agey=currentyear-birthyear;
       agem=12-birthmonth;

       cout<<"\n\n\t\tYour Age is "<<Agem<<" Years And "<<agey<<" Months ";

       getch();
       return 0;
}


Ans at end of page - try to solve it on your own before checking your answers though!!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Example #2:
1. If the user inputs:
birthmonth = 12
birthyear = 2000
currentmonth = 10
currentyear = 2014
output = ???


2. If the user inputs:
birthmonth = 10
birthyear = 2000
currentmonth = 12
currentyear = 2014
output = ???


// AgeCalc.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<conio.h>

using namespace std;

int main(int argc, _TCHAR* argv[])
{
       int birthmonth,birthyear;
       int currentmonth,currentyear;
       int agey,agem;

       cout << "\n\n\t\t\t Age Calculator\n\n";
       cout<<"Enter Your Birth Year(Eg:1985):";
       cin>>birthyear;

       cout<<"\n\nEnter Your Birth Month(Eg:9):";
       cin>>birthmonth;

       if(birthmonth > 12 || birthmonth < 1)
       return 1;
      
       cout<<"\nEnter The Current Month(Eg:7):";
       cin>>currentmonth;

       cout<<"\nEnter The Current Year(Eg:2013):";
       cin>>currentyear;
       //if(birthmonth > currentmonth) you have not had your birthday yet
       if(birthmonth > currentmonth)
              {agey=currentyear-birthyear-1;
              agem=12-birthmonth;}

       //     if(birthmonth < currentmonth) then you have had your birthday
       if(birthmonth < currentmonth)
       {agey=currentyear-birthyear;
       agem=currentmonth-birthmonth;}

       agey=currentyear-birthyear;
       agem=currentmonth-birthmonth;

       cout<<"\n\n\t\tYour Age is "<<agey<<" Years And "<<agem<<" Months ";

       getch();
       return 0;

}

- answers at end of page, solve it on your own first!!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Mathematica - link

How to input data:

Function[square bracket, arguments separated with commas]

Sin[2.3]
Plus[2,2] = 2+2
Mean[{30, 34, 29, 15}]
Solve:
use "==" - two equal symbols

Solve[x^2-5x+6==0, x]  (shift + enter)
{{x-2}, {x-3}}

Solve[x^2+x+1==0, x]//N
//N - gives answer in numerical form
{{x-.5-.86i},{x-.5+.86i}}

Solve[a*x^2 + b*x + c==0, x]
x = quadratic formula

Solve system of equations - use {}
Solve[{3 x + 2 y ==15, 3*x - 3*y == 12}, {x, y}]//N

Graphing:


Points:
ListLinePlot[{{1,2}, {3, 4}, {5,3}}]


Plot[Sin[x]/x , {x, -9.4, 9.4}]
Plot3D[Sin[x*y], {x, -Sqrt[3*Pi], Sqrt[3*Pi]}, {y, -Sqrt[3*Pi], Sqrt[3*Pi]}]


*** Mathematica "help" resources - 


help - documentation center- 10,000 pages of info on all the functions and examples and tutorials on how to use them


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

8 main parts of a computer - link

If I give you picts of the parts in a computer, can you tell me what it is, and what it does?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Engineering Ethics - link

Can you name an engineering disaster, and briefly discuss:

  • What happened
  • Why it happened
  • How it could have been prevented

Knowing "there can never be enough rules to anticipate and cover every situation, and even if there were, enforcement would be impossibly expensive and burdensome.

What is needed to uphold and maintain ethical practices?


Engineer’s Obligation to Society, to their employer, to clients, and to other engineers:
- only approve designs that safeguard life, health, welfare, and property of the public
- if an engineer’s professional judgment is overruled resulting in a safety concern, it is their responsibility to notify employers, clients, authority figures, the public, and all involved.
- Engineers should be objective, truthful, and unbiased. 
- Engineers should not express opinions in areas they are not qualified in,
- Engineers should not associate with anyone or anything that is unethical



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dynamics



Given some variation of one of the three below graphs, could you figure out the general shape of the other two graphs?


Think about the graphs & how they relate to one another.

position vs. time graph → velocity = slope = ds/dt = change in position / change in time

Velocity vs. time graph →position =  vel * time = (mph*hours = miles) = area under curve

Velocity vs. time graph → acceleration = dV/dt = change in velocity / change in time = slope of V-t line

Acceleration vs. time graph → adt = dv  (a = dv/dt)


Examples:




Can you sketch in the general shape of the missing graphs?
 

1.


 2.


3.




Ans: Don't look until you try it on your own!








~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Last questions on test, start thinking about your answer now!

What did you like most about 1201?
What can we do to improve 1201 in future semesters?


Email me / call me if you need help understanding or studying for any of it, I hope you've had fun!!




~~~~~~~~~~


C++ Ans from 1st prog: Try to solve it on your own first!!

The output in both cases is an error message about the variables not being initialized correctly - extra credit to anyone who can find the errors in the code that does not allow it to compile!


If the variables were used correctly, the output would be:


1.
if(birthmonth > 12 || birthmonth < 1)
return 1;

Error! the birthmonth is > 12!



2.
agey=currentyear-birthyear = 1972-2000=-28
agem=12-birthmonth; = 12-(-2) = -14

cout<<"\n\n\t\tYour Age is "<<Agem<<" Years And "<<agey<<" Months ";

again, notice that agem and agey are switched in the output, so what is on the screen is:
Your age is -14_ years and _-28 months.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Ans:C++ Ans from 2nd prog: 

The last lines before cout are:
       agey=currentyear-birthyear;
       agem=currentmonth-birthmonth;

so the output for agey and agem did not come from the if statements, it comes from whatever was calculated last.


1.  
birthmonth = 12
birthyear = 2000
currentmonth = 10
currentyear = 2014
output = ???
       agey=currentyear-birthyear = 2014-2000=14
       agem=currentmonth-birthmonth = 10-12=-2

2. If the user inputs: 
birthmonth = 10
birthyear = 2000
currentmonth = 12
currentyear = 2014
output = ???
       agey=currentyear-birthyear = 2014-2000 = 14
       agem=currentmonth-birthmonth = 12-10 = 2




No comments:

Post a Comment