CS 163/164 - Exam 1 Study Guide and Practice Exam

Size: px
Start display at page:

Download "CS 163/164 - Exam 1 Study Guide and Practice Exam"

Transcription

1 CS 163/164 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types Strings Suggestions, Warnings, and Resources FAQs Printing 3.1 Suggestions, Warnings, and Resources FAQs Conditional Statements 4.1 if-else if-else Statements Difference between if-if-if and if-else if-else Switch Statements Suggestions, Warnings, and Resources Other Classes 5.1 Integer Double Character Math Scanners 6.1 Suggestions, Warnings, and Resources FAQs Practice Written Exam 7.1 Short Answer Tracing Code Programming Quiz Practice Exam 9 Suggestions for Studying and Test Taking 9.1 Written Programming Quiz Common Errors Challenges

2 10 Answers to Practice Written and Programming Problems 10.1 Written Short Answer Tracing Programming

3 1 Disclaimer This is a review of the material so far, but there may be material on the exam not covered in this study guide. 2 Variables 2.1 Primitive Types The eight primitive types are: int, double, char, float, long, short, byte, and boolean. So far you ve learned about two reference types, a String and a Scanner. These are NOT a primitive types, you will learn why later in the semester. Below are a few examples of declaring a variable. Format: type var name;. 1 i n t i ; 2 double d ; 3 char c ; 4 S t r i n g s ; Below are a few examples of assigning a variable. Format: var name = value;. 1 i = 3 ; 2 d = 4. 5 ; 3 c = a ; 4 s = Hey a l l! ; Below are a few examples of initializing a variable. Initializing is a combination of declaring and assigning. Format: type var name = value; 1 boolean b = t r u e ; 2 f l o a t f = F ; 3 long l = 32L ; 4 S t r i n g r e s p o n s e = Yes ; Remember: Every variable must always have a declaration (assignment can come later). Below are a few examples of typecasting. 1 i n t i = 3 ; 2 double d = ( double ) i ; 3 char c = c ; 4 i n t a s c i i c = ( i n t ) c ; Remember: If you typecast you can lose information, for example if I typecast 6.8 to an integer I will get back Strings Common String methods: length (ex. s.length();) charat (ex. s.charat(0);) indexof (ex. s.indexof( a );) substring (ex. s.substring(0, 3);) equals (ex. s.equals(s1);) touppercase (ex. s.touppercase();) tolowercase (ex. s.tolowercase();) Below are a few examples of how to use the above methods.

4 1 p u b l i c c l a s s Review { 2 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) } 3 // D e c l a r a t i o n 4 S t r i n g s ; 5 6 // A s s i g n i n g 7 s = Hi t h e r e ; 8 9 // D e c l a r i n g & A s s i g n i n g 10 S t r i n g mystring = Okay then ; 11 S t r i n g mystring1 = new S t r i n g ( Okay f i n e then ) ; //Common Methods 14 S t r i n g s = SmIlEy monkey ; 15 char c0 = s. charat ( 0 ) ; // a s s i g n s S to v a r i a b l e c 16 i n t i 0 = s. indexof ( z ) ; // a s s i g n s 1 to v a r i a b l e i 0 17 // because t h e r e i s no z i n s 18 // stringname. s u b s t r i n g ( i n c l u s i v e index, e x c l u s i v e index ) 19 S t r i n g sub = s. s u b s t r i n g ( 0 ) ; // a s s i g n s s to sub 20 // r e t u r n s 21 // ( stringname. s u b s t r i n g (#) 22 // the c h a r a c t e r from # 23 // to the end o f the s t r i n g S t r i n g s1 = s. s u b s t r i n g ( 0, 1 ) ; // only r e t u r n s S because s u b s t r i n g t a k e s an 26 // i n c l u s i v e index as the f i r s t parameter and 27 // an e x c l u s i v e index f o r the second. 28 // Meaning, t h i s would only read the f i r s t l e t t e r. 29 System. out. p r i n t l n ( s. touppercase ( ) ) ; // does not change s! 30 S t r i n g newstring = s. tolowercase ( ) ; // does not change s! 31 System. out. p r i n t l n ( s. e q u a l s ( newstring ) ) ; // p r i n t s f a l s e 32 boolean b = s. e q u a l s ( sub ) ; // a s s i g n s t r u e to b 33 i n t l e n g t h = sub. l e n g t h ( ) ; // a s s i g n s 13 to l e n g t h 34 //( 1 based not 0 based 35 //( l i k e i n d e x e s ) 36 } 37 } 2.3 Suggestions, Warnings, and Resources Warning: Make sure you use the correct ticks/quotes for variables. For example, to assign/initialize a char you must use (ticks or single quotes), to assign/initialize a String you must use (double quotes), and numbers don t use ticks or quotes. Warning: Always use String s.equals method (compared to ==). Warning: Indexing for Strings always starts at 0 (for example the first character is the same as the 0th character). Warning: String methods do NOT change the original string! Resource: Use Oracle s documentation for more methods and examples Resource: Oracle s Learning Paths 2.4 FAQs 1. Q: Why is there an F or L at the end of a long or float value? Is it case sensitive? A: If you leave off the F when assigning or initializing a float, Java will assume you want a double (instead of a float). A float can hold 32-bit number and a double can hold a 64-bit number. You only need to add an L when assigning/initializing a long when the value won t fit into an int. An int can hold numbers between 2 31 and and a long can hold numbers between 2 63 and The F and the L are not case sensitive, but be careful a lower case l looks an awful like the number 1.

5 3 Printing There are three ways to print to the console: System.out.print();, System.out.println();, and System.out.printf();. Below are examples of how and when you could use each. 1 i n t num1 = 3 ; 2 i n t num2 = 5 ; 3 i n t num3 = 9 ; 4 double avg = (num1 + num2 + num3) / 3 ; 5 6 // The f o l l o w i n g t h r e e p r i n t statements are e q u i v a l e n t 7 System. out. p r i n t ( Average + num1 +, + num2 +, and + num3 + : + avg + \n ) ; 8 System. out. p r i n t l n ( Average + num1 +, + num2 +, and + num3 + : + avg ) ; 9 System. out. p r i n t f ( Average %d, %d, and %d : %.1 f \n, num1, num2, num3, avg ) ; i n t i = 2 ; 12 double p = ; 13 System. out. p r i n t f ( %d\n, i ) ; 14 System. out. p r i n t f ( %04d\n, i ) ; // p r i n t s 2 with 3 z e r o s b e f o r e i t 15 System. out. p r i n t f ( % f \n, p ) ; // p r i n t s with 6 d i g i t p r e c i s i o n and rounds 16 System. out. p r i n t f ( %.3 f \n, p ) ; // p r i n t s with 3 d i g i t p r e c i s i o n and rounds This outputs the following: Average 3, 5, and 9: 5.0 Average 3, 5, and 9: 5.0 Average 3, 5, and 9: System.out.print(); is the same as System.out.println(); except it doesn t have a new line character at the end of the line. System.out.printf(); uses format specifiers as placeholders. A format specifier begins with a percent sign and ends with a converter. %d - int %f - float %.#f - (# is the number of decimal places) float %c - char %s - String 3.1 Suggestions, Warnings, and Resources Resource: Here is a good printf resource. Resource: Oracle s Formatter Documentation Note: If you don t specify how many decimals to print when using printf, Java defaults to printing six decimal digits. Warning: Printf rounds! 3.2 FAQs 1. Q: Can you use any of the three ways to print? Is there a specific time you d use one over the other? A: You can any of the three ways to print at any time, one might be easier in some situations (i.e. if you have a lot of variables to print, printf might be easier). 2. Q: Is it necessary to use printf or String.format if you need to specify decimal places? A: Yes.

