CSE 142 Midterm Study Guide
CSE 142 Midterm Study Guide CSE 142
Popular in Computer Programming I
verified elite notetaker
Popular in ComputerScienence
This 2 page Study Guide was uploaded by Jinyoung Oh on Monday November 2, 2015. The Study Guide belongs to CSE 142 at University of Washington taught by Stuart Reges in Summer 2015. Since its upload, it has received 277 views. For similar materials see Computer Programming I in ComputerScienence at University of Washington.
Reviews for CSE 142 Midterm Study Guide
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 11/02/15
1 Expressions a Evaluation priority I ii iii iv v vi Parenthesis Unary operators positive negative Multiplicative operators Additive operators addition subtraction Assignment operators Relational operators 1 lt gt lt gt 2 3 ampamp 4 b Make sure the answer is in the right form i ii iii iv Integer 1 7 10 Double 10 35 1025 String quothello quot121 4982 Boolean true false c mod remainder d Expression between I ii iii iv Integers integer answer Integer and double double answer Doubles double answer Integer and string string 1 Integer string merges them together 2 Ex12 7 2 1873 a Evaluate parenthesis first then evaluate from left to right b Answer quot37 2 1153 Anytime you see ampamp or it is a Boolean problem 1 True ampamp True True I True True I False True 2 True ampamp False False ampamp False False False False 2 Parameter mystery a If there are operations in the parameter evaluate them first b Tip Reset the variables in the void method as first second third and put them in the corresponding spots in println statement 1 public static void foo int two int one int three Systemoutprintlnthree are approximately two plus one Set it to foo first second third prints quotthird are approximately first plus second Pay close attention to what is passing 1 String pay dollar paymentpay passing quotdollarquot since pay quotdollarquot paymentquotdollar it is the same thing as paymentpay 3 fese simulation a b c d e Every time something starts with If everything goes to the test Else something that didn t pass if test goes through Something inside parenthesis is test If the test is true statement in executes Test does not change any value Assignment changes the value Pay attention to what is printed 4 While loop mystery a b c while lttestgt ltstatementgt execute ltstatementgt while lttestgt is true Test gt if test is true gt execute statement gt back to test Test gt if test is false gt break the loop and go all the way to the statements after while loop Pay attention to what is printed and how many times the statement in while loop executes Same as ifelse simulation test does not change any value and assignment in the statement changes the actual values 5 Assertion a b Point A is usually before the loop Value in parameter can be anything But you know the values that are set at this moment There will be a point right underneath the while Be sure that you don t get tricked It can come straight from beginning or can already be processed in the loop and went back to the test again For the last point after the while loop is closed means that the test for while loop became false 6 Programming a public static lttypegt ltnamegt ltparameter1gt ltparameter2gt 39 points i quotWrite a static method named ltnamegt public static ltnamegt ii quotthat takes ltsomething1gt ltsomething2gt ltsomething3gt they are the parameters Don t forget that the format of ltparametergt is lttypegt ltnamegt iii and returns a lttypegt there s the type of method If there s none then the type will be void Cumulative problems use for loop while loop if problem says until Be careful on fencepost problem Simple truefalse problem think about using ifelse Coun ng i Construct an integer that keep tracks of count ii While condition 1 If counting condition happens count 2 Else count initial value when problem requires to count something in row return statement immediately breaks loops and ends the method
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'