6 4 Conditional Statements 4.1 if-else if-else Statements 1 p u b l i c c l a s s C o n d i t i o n a l s { 2 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 3 i n t i = 0 ; 4 // i f statement 5 i f ( i == 0) { 6 System. out. p r i n t l n ( i == 0 ) ; 7 } 8 boolean b = t r u e ; 9 // I don t need b r a c k e t s because I only have one l i n e o f code 10 // under each statement. However, you can always have b r a c k e t s 11 // l i k e the example above. 12 i f ( b == f a l s e ) 13 System. out. p r i n t l n ( b i s FALSE ) ; 14 e l s e 15 System. out. p r i n t l n ( b i s TRUE ) ; i n t i 1 = 3 2 ; 18 // here I do need b r a c k e t s because t h e r e i s more than one 19 // l i n e o f code nested i n my i f statement. 20 i f ( i 1 >= 15) { 21 System. out. p r i n t l n ( i 1 i s g r e a t e r than or equal to 15 ) ; 22 i 1 ++; 23 } 24 e l s e i f ( i < 3) 25 System. out. p r i n t l n ( i i s l e s s than 3 ) ; 26 // e l s e s are l i k e catch a l l s t h e r e are a s e c t i o n o f numbers 27 // that aren t covered by my i f and e l s e i f so my e l s e w i l l 28 // handle t h o s e v a l u e s 29 e l s e 30 System. out. p r i n t l n ( i must be between 3 and 14 ) ; // sometimes you don t need an e l s e 33 S t r i n g name = Waldo ; 34 // i f I have found Waldo I want to say I found him but i f ( name. e q u a l s ( Waldo ) ) 36 System. out. p r i n t l n ( Found him! ) ; 37 // i f I didn t f i n d him I don t want to do anything 38 } 39 } The output from the above code is: i == 0 b is TRUE i1 is greater than or equal to 15 Found him! 4.2 Difference between if-if-if and if-else if-else If you use an if-else if-else statement and multiple conditionals are true, the program executes the first true conditional and then exits. If you use an if-if-if statement and multiple conditionals are true, the program will execute all of the true conditionals. 1 p u b l i c c l a s s C o n d i t i o n a l s { 2 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 3 i n t i = ; 4 System. out. p r i n t l n ( i f e l s e i f e l s e statement ) ; 5 i f ( i == 128) 6 System. out. p r i n t l n ( i == 128 ) ; 7 e l s e i f ( i > 100) 8 System. out. p r i n t l n ( i > 100 ) ;

7 9 e l s e i f ( i < 130) 10 System. out. p r i n t l n ( i < 130 ) ; System. out. p r i n t l n ( i f i f i f statement ) ; i f ( i == 128) 15 System. out. p r i n t l n ( i == 128 ) ; 16 i f ( i > 100) 17 System. out. p r i n t l n ( i > 100 ) ; 18 i f ( i < 130) 19 System. out. p r i n t l n ( I < 130 ) ; 20 } 21 } The output from the above code is: if-else if-else statement i == 128 if-if-if statement i == 128 i > 100 I < Switch Statements 1 p u b l i c c l a s s C o n d i t i o n a l s { 2 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 3 i n t i = 3 2 ; 4 switch ( i ) { 5 c a s e 1 0 : System. out. p r i n t l n ( i = 10 ) ; break ; 6 c a s e 3 2 : System. out. p r i n t l n ( i = 32 ) ; break ; 7 c a s e : System. out. p r i n t l n ( i = 101 ) ; break ; 8 d e f a u l t : System. out. p r i n t l n ( i i s not 10, 32, or 101 ) ; 9 } // beware o f your breaks! 12 char c = b ; 13 switch ( c ) { 14 c a s e a : System. out. p r i n t l n ( c = a ) ; 15 c a s e b : System. out. p r i n t l n ( c = b ) ; 16 c a s e c : System. out. p r i n t l n ( c = c ) ; 17 d e f a u l t : System. out. p r i n t l n ( c i s not a, b, or c ) ; 18 } // times you might want to not have breaks 21 i n t dogs = 0, c a t s = 0 ; 22 S t r i n g breed = German Shepard ; // s p a c i n g doesn t matter 25 // you aren t r e q u i r e d to have a d e f a u l t 26 // l i k e you aren t r e q u i r e d to have an e l s e 27 // j u s t be aware that t h e r e are p o s s i b l e c a s e s 28 // that aren t being handled. 29 switch ( breed ) { 30 c a s e Boxer : 31 c a s e Great Dane : 32 c a s e German Shepard : 33 c a s e Lab : 34 dogs++; break ; c a s e C a l i c o : c a s e B r i t i s h S h o r t h a i r : c a s e Siamese : 37 c a t s ++; break ; 38 } 39 System. out. p r i n t f ( Dogs : %d, Cats %d\n, dogs, c a t s ) ; 40 } 41 }

8 The output from the above code is: i = 32 c = b c = c c is not a, b, or c Dogs: 1, Cats Suggestions, Warnings, and Resources Warning: Don t add a semicolon after your conditional. For example if (32 == 32);. Warning: Be aware of when you should and shouldn t have breaks in your switch statement. 5 Other Classes 5.1 Integer Common Integer Methods and Constants parseint (ex. Integer.parseInt("3");) MAX VALUE (constant) (ex. int max = Integer.MAX VALUE;) MIN VALUE (constant) (ex. int min = Integer.MIN VALUE;) 5.2 Double Common Double Methods and Constants parsedouble (ex. Double.parseDouble("3.3");) MAX VALUE (constant) (ex. double max = Double.MAX VALUE;; MIN VALUE (constant) (ex. double min = Double.MIN VALUE;; 5.3 Character Common Character Methods isuppercase (ex. Character.isUpperCase( a );) islowercase (ex. Character.isLowerCase( a );) isletter (ex. Character.isLetter( 4 );) isdigit (ex. Character.isDigit( 4 );) 5.4 Math Common Math Methods and Constants: sqrt (ex. Math.sqrt(64);) pow (ex. Math.pow(1.0, 3.0);) sin (ex. Math.sin(1.5);) cos (ex. Math.cos(1.5);) exp (ex. Math.exp(3.3)) log (ex. Math.log(2.1);)

9 min (ex. Math.min(1, 3);) max (ex. Math.max(1, 3);) round (ex. Math.round(3.3)) floor (ex. Math.floor(3.3);) ceil (ex. Math.ceil(3.3))) PI (constant) (ex. double num = Math.PI;) 6 Scanners Below is an example of reading from the keyboard/console. 1 // importing n e c e s s a r y methods 2 import java. u t i l. Scanner ; 3 4 p u b l i c c l a s s S c a n n e r P r a c t i c e { 5 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 6 // I n i t i a l i z e s a Scanner o b j e c t c a l l e d r e a d e r 7 Scanner r e a d e r = new Scanner ( System. i n ) ; 8 // Prompting u s e r f o r an i n t e g e r 9 System. out. p r i n t ( Enter your f a v o r i t e i n t e g e r : ) ; 10 // Read and s t o r e an i n t 11 i n t f a v o r i t e n u m b e r = r e a d e r. n e x t I n t ( ) ; 12 // Prompting u s e r f o r a decimal 13 System. out. p r i n t ( Enter your f a v o r i t e decimal number : ) ; 14 // Read and s t o r e a double 15 double f a v o r i t e d e c i m a l = r e a d e r. nextdouble ( ) ; 16 // Prompting u s e r f o r a c h a r a c t e r 17 System. out. p r i n t ( Enter your f a v o r i t e c h a r a c t e r : ) ; 18 // Read and s t o r e a l e t t e r 19 char f a v o r i t e c h a r a c t e r = r e a d e r. next ( ). charat ( 0 ) ; // p r i n t i n g summary 22 System. out. p r i n t f ( Your f a v o r i t e i n t e g e r i s %d\nyour f a v o r i t e decimal number to 6 d e c i m a l s 23 i s %f \nyour f a v o r i t e c h a r a c t e r i s %c \n, favorite number, 24 f a v o r i t e d e c i m a l, f a v o r i t e c h a r a c t e r ) ; 25 r e a d e r. c l o s e ( ) ; // NOTE: You can a l s o use Java 8 s try catch r e s o u r c e. This g u a r a n t e e s your Scanner i s c l e a n e d up ( Scanner c l o s i n g, e t c. ). Example below : 28 t r y ( Scanner scan = new Scanner ( new F i l e ( f i l e n a m e ) ) ) { 29 // your code here 30 } 31 } 32 } On the console, it looks like this: Enter your favorite integer: 11 Enter your favorite decimal number: 3.14 Enter your favorite character: a Your favorite integer is 11 Your favorite decimal number to 6 decimals is Your favorite character is a 6.1 Suggestions, Warnings, and Resources Suggestion: Get in the habit of closing your Scanners Warning: When you go from line based processing (.nextline()) to token based processing (.next(),.nextdouble(),.nextint()) you MUST discard the new line character before you continue parsing. Resource: Use Oracle s documentation for more methods and examples

10 6.2 FAQs 1. Q: My code still works even though I didn t close my Scanner object, why do you guys teach so you have to close it? A: We teach it so you close your Scanners so you get in the habit of closing objects (better coding practice and when we get to PrintWriters you must close your object).

11 7 Practice Written Exam 7.1 Short Answer 1. Declare an integer named i0. 2. Initialize a float named f to Initialize a Scanner to read from the keyboard, called read. 4. Assign i0 to an integer entered from the user. 5. Close the Scanner. 6. Change the pre-assigned String variable called s to be all upper case. 7. Name the eight primitive types. 8. Question 8 might be better written as: Given the following code, write what would be printed to the console (write error if the code throws an error): 1 S t r i n g s = new S t r i n g ( Bob Marley ) ; 2 S t r i n g m = mummies ; 3 System. out. p r i n t l n (m. s u b s t r i n g ( 0, 3 ) + s. s u b s t r i n g ( 4 ) ) ; 4 System. out. p r i n t (m. charat ( 1 ) + + s. charat ( 1 ) ) ; 5 System. out. p r i n t l n ( s. indexof ( q ) + m. indexof ( 3 ) ) ; 6 System. out. p r i n t l n ( s. l e n g t h ( ) ) ; 7 System. out. p r i n t l n ( s + m) ; 8 System. out. p r i n t l n (m. indexof ( Ma ) ) ; 9 System. out. p r i n t l n ( s. l e n g t h ( ) m. l e n g t h ( ) ) ; 10 System. out. p r i n t l n ( s. s u b s t r i n g ( 0, 1 1 ) ) ; 11 System. out. p r i n t l n ( s. l e n g t h ( ) /m. l e n g t h ( ) ) ; 9. What is 18 % 3? 10. Write a switch statement based off of the character variable c. If c is a print hi, if c is b print okay, if c is c print then, if c is d print bye, if it is not a, b, c, or d print fine then. 11. Write an if statement that does the same thing as question Declare a Scanner called scan. Read in one word and store it into the predefined String variable called word. Print out the second through fourth character of word. Close your scanner. 13. Check to see if the predefined String variables s0 and s1 are equal. Print the result. 14. Check to see if the predefined int variables i0 and i1 are equal. Print the result.

12 7.2 Tracing Code For each question below, write what is printed. 1 import java. u t i l. Scanner ; 2 3 p u b l i c c l a s s Tracing { 4 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 5 i n t i = 3 ; 6 double d = ( double ) i ; 7 // Question 1 8 System. out. p r i n t f ( %d %f \n, i, d ) ; 9 10 Scanner keys = new Scanner ( System. i n ) ; 11 d = keys. n e x t I n t ( ) ; 12 i = ( i n t ) keys. nextdouble ( ) ; // Question 2 ( assume the u s e r e n t e r s 8 and r e s p e c t i v e l y ) 15 System. out. p r i n t f ( %d %.4 f \n, i, d ) ; S t r i n g r e s u l t = i n i t i a l r e s u l t ; // Question 3 20 i f ( d > 98) 21 r e s u l t = g r e a t e r than 98 ; 22 e l s e 23 r e s u l t = l e s s than or equal to 98 ; 24 System. out. p r i n t l n ( r e s u l t ) ; char grade = keys. next ( ). charat ( 0 ) ; 27 // Question 4 ( assume the u s e r e n t e r s a ( without the quotes ) ) 28 switch ( grade ) { 29 c a s e a : System. out. p r i n t l n ( Passing! ) ; 30 c a s e b : System. out. p r i n t l n ( Passing! ) ; 31 c a s e c : System. out. p r i n t l n ( Passing! ) ; 32 c a s e d : System. out. p r i n t l n ( Kinda s o r t a p a s s i n g ) 33 c a s e f : System. out. p r i n t l n ( Not r e a l l y p a s s i n g ) ; 34 d e f a u l t : System. out. p r i n t l n ( Not a grade l e t t e r r e c o g n i z e d ) ; 35 } 36 } 37 }

13 8 Programming Quiz Practice Exam 1. Declare a class with a main method 2. Import the Scanner class 3. Declare four String variables called name, city, state, school 4. Declare an int variable called age 5. Declare a double variable called gpa 6. Declare a Scanner that reads from the keyboard called reader 7. Prompt the user to enter their name 8. Using the Scanner read in their name and assign the value to name 9. Prompt the user to enter their age 10. Using the Scanner read in their age and assign the value to age 11. Prompt the user to enter their GPA 12. Using the Scanner read in their GPA and assign the value to gpa 13. Prompt the user to enter their school 14. Using the Scanner read in their school s name and assign the value to school 15. Prompt the user to enter their city 16. Using the Scanner read in their city s name and assign the value to city 17. Prompt the user to enter their state 18. Using the Scanner read in their state s name and assign the value to state. 19. Print a summary of the entered information in the format by printing: (a) Print their first name (ONLY the first name) (b) Print their age (c) Print their GPA with two decimal point accuracy (d) Print their school name (e) Print their city then their state An example run would look like: Enter your name: Bob Stevey Joe Enter your age: 18 Enter your GPA: Enter your school: Colorado State University Enter your city: Fort Collins Enter your state: Colorado Summary: First name: Bob Age: 18 GPA: 3.14 School Name: Colorado State University Fort Collins, Colorado 20. Close reader

14 9 Suggestions for Studying and Test Taking 9.1 Written When reading through code and writing the output: Write your variables on the side and as your variables change, you change your list on the side. Practice writing code in Eclipse and before you run your program guess what the output would be. is good practice for testing your own programs and also for the code tracing part of the exam. This If you need more tracing examples (or more coding examples in general), there is a Programs tab on the CS163/164 homepage. There are also examples on the Progress page. Write the variables, their values, and any changes made to those values to keep track of what is changing throughout the program. 9.2 Programming Quiz Go back to past recitations and assignments and redo them without using the Internet, friends, or past recitations/assignments. Practice writing code in Eclipse. Make up projects and problems or ask a TA and they can give you some challenges. Look at code, the more exposure you get to code (whether it s your own code or not) the easier it is to understand. Some sample code is under the Programs tab and the Progress Page. 9.3 Common Errors Scanner token processing(.next,.nextint(),.nextdouble()) to line processing (.nextline()). Need an extra.nextline() when going from token processing to line processing. Use.equals when comparing Strings, NOT ==! Incorrect brackets around conditional statements 9.4 Challenges CodingBat and Hackerrank offer good extra coding practice.

15 ANSWERS ON THE NEXT PAGE

16 10 Answers to Practice Written and Programming Problems 10.1 Written Short Answer 1. int i0; 2. float f = 4.0F; 3. Scanner read = new Scanner(System.in); 4. i0 = read.nextint(); 5. read.close(); 6. s = s.touppercase(); 7. int, double, char, float, long, boolean, byte 8. mummarley u-o-2 10 Bob Marleymummies -1 3 error switch ( c ) { 2 c a s e a : System. out. p r i n t l n ( h i ) ; break ; 3 c a s e b : System. out. p r i n t l n ( okay ) ; break ; 4 c a s e c : System. out. p r i n t l n ( then ) ; break ; 5 c a s e d : System. out. p r i n t l n ( bye ) ; break ; 6 d e f a u l t : System. out. p r i n t l n ( f i n e then ) ; break ; 7 } 11.1 i f ( c == a ) 2 System. out. p r i n t l n ( h i ) ; 3 e l s e i f ( c == b ) 4 System. out. p r i n t l n ( okay ) ; 5 e l s e i f ( c == c ) 6 System. out. p r i n t l n ( then ) ; 7 e l s e i f ( c == d ) 8 System. out. p r i n t l n ( bye ) ; 9 e l s e 10 System. out. p r i n t l n ( f i n e then ) ; Scanner scan = new Scanner ( System. i n ) ; 2 word = scan. next ( ) ; 3 System. out. p r i n t l n ( word. s u b s t r i n g ( 1, 4 ) ) ; 4 scan. c l o s e ( ) ; 13. System.out.println(s0.equals(s1)); 14. System.out.println(i0 == i1);

17 Tracing less than or equal to Passing! Passing! Passing! Kinda sorta passing Not really passing Not a grade letter recognized 10.2 Programming NOTE: Your solution may be different from the code below, as long as your output matches my output (in all cases), you are answer is fine. 1 import java. u t i l. Scanner ; 2 3 p u b l i c c l a s s PracticeProgramming { 4 p u b l i c s t a t i c void main ( S t r i n g [ ] a r g s ) { 5 Scanner r e a d e r = new Scanner ( System. i n ) ; 6 S t r i n g name = ; 7 i n t age ; 8 double gpa ; 9 S t r i n g c i t y =, s t a t e =, s c h o o l = ; // Goal : Only get f i r s t name 12 System. out. p r i n t ( Enter your name : ) ; 13 name = r e a d e r. nextline ( ) ; 14 // Checks i f t h e r e i s a space ( i. e. between f i r s t and l a s t name ) 15 i n t s p a c e i n d e x = name. indexof ( ) ; 16 // t h e r e i s a space 17 i f ( s p a c e i n d e x!= 1) 18 name = name. s u b s t r i n g ( 0, s p a c e i n d e x ) ; System. out. p r i n t ( Enter your age : ) ; 21 age = r e a d e r. n e x t I n t ( ) ; 22 System. out. p r i n t ( Enter your GPA: ) ; 23 gpa = r e a d e r. nextdouble ( ) ; 24 r e a d e r. nextline ( ) ; 25 System. out. p r i n t ( Enter your s c h o o l : ) ; 26 s c h o o l = r e a d e r. nextline ( ) ; 27 System. out. p r i n t ( Enter your c i t y : ) ; 28 // Could be m u l t i p l e words ( i. e. Colorado S p r i n g s ) 29 c i t y = r e a d e r. nextline ( ) ; 30 System. out. p r i n t ( Enter your s t a t e : ) ; 31 s t a t e = r e a d e r. nextline ( ) ; System. out. p r i n t l n ( Summary : ) ; 34 System. out. p r i n t l n ( F i r s t name : + name ) ; 35 System. out. p r i n t l n ( Age : + age ) ; 36 System. out. p r i n t f ( GPA: %.2 f \n, gpa ) ; 37 System. out. p r i n t l n ( School Name : + s c h o o l ) ; 38 System. out. p r i n t l n ( c i t y +, + s t a t e ) ; r e a d e r. c l o s e ( ) ; 41 } 42 }

CS Exam 1 Study Guide and Practice Exam

CS Exam 1 Study Guide and Practice Exam CS 150 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Suggestions, Warnings, and Resources.................................

More information

CS Exam 3 Study Guide and Practice Exam

CS Exam 3 Study Guide and Practice Exam CS 163 - Exam 3 Study Guide and Practice Exam November 6, 2017 Summary 1 Disclaimer 2 Methods and Data 2.1 Static vs. Non-Static........................................... 2.1.1 Static Example..........................................

More information

Take-home Lab 1. Arrays

Take-home Lab 1. Arrays Take-home Lab 1 Arrays Findx 2-Dimensional Array Graded! Submit by Friday 23:59 Find You are given a treasure map by your friend Map is divided into R by C cells Super Marks The Spot You need to find all

More information

1. Write a program to calculate distance traveled by light

1. Write a program to calculate distance traveled by light G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a

More information

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion: German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:

More information

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion: German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Rimon Elias Dr. Hisham Othman Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!

More information

Introduction to Programming (Java) 3/12

Introduction to Programming (Java) 3/12 Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

base 2 4 The EXPONENT tells you how many times to write the base as a factor. Evaluate the following expressions in standard notation.

base 2 4 The EXPONENT tells you how many times to write the base as a factor. Evaluate the following expressions in standard notation. EXPONENTIALS Exponential is a number written with an exponent. The rules for exponents make computing with very large or very small numbers easier. Students will come across exponentials in geometric sequences

More information

ITI Introduction to Computing II

ITI Introduction to Computing II (with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!

More information

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality Math 336-Modern Algebra Lecture 08 9/26/4. Cardinality I started talking about cardinality last time, and you did some stuff with it in the Homework, so let s continue. I said that two sets have the same

More information

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion: German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:

More information

Computer Science Introductory Course MSc - Introduction to Java

Computer Science Introductory Course MSc - Introduction to Java Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow

More information

Quadratic Equations Part I

Quadratic Equations Part I Quadratic Equations Part I Before proceeding with this section we should note that the topic of solving quadratic equations will be covered in two sections. This is done for the benefit of those viewing

More information

Solution to Proof Questions from September 1st

Solution to Proof Questions from September 1st Solution to Proof Questions from September 1st Olena Bormashenko September 4, 2011 What is a proof? A proof is an airtight logical argument that proves a certain statement in general. In a sense, it s

More information

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed. This document was written and copyrighted by Paul Dawkins. Use of this document and its online version is governed by the Terms and Conditions of Use located at. The online version of this document is

More information

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161 Discrete Math at CSU (Rosen book) Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples 1 n CS 160 or CS122 n Sets and Functions n Propositions and

More information

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n

Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion:

More information

Unit 7 Graphs and Graphing Utilities - Classwork

Unit 7 Graphs and Graphing Utilities - Classwork A. Graphing Equations Unit 7 Graphs and Graphing Utilities - Classwork Our first job is being able to graph equations. We have done some graphing in trigonometry but now need a general method of seeing

More information

At the end of the exam you must copy that folder onto a USB stick. Also, you must your files to the instructor.

At the end of the exam you must copy that folder onto a USB stick. Also, you must  your files to the instructor. Before you begin your work, please create a new file folder on your computer. The name of the folder should be YourLastName_YourFirstName For example, if your name is John Smith your folder should be named

More information

Liquid-in-glass thermometer

Liquid-in-glass thermometer Objectives Liquid-in-glass thermometer The objectives of this experiment is to introduce some basic concepts in measurement, and to develop good measurement habits. In the first section, we will develop

More information

C if U can. Algebra. Name

C if U can. Algebra. Name C if U can Algebra Name.. How will this booklet help you to move from a D to a C grade? The topic of algebra is split into six units substitution, expressions, factorising, equations, trial and improvement

More information

Preptests 59 Answers and Explanations (By Ivy Global) Section 1 Analytical Reasoning

Preptests 59 Answers and Explanations (By Ivy Global) Section 1 Analytical Reasoning Preptests 59 Answers and Explanations (By ) Section 1 Analytical Reasoning Questions 1 5 Since L occupies its own floor, the remaining two must have H in the upper and I in the lower. P and T also need

More information

Liquid-in-glass thermometer

Liquid-in-glass thermometer Liquid-in-glass thermometer Objectives The objective of this experiment is to introduce some basic concepts in measurement, and to develop good measurement habits. In the first section, we will develop

More information

Unit 8: Sequ. ential Circuits

Unit 8: Sequ. ential Circuits CPSC 121: Models of Computation Unit 8: Sequ ential Circuits Based on slides by Patrice Be lleville and Steve Wolfman Pre-Class Learning Goals By the start of class, you s hould be able to Trace the operation

More information

FIT100 Spring 01. Project 2. Astrological Toys

FIT100 Spring 01. Project 2. Astrological Toys FIT100 Spring 01 Project 2 Astrological Toys In this project you will write a series of Windows applications that look up and display astrological signs and dates. The applications that will make up the

More information

C++ For Science and Engineering Lecture 13

C++ For Science and Engineering Lecture 13 C++ For Science and Engineering Lecture 13 John Chrispell Tulane University Wednesday September 22, 2010 Logical Expressions: Sometimes you want to use logical and and logical or (even logical not) in

More information

Lecture 4: Constructing the Integers, Rationals and Reals

Lecture 4: Constructing the Integers, Rationals and Reals Math/CS 20: Intro. to Math Professor: Padraic Bartlett Lecture 4: Constructing the Integers, Rationals and Reals Week 5 UCSB 204 The Integers Normally, using the natural numbers, you can easily define

More information

COMS 6100 Class Notes

COMS 6100 Class Notes COMS 6100 Class Notes Daniel Solus September 20, 2016 1 General Remarks The Lecture notes submitted by the class have been very good. Integer division seemed to be a common oversight when working the Fortran

More information

You separate binary numbers into columns in a similar fashion. 2 5 = 32

You separate binary numbers into columns in a similar fashion. 2 5 = 32 RSA Encryption 2 At the end of Part I of this article, we stated that RSA encryption works because it s impractical to factor n, which determines P 1 and P 2, which determines our private key, d, which

More information

Astronomy 102 Math Review

Astronomy 102 Math Review Astronomy 102 Math Review 2003-August-06 Prof. Robert Knop r.knop@vanderbilt.edu) For Astronomy 102, you will not need to do any math beyond the high-school alegbra that is part of the admissions requirements

More information

Ch. 3 Equations and Inequalities

Ch. 3 Equations and Inequalities Ch. 3 Equations and Inequalities 3.1 Solving Linear Equations Graphically There are 2 methods presented in this section for solving linear equations graphically. Normally I would not cover solving linear

More information

Algebra Exam. Solutions and Grading Guide

Algebra Exam. Solutions and Grading Guide Algebra Exam Solutions and Grading Guide You should use this grading guide to carefully grade your own exam, trying to be as objective as possible about what score the TAs would give your responses. Full

More information

COLLEGE ALGEBRA. Solving Equations and Inequalities. Paul Dawkins

COLLEGE ALGEBRA. Solving Equations and Inequalities. Paul Dawkins COLLEGE ALGEBRA Solving Equations and Inequalities Paul Dawkins Table of Contents Preface... ii Solving Equations and Inequalities... 3 Introduction... 3 s and Sets... 4 Linear Equations... 8 Application

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Inference and Proofs (1.6 & 1.7)

Inference and Proofs (1.6 & 1.7) EECS 203 Spring 2016 Lecture 4 Page 1 of 9 Introductory problem: Inference and Proofs (1.6 & 1.7) As is commonly the case in mathematics, it is often best to start with some definitions. An argument for

More information

2018 Arizona State University Page 1 of 16

2018 Arizona State University Page 1 of 16 NAME: MATH REFRESHER ANSWER SHEET (Note: Write all answers on this sheet and the following graph page.) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27.

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Turing Machine Recap

Turing Machine Recap Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every

More information

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this. Preface Here are my online notes for my Calculus II course that I teach here at Lamar University. Despite the fact that these are my class notes they should be accessible to anyone wanting to learn Calculus

More information

Vectors Part 1: Two Dimensions

Vectors Part 1: Two Dimensions Vectors Part 1: Two Dimensions Last modified: 20/02/2018 Links Scalars Vectors Definition Notation Polar Form Compass Directions Basic Vector Maths Multiply a Vector by a Scalar Unit Vectors Example Vectors

More information

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2: Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2: 03 17 08 3 All about lines 3.1 The Rectangular Coordinate System Know how to plot points in the rectangular coordinate system. Know the

More information

CSE 331 Winter 2018 Reasoning About Code I

CSE 331 Winter 2018 Reasoning About Code I CSE 331 Winter 2018 Reasoning About Code I Notes by Krysta Yousoufian Original lectures by Hal Perkins Additional contributions from Michael Ernst, David Notkin, and Dan Grossman These notes cover most

More information

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015 Undecidability and Rice s Theorem Lecture 26, December 3 CS 374, Fall 2015 UNDECIDABLE EXP NP P R E RECURSIVE Recap: Universal TM U We saw a TM U such that L(U) = { (z,w) M z accepts w} Thus, U is a stored-program

More information

Lesson 21 Not So Dramatic Quadratics

Lesson 21 Not So Dramatic Quadratics STUDENT MANUAL ALGEBRA II / LESSON 21 Lesson 21 Not So Dramatic Quadratics Quadratic equations are probably one of the most popular types of equations that you ll see in algebra. A quadratic equation has

More information

MATH REFRESHER ANSWER SHEET (Note: Only this answer sheet and the following graph page will be evaluated)

MATH REFRESHER ANSWER SHEET (Note: Only this answer sheet and the following graph page will be evaluated) NAME: SCORE: /50 MATH REFRESHER ANSWER SHEET (Note: Only this answer sheet and the following graph page will be evaluated) 1. 23. 2. 24. 3. 25. 4. 26. 5. 27. 6. 28. 7. 29. 8. 30. 9. 31. 10. 32. 11. 33.

More information

HP-15C Nth-degree Polynomial Fitting

HP-15C Nth-degree Polynomial Fitting HP-15C Nth-degree Polynomial Fitting Valentín Albillo (Ex-PPC #4747, HPCC #1075) It frequently happens, both in theoretical problems and in real-life applications, that we ve got a series of data points

More information

CH 59 SQUARE ROOTS. Every positive number has two square roots. Ch 59 Square Roots. Introduction

CH 59 SQUARE ROOTS. Every positive number has two square roots. Ch 59 Square Roots. Introduction 59 CH 59 SQUARE ROOTS Introduction W e saw square roots when we studied the Pythagorean Theorem. They may have been hidden, but when the end of a right-triangle problem resulted in an equation like c =

More information

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016 CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis Hunter Zahn Summer 2016 Today Finish discussing stacks and queues Review math essential to algorithm analysis Proof by

More information

CS 177 Fall 2014 Midterm 1 exam - October 9th

CS 177 Fall 2014 Midterm 1 exam - October 9th CS 177 Fall 2014 Midterm 1 exam - October 9th There are 25 True/False and multiple choice questions. Each one is worth 4 points. Answer the questions on the bubble sheet given to you. Remember to fill

More information

USE OF THE SCIENTIFIC CALCULATOR

USE OF THE SCIENTIFIC CALCULATOR USE OF THE SCIENTIFIC CALCULATOR Below are some exercises to introduce the basic functions of the scientific calculator that you need to be familiar with in General Chemistry. These instructions will work

More information

Object Oriented Software Design (NTU, Class Even, Spring 2009) Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20

Object Oriented Software Design (NTU, Class Even, Spring 2009) Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20 Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20 This is a closed-book exam. Any form of cheating or lying will not be tolerated. Students can get zero scores and/or fail the class and/or

More information

CS 360, Winter Morphology of Proof: An introduction to rigorous proof techniques

CS 360, Winter Morphology of Proof: An introduction to rigorous proof techniques CS 30, Winter 2011 Morphology of Proof: An introduction to rigorous proof techniques 1 Methodology of Proof An example Deep down, all theorems are of the form If A then B, though they may be expressed

More information

Do NOT rely on this as your only preparation for the Chem 101A final. You will almost certainly get a bad grade if this is all you look at.

Do NOT rely on this as your only preparation for the Chem 101A final. You will almost certainly get a bad grade if this is all you look at. Do NOT rely on this as your only preparation for the Chem 101A final. You will almost certainly get a bad grade if this is all you look at. This is an INCOMPLETE list of hints and topics for the Chem 101

More information

CompA - Complex Analyzer

CompA - Complex Analyzer CompA - Complex Analyzer Xiping Liu(xl2639), Jianshuo Qiu(jq2253), Tianwu Wang(tw2576), Yingshuang Zheng(yz3083), Zhanpeng Su(zs2329) Septembee 25, 2017 1 Introduction The motivation for writing this language

More information

Descriptive Statistics (And a little bit on rounding and significant digits)

Descriptive Statistics (And a little bit on rounding and significant digits) Descriptive Statistics (And a little bit on rounding and significant digits) Now that we know what our data look like, we d like to be able to describe it numerically. In other words, how can we represent

More information

CS177 Fall Midterm 1. Wed 10/07 6:30p - 7:30p. There are 25 multiple choice questions. Each one is worth 4 points.

CS177 Fall Midterm 1. Wed 10/07 6:30p - 7:30p. There are 25 multiple choice questions. Each one is worth 4 points. CS177 Fall 2015 Midterm 1 Wed 10/07 6:30p - 7:30p There are 25 multiple choice questions. Each one is worth 4 points. Answer the questions on the bubble sheet given to you. Only the answers on the bubble

More information

1. (20 points) Finding critical points, maximums, minimums.

1. (20 points) Finding critical points, maximums, minimums. Math 030 (Section 02) Test #3 June 2 st, 200 Name: ANSWER KEY Be sure to show your work!. (20 points) Finding critical points, maximums, minimums. (a) Let f(x) = 2x 3 + 5x 2 4x 3. Find min/max on [, 2]

More information

Chapter 1. Foundations of GMAT Math. Arithmetic

Chapter 1. Foundations of GMAT Math. Arithmetic Chapter of Foundations of GMAT Math In This Chapter Quick-Start Definitions Basic Numbers Greater Than and Less Than Adding and Subtracting Positives and Negatives Multiplying and Dividing Distributing

More information

Units and Dimensionality

Units and Dimensionality Chapter 1 Units and Dimensionality If somebody asked me how tall I am, I might respond 1.78. But what do I mean by that? 1.78 feet? 1.78 miles? In fact, my height is 1.78 meters. Most physical measurements

More information

Lab Slide Rules and Log Scales

Lab Slide Rules and Log Scales Name: Lab Slide Rules and Log Scales [EER Note: This is a much-shortened version of my lab on this topic. You won t finish, but try to do one of each type of calculation if you can. I m available to help.]

More information

Where Is Newton Taking Us? And How Fast?

Where Is Newton Taking Us? And How Fast? Name: Where Is Newton Taking Us? And How Fast? In this activity, you ll use a computer applet to investigate patterns in the way the approximations of Newton s Methods settle down to a solution of the

More information

We introduce one more operation on sets, perhaps the most important

We introduce one more operation on sets, perhaps the most important 11. The power set Please accept my resignation. I don t want to belong to any club that will accept me as a member. Groucho Marx We introduce one more operation on sets, perhaps the most important one:

More information

5.2 Infinite Series Brian E. Veitch

5.2 Infinite Series Brian E. Veitch 5. Infinite Series Since many quantities show up that cannot be computed exactly, we need some way of representing it (or approximating it). One way is to sum an infinite series. Recall that a n is the

More information

Lab Exercise 6 CS 2334

Lab Exercise 6 CS 2334 Lab Exercise 6 CS 2334 September 28, 2017 Introduction In this lab, you will experiment with using inheritance in Java through the use of abstract classes and interfaces. You will implement a set of classes

More information

Chapter 1: January 26 January 30

Chapter 1: January 26 January 30 Chapter : January 26 January 30 Section.7: Inequalities As a diagnostic quiz, I want you to go through the first ten problems of the Chapter Test on page 32. These will test your knowledge of Sections.

More information

EXTRA CREDIT FOR MATH 39

EXTRA CREDIT FOR MATH 39 EXTRA CREDIT FOR MATH 39 This is the second, theoretical, part of an extra credit homework. This homework in not compulsory. If you do it, you can get up to 6 points (3 points for each part) of extra credit

More information

Week 2. Topic 4 Domain and Range

Week 2. Topic 4 Domain and Range Week 2 Topic 4 Domain and Range 1 Week 2 Topic 4 Domain and Range Introduction A function is a rule that takes an input and produces one output. If we want functions to represent real-world situations,

More information

CS177 Spring Midterm 2. April 02, 8pm-9pm. There are 25 multiple choice questions. Each one is worth 4 points.

CS177 Spring Midterm 2. April 02, 8pm-9pm. There are 25 multiple choice questions. Each one is worth 4 points. CS177 Spring 2015 Midterm 2 April 02, 8pm-9pm There are 25 multiple choice questions. Each one is worth 4 points. Answer the questions on the bubble sheet given to you. Only the answers on the bubble sheet

More information

CALCULUS I. Review. Paul Dawkins

CALCULUS I. Review. Paul Dawkins CALCULUS I Review Paul Dawkins Table of Contents Preface... ii Review... 1 Introduction... 1 Review : Functions... Review : Inverse Functions...1 Review : Trig Functions...0 Review : Solving Trig Equations...7

More information

161 Sp18 T1 grades (out of 40, max 100)

161 Sp18 T1 grades (out of 40, max 100) Grades for test Graded out of 40 (scores over 00% not possible) o Three perfect scores based on this grading scale!!! o Avg = 57 o Stdev = 3 Scores below 40% are in trouble. Scores 40-60% are on the bubble

More information

E40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1

E40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1 E40M Binary Numbers M. Horowitz, J. Plummer, R. Howe 1 Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2 Useless Box Lab Project #2 Adding a computer to the Useless Box alows us

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2018

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2018 ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER 1 2017/2018 DR. ANTHONY BROWN 1. Arithmetic and Algebra 1.1. Arithmetic of Numbers. While we have calculators and computers

More information

CHM 105 & 106 MO1 UNIT TWO, LECTURE THREE 1 IN OUR PREVIOUS LECTURE WE TALKED ABOUT USING CHEMICAL EQUATIONS TO SHOW THE

CHM 105 & 106 MO1 UNIT TWO, LECTURE THREE 1 IN OUR PREVIOUS LECTURE WE TALKED ABOUT USING CHEMICAL EQUATIONS TO SHOW THE CHM 105 & 106 MO1 UNIT TWO, LECTURE THREE 1 CHM 105/106 Program 10: Unit 2 Lecture 3 IN OUR PREVIOUS LECTURE WE TALKED ABOUT USING CHEMICAL EQUATIONS TO SHOW THE LAW OF MASS AND THE LAW OF CONSERVATION

More information

Problem Decomposition: One Professor s Approach to Coding

Problem Decomposition: One Professor s Approach to Coding Problem Decomposition: One Professor s Approach to Coding zombie[1] zombie[3] Fewer Buuuuugs zombie[4] zombie[2] zombie[5] zombie[0] Fundamentals of Computer Science I Overview Problem Solving Understand

More information

Significant Figures The Jacobs Way

Significant Figures The Jacobs Way Significant Figures The Jacobs Way Measured values are limited by the measuring device used. This limitation is described in the precision of the value. This precision is expressed by the number of digits

More information

Automata and Computability

Automata and Computability Automata and Computability Fall 207 Alexis Maciel Department of Computer Science Clarkson University Copyright c 207 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata 5 2. Turing Machines...............................

More information

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course

Adam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course Adam Blank Spring 2017 CSE 311 Foundations of Computing I * All slides are a combined effort between previous instructors of the course HW 3 De-Brief HW 3 De-Brief PROOFS! HW 3 De-Brief Proofs This is

More information

CS 7B - Spring Assignment: Adapting the calculator for bitwise expressions. due 2/21/18

CS 7B - Spring Assignment: Adapting the calculator for bitwise expressions. due 2/21/18 CS 7B - Spring 2018 - Assignment: Adapting the calculator for bitwise expressions. due 2/21/18 Background Theory A bitwise number is a number in base 2. In base 2, place values are either a 1 or 0, depending

More information

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ;

1 Trees. Listing 1: Node with two child reference. public class ptwochildnode { protected Object data ; protected ptwochildnode l e f t, r i g h t ; 1 Trees The next major set of data structures belongs to what s called Trees. They are called that, because if you try to visualize the structure, it kind of looks like a tree (root, branches, and leafs).

More information

System of Linear Equation: with more than Two Equations and more than Two Unknowns

System of Linear Equation: with more than Two Equations and more than Two Unknowns System of Linear Equation: with more than Two Equations and more than Two Unknowns Michigan Department of Education Standards for High School: Standard 1: Solve linear equations and inequalities including

More information

Software Testing Lecture 2

Software Testing Lecture 2 Software Testing Lecture 2 Justin Pearson September 25, 2014 1 / 1 Test Driven Development Test driven development (TDD) is a way of programming where all your development is driven by tests. Write tests

More information

6th Grade. Equations & Inequalities.

6th Grade. Equations & Inequalities. 1 6th Grade Equations & Inequalities 2015 12 01 www.njctl.org 2 Table of Contents Equations and Identities Tables Determining Solutions of Equations Solving an Equation for a Variable Click on a topic

More information

Squaring and Unsquaring

Squaring and Unsquaring PROBLEM STRINGS LESSON 8.1 Squaring and Unsquaring At a Glance (6 6)* ( 6 6)* (1 1)* ( 1 1)* = 64 17 = 64 + 15 = 64 ( + 3) = 49 ( 7) = 5 ( + ) + 1= 8 *optional problems Objectives The goal of this string

More information

CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community

CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Python basics (a) The programming language Python (circle the best answer): i. is primarily

More information

What are binary numbers and why do we use them? BINARY NUMBERS. Converting decimal numbers to binary numbers

What are binary numbers and why do we use them? BINARY NUMBERS. Converting decimal numbers to binary numbers What are binary numbers and why do we use them? BINARY NUMBERS Converting decimal numbers to binary numbers The number system we commonly use is decimal numbers, also known as Base 10. Ones, tens, hundreds,

More information

CS 124 Math Review Section January 29, 2018

CS 124 Math Review Section January 29, 2018 CS 124 Math Review Section CS 124 is more math intensive than most of the introductory courses in the department. You re going to need to be able to do two things: 1. Perform some clever calculations to

More information

A Justification for Sig Digs

A Justification for Sig Digs A Justification for Sig Digs Measurements are not perfect. They always include some degree of uncertainty because no measuring device is perfect. Each is limited in its precision. Note that we are not

More information

Finding Limits Graphically and Numerically

Finding Limits Graphically and Numerically Finding Limits Graphically and Numerically 1. Welcome to finding limits graphically and numerically. My name is Tuesday Johnson and I m a lecturer at the University of Texas El Paso. 2. With each lecture

More information

CS1800: Mathematical Induction. Professor Kevin Gold

CS1800: Mathematical Induction. Professor Kevin Gold CS1800: Mathematical Induction Professor Kevin Gold Induction: Used to Prove Patterns Just Keep Going For an algorithm, we may want to prove that it just keeps working, no matter how big the input size

More information

CHM 105 & 106 UNIT 2, LECTURE SEVEN 1 IN OUR PREVIOUS LECTURE WE WERE TALKING ABOUT THE DYNAMICS OF DISSOLVING AND WE

CHM 105 & 106 UNIT 2, LECTURE SEVEN 1 IN OUR PREVIOUS LECTURE WE WERE TALKING ABOUT THE DYNAMICS OF DISSOLVING AND WE CHM 105 & 106 UNIT 2, LECTURE SEVEN 1 CHM 105/106 Program 14: Unit 2 Lecture 7 IN OUR PREVIOUS LECTURE WE WERE TALKING ABOUT THE DYNAMICS OF DISSOLVING AND WE WERE TALKING ABOUT PARTICLES GAINING ENERGY

More information

experiment3 Introduction to Data Analysis

experiment3 Introduction to Data Analysis 63 experiment3 Introduction to Data Analysis LECTURE AND LAB SKILLS EMPHASIZED Determining what information is needed to answer given questions. Developing a procedure which allows you to acquire the needed

More information

30. TRANSFORMING TOOL #1 (the Addition Property of Equality)

30. TRANSFORMING TOOL #1 (the Addition Property of Equality) 30 TRANSFORMING TOOL #1 (the Addition Property of Equality) sentences that look different, but always have the same truth values What can you DO to a sentence that will make it LOOK different, but not

More information

5 Major Areas of Chemistry

5 Major Areas of Chemistry Chapter 1 What is Chemistry? Chemistry is the study of the composition of matter (matter is anything with mass and occupies space), its composition, properties, and the changes it undergoes. Has a definite

More information

import java. u t i l. ;... Scanner sc = new Scanner ( System. in ) ;

import java. u t i l. ;... Scanner sc = new Scanner ( System. in ) ; CPSC 490 Input Input will always arrive on stdin. You may assume input is well-formed with respect to the problem specification; inappropriate input (e.g. text where a number was specified, number out

More information

The Haar Wavelet Transform: Compression and. Reconstruction

The Haar Wavelet Transform: Compression and. Reconstruction The Haar Wavelet Transform: Compression and Damien Adams and Halsey Patterson December 14, 2006 Abstract The Haar Wavelet Transformation is a simple form of compression involved in averaging and differencing

More information

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology Intermediate Algebra Gregg Waterman Oregon Institute of Technology c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license

More information

6.001 SICP September? Procedural abstraction example: sqrt (define try (lambda (guess x) (if (good-enuf? guess x) guess (try (improve guess x) x))))

6.001 SICP September? Procedural abstraction example: sqrt (define try (lambda (guess x) (if (good-enuf? guess x) guess (try (improve guess x) x)))) September? 600-Introduction Trevor Darrell trevor@csail.mit.edu -D5 6.00 web page: http://sicp.csail.mit.edu/ section web page: http://www.csail.mit.edu/~trevor/600/ Abstractions Pairs and lists Common

More information