New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CS 212 Software Development

by: Jose

CS 212 Software Development 673

Marketplace > University of San Francisco > ComputerScienence > 673 > CS 212 Software Development

David Galles

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

This bundle contains 5 quizzes, 1 midterm, and 1 final
David Galles
75 ?




Popular in Algorithms

Popular in ComputerScienence

This 55 page Bundle was uploaded by Jose on Thursday October 2, 2014. The Bundle belongs to 673 at University of San Francisco taught by David Galles in Fall2013. Since its upload, it has received 198 views. For similar materials see Algorithms in ComputerScienence at University of San Francisco.

Similar to 673 at USF

Popular in ComputerScienence


Reviews for CS 212 Software Development


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: 10/02/14
cs21202 Quiz 1 Question 1 Create a variable for each primitive data type available in ava Hint The code quotint a 0quot would be one variable for the int primitive data type Question 2 Create an integer array named quotnumbersquot initialized to the values 1 2 3 4 5 Hint Use the to initialize the array at the same time you create it Question 3 Which of the following is properly formatted and executable code Hint See httpdocsoraclecomjavase6docsapijavalangDouble html for details on the compare method A int returnvalue doublecompare10 20 05 B int returnValue doublecompare10 20 05 C int returnValue Doublecompare10 20 05 D int ReturnValue DoubleCompare10 20 05 Question 4 Which of the following is properly formatted and executable code Hint There may be more than one correct choice ampnna482 Bgmtb482y Cmtc482y D intd 4 8 2 E int e 482 Question 5 For the following questions consider this code switchva1ue case 1 Systemoutprint1nquotantquot case 2 Systemoutprint1nquotbeequot case 3 Systemoutprint1nquotcatquot break case 4 Systemoutprint1nquotdogquot default Systemoutprint1nquotfoxquot What will be output by the above code if value is 2 Hint Assume quotint value 2quot appears before the switch statennent Question 6 In the previous example what will be the output by the above code if the value is 8 Question 7 For the following questions consider this code private Float calculatePercentint actual int possible return float actual float possible What is the method name in the above code A private B calculatePercent C actual D possible Question 8 How many arguments does the method function require A 0 B1 C2 D3 Question 9 What happens if you remove the oat cast from the division Hhnruyquotreturn actualpossiblequot versus quotreturn floatactualfloatpossiblequot cs21202 Quiz 2 Question 1 Suppose that in the aVa program we have the following declaration initialization of the array called numbers int numbers 1 Z 3 4 5 Can you change the size of the array later in the program A True B False Question 2 How can we access the second element of the array numbers Anumbers0 Bnumbers1 Cnumbers2 Dnumbers3 Question 3 What data structure should you use if you want to add integer numbers dynamically to an array arr meaning you do not know in advance how many elements you will add A int arr B ArrayList arr C Arrays arr Question 4 Which data structure should you use if you want to store unique words in sorted order ArrayList LinkedList HashSet TreeSet HashMap TreeMap an nn C r UU Igt Question 5 Which data structure can store key Value pairs and has the fastest get operation ArrayList LinkedList HashSet TreeSet HashMap TreeMap an nn C3 rw UU Igt Question 6 What will be output by the following code String words quotcatquot quotantquot quotbeequot quotcatquot quotbeequot quotdogquot HashMapltString Integergt wordCount new HashMapltString Integergt For String word words Integer count wordCountgetword if count null wordCountputword Integervalue0F1 else wordCountputword IntegervalueOFcount 1 end of For loop SystemoutprintlnwordCountsize UnP gt P rPlJO Question 7 Suppose we have the following code String words quotantquot quotbatquot quotcatquot quotratquot Which of the choices below will print out all the elements of this array ASystemoutprint1nArraystoStringwords BSystemoutprint1nwordstoString CSystemoutprint1nwords DSystemoutprintfquotsnquot words Question 8 What will be the output of the following code String words quotbatquot quotapequot quotelkquot quotcowquot TreeSetltStringgt wordSet new TreeSetltStringgt forString word words wordSetaddword Systemoutprint1nwordSet Abat ape elk cow Be1k ape bat cow Cape bat cow elk Question 9 What will be the output of the following code TreeSetltStringgt wordSet new TreeSetltStringgt wordSetaddquotFenne1quot wordSetaddquotcarrotquot wordSetaddquotbananaquot wordSetaddquotorangequot For String word wordSetfirst word null word wordSethigherword Systemoutprintquotnquot Systemoutprintword quot quot Afenne1 carrot banana orange Bbanana carrot fennel orange Corange fennel carrot banana cs21202 Quiz 3 Question 1 Which of the following statements is true A Constructor must have return type B Constructor is not needed if we use the new operator to create an object C Constructor must have the same name as the class Question 2 For the next two questions consider the following code class Student private String FirstName private String 1astName Student String namel String nameZ FirstName namel 1astName name2 public String getLastName return 1astName public String getFirstName return firstName class Student What are the data members of class Student AFirstName 1astName getFirstName getLastName BFirstName 1astName CgetFirstName getLastName Question 3 Imagine in another class we created an instance of Student Student stl new Student David Karp How do we assign the last name of st1 to a Variable str st1lastName StudentgetLastName st1getLastName AString str BString str CString str Question 4 What will the following code output to the console when run import javaioFileReader public class ExceptionQuiz public static void catchQuestion try int test2 new int 1 2 3 Systemoutprintlntest24 catchArrayIndexOutOFBoundsException ex SystemoutprintlnquotDquot catchIndexOutOfBoundsException ex SystemoutprintlnquotCquot catchRuntimeException ex SystemoutprintlnquotBquot catchException ex SystemoutprintlnquotAquot public static void mainString args catchQuestion Uf WJgt Question 5 What will the following code output to the console when run import javaioFileReader public class ExceptionQuiz public static void catchQuestion try assume quotnowheretxtquot does not exist FileReader test3 new FileReaderquotnowheretxtquot Systemoutprintlntest3ready catchArrayIndexOutOFBoundsException ex SystemoutprintlnquotDquot catchIndexOutOfBoundsException ex SystemoutprintlnquotCquot catchRuntimeException ex SystemoutprintlnquotBquot catchIOException ex SystemoutprintlnquotAquot public static void mainString args catchQuestion Question 6 What will the following code output to the console when run import javaioFileReader public class ExceptionQuiz public static void catchQuestion try String test null SystemoutprintlntesttoLowerCase catchArrayIndexOutOFBoundsException ex SystemoutprintlnquotDquot catchIndexOutOfBoundsException ex SystemoutprintlnquotCquot catchRuntimeException ex SystemoutprintlnquotBquot catchException ex SystemoutprintlnquotAquot public static void mainString args catchQuestion Question 7 What types of exceptions are subject to the Catch or Specify Requirement A Runtime Exceptions B Errors C Checked Exceptions D All of the above CS21202 Quiz 4 Question 1 Say there are three classes Person Graduate Student Student What are the likely relationships between these classes A Student is the superclass and Person and Graduate Student are its subclasses B Person is the superclass and both Student and Graduate Student are its subclasses C Student is a subclass of Person and Graduate Student is a subclass of Student Question 2 What is the correct syntax for creating a class Circle from the existing superclass Shape A class Circle extends Shape code here B class Shape defines Circle code here C class Circle implements Shape code here Question 3 Let39s say we have a class Doctor that has a public method called treatPatient And let39s say we also have a class Dentist a subclass of Doctor that overrides this method If Variable myDoc refers to an object of type Dentist what will the following code do myDoctreatPatient A The treatPatient method defined in Doctor will be called B The treatPatient method defined in Dentist will be called C The compiler will complain that treatPatient has been defined twice D Runtime error Question 4 Can an abstract class have both abstract and nonabstract methods A No all methods must be abstract B Yes but the subclasses will only inherit nonabstract methods C Yes and subclasses will inherit both abstract and nonabstract methods Question 5 What is an abstract method A Method declared with the keyword quotabstractquot and without the implementation B Any method in the abstract class C Method that can not be inherited Question 6 What is a difference between an abstract class and an interface in Iava A In an abstract class all methods are abstract while an interface has implementation of some methods B They are the same C In an interface methods are all implicitly abstract and cannot have implementations while in an abstract class there might be methods that implement a default behavior Question 7 The following 2 questions refer to the same code public class Vehicle public int numDoors public int numwheels Vehicle numDoors 4 numwheels 3 3 public class Truck extends Vehicle Truck super numDoors Z Can we do the following in the main function Can an object of a subclass type be assigned to a Variable of the parent type Truck tr new Truck true Vehicle v tr A No there must always be an exact match between the variable and the object types B Yes an object can be assigned to a reference Variable of the parenttype C Yes any object can be assigned to any reference variable Question 8 What will the following code print public static void mdinString drgs Truck tr new Trucktrue Vehicle v1 new Vehicle Vehicle v2 tr Systemoutprintlnv1numDoors v2numDoors X142 B4zl C22Z D Runtime error Question 9 class SuperC1ass1 public int sum some code class ChildClass extends SuperClass1 public int sumint n some code A Does ChildClass override or overload the method sum of the SuperClass1 B override C overload D both Question 10 The quotdiamond problemquot is an ambiguity that arises when two classes B and C inherit from A and class D inherits from both B and C If there is a method in A that B and C have overridden and D does not override it then it is not clear which version of the method D should inherit that of B or that of C How is this problem solved in Iava A Version of class A will be inherited by D B This situation can not happen in Iava C D will be forced to override this method D Both versions of the method will be inherited cs21202 Quiz 5 Question 1 Select states that a thread can be in at any time select all that applies new runnable terminated waiting timed waiting blocked sleeping awake OOOOOOOO Question 2 Suppose we have a Thread object as follows Thread thread new Thread What state is the thread currently in after the constructor is called 0 runnable 0 new 0 waiting Question 3 What method in the Thread class do you need to use to make a thread transition from the new to the runnable state run wait start new OOOO Question 4 Suppose we have a Runnable object as follows Runnable F new Runnable Override public void run SystemoutprintlnquotHel1o worldlquot How do we create a Thread object t that uses the Runnable object r above 0 Thread t new Threadr 0 Thread t new Thread 0 Thread t new r 0 Thread t rstart Question 5 Suppose the main thread has created several worker threads What method in the Thread class do you need to use to make the main thread wait for the worker threads to finish wait 1390in sleep1000 notify OOOO Question 6 Which of the following statements about threads are true 0 Each thread has its own address space 0 Threads communicate Via shared access to data 0 Synchronization can be used to have some control thread execution order 0 Threads allow an application to perform different subtasks concurrently Question 7 What39s the difference between waiting state and blocked state of a Thread 0 They are the same 0 Thread enters waiting state Voluntarily as opposed to when it is blocked involuntarily 0 Thread in waiting state usually waits for a locked resource Question 8 public static void mainString args Thread t new Threadnew RunnableInter tstart tjoin1 other code When will the main thread become runnable 0 Only when t terminates 0 When t completes or timeout occurs 0 It will remain runnable in any case 0 When it is notified by thread t with notify method 2 39 g CS Java Basics uiz a39 red may use any resaurce ta ansvverti1e questians belafvv If yaiu are nevvta iava jf ti 39 1 may want ta review Lesson Language Eiasiesfquot fram the af ltiai java tauIariaIs at i i tt idea araei in 39 I Q tafali quotLava invut andb li ii iii iiii1rtr iv39 quot quotlE An n KtasE 4 in Yeti have the entire ciass time ta campletei the quiz The qiuizvtrill be disabled aiter class ends Be earefui net to ciase this window before sulJmitting veer ansvversi ti Required V Name i t 5 If Please enter year first and iast name with praper eapi ta39i2atian 39 Usernarne F 239 Piease enter your USF Caanect username in all 39awenase j Create a va riabie far each prin39iitive data type available in Java HiIiint The code quotint a 0quot would iae ane variable far the int primitive data type qF cu 3 L K 15109quot ffwqfafi fa Pt ps a 2 a tau 3 g mi p 20 EJERE he V J cuasdkg El 5353 I tg y H i V nI72 IF r39 i nj 0 3539 H H n 5 E39 ht3 E wfr 0 YCha 339101T 4 gt I 45 Create an integer array named quotnurnbers39quot initfiailized tn the values 1 2 3 4 if Hint Use the ta iriiti aize the array at the same time HJLl39 creaite it Innumhti 39 new 39n1ii3339 Ji5 3 ifS3 hi7 ii P 39l1aHId1 39ii ie Wiwich at the falldwing is properly farrnatted and EKECL1l tEibiE cede if Hint See httpz idacsaracIeean1ijavaseIE39daesiiapiijavai ahgi39Dau biethtmi far details Di the earnpareii rnethad L Q int returnvalue diaubieiampare1Ei120 L5 0 Q int returnviaiiue daubiecempare10 I 05 05 T gf t int returniiaiiure Dau39biecdmpare1vUi I 20 05 D O J int Fteturnviaiue DauiaieCampare10 J 20 05 sine a ea Edie A um which ofthe foilowing is properly lforroatted and executablie colde If Hint There may be more than one correct ehoite I iota24 82 I int b 4 B 2 Imte4 kLE2x almes 3 int cl 4 is 42 ae G For the following questions quotciolnsiider this code switchva uei case 1 SystemoutprintInquotant N case 2 H Sysltemoutprintln beequot case 3 Systemoutprintlnquot39catquot break case 4 5vstemouttprintlnquotciQquot default SystemoutprintIn39foxquot What will be output by the above code if value is If Ilint Assume quotint value 2 appEaI395 before the switch statement her 3 quot3Biquot t oll39 1lFx l e1e1tFA g1ie cMg E I so 1 v v If S 0s lz m lmy1 ti C E What will be output obey the above code if value is 8 If Hint ssLime int value 3 appears before the switth staternent F025 lll P B 3 quot I q T rJi raMr quotJ quotquot1 U H Fer the fu39llmeing tmestiens censltler this cutie x priuete fleet calultatePe rcenti nt actual int possible i return fleet actual I fleet possible See httpHdecserecIecn1 avaseftlutarialjjeveijlazve0DIKmethedshltmI quotif ynu neetl hel is the methe2 name in the ebeuel cede 3 If Hint We use thee term quot metheclquot iineteecl of quotfunctien39 when discussing Java cede Y s 0 private quotT C3 ll I CElIEUiatEP39El CE t T quot F E 0 actual it d6 0 ipessible 7 1 How many erglulments times this methedfunetien requ39iire If Hint The term quoterrgumentquot is interchengeeblie with quot par39emleterquot 0 1 2 3 Q 0h 1 J I iuh39he39t39isitl1el relurn inf the methfg6 0 quotii if Hint We use thextlerm quotmethed39fiinsteed elf fumtienlquot when liseussing ja uae39zude 6 Z int P v P p 0 illis H no tleuble J x P Q4 ewl 4 e fMl3 39 M 9 Z quotl r Q fleet T E 395 it E 5 313 Hid i 7 I lie tgctfy39lfrgr 39Er 1 RI What happens if yeu remWe the quotfI39ea ti39 cast from the diuisitm 0 y P it if Hint Try quot39return ectuel I ipessilJle versus quotF39E1Zll l39i391 fleet actual I l eeti pussit1 Iequot TV z x j 0Jt y hf ju A V d t Zy 3 F i Z 45 Leif p E39 i as Qu l39J39W ti quot quot W W5 b ss s 3 p9u s p8 s39quotI P aquot1 o t J e J 5 JLAEV1 v gsfzls 2 ugly i39 i1 5 t ml I ampI 2 lA uti feeds M sf wit CS f So rware Development Professor Karpenko Fafll 2013 Midterm Exam llonday October 71 Print Your Name 9 c rE a a r Instructions You have 1 hour 30 minutes to complete this exam Vl1en finished with your exam double checl your answers and your name and hand your exam to the in structor This is a closedebook exam except that you may reference the Jasra AP Documentation on the lab cornputers You rnay not use your laptop nor Etclipase Clear your desks of all books laptops cell phones and other distractions Tr to sit apart from other students ifpossible Fill out each answer legibly Make sure you answer all parts of each question Some questions require a short answer and explanation of that answers Cheotr39ng This lesam must be completed inclass and isndividuallyl Using unauthorized materials will be deemed cheating and will result in a for this exani Looking at or copying the exams of your classmates will also be deemed cheating and will result in a 0 for this exams ee ff Question 1 1 13 15 3939abr3939 a value of a primitive type 1pt 5 If 23 rr if P M jHr D lb What will the Following cede print 2 pt int i r p do Qquot Systemautprint1ni iE 0 D Oniy 7 while i re 1c How can we access the first commramd line parameter 2 pt public static void mninString urge 0 3 J339 p rs owmanta 1 args 193 1 Question 2 2a If a variable is declared as private where may39 the variable be accessed 21113 3 Hi 1 9 9 f i 2h If a meizshed is declared as JI U39tEiCtEdW1EiI quotE may the methed be 3 accessed pt V A VI M r 4 0 L953 EAnJ 3 p 4 J p 4 1 PI1 4 Zc Which class is the superlciass of every classp1 PK Hvc 0amp4 bi L IN lt0 Azd Declare an integer variable Wlr that h rtilizE p either at declaration er in the constructor Which rkeywnrld will you use to declare it 2apt fhg 1 K6 HmJ wk 9 Clf 3J trc pG t J P 9 Iveialrnexample efimrnuitabie object 3911tr Wtr ct A i W U J 1 3D mt Evian Scalieei 39 use well 3939j etlitzw AnrnuJfe lt L Q Iaestiun 3 Consider the following cede public class Teststetic public static int stvar public int var public static void main Teststatic testl new TestStatic I1 11 Teststatic testz new TestStatic test15tVar 5 te5t1var 2 te5t2stUur 16 te5t2var 4 ihenumber 1 gets printed with AssertinfEfr0i H a 5 u 7 1gEga jr JIH 39en39xi I a r rr mt7 1 1wr z 39rnrn t1 m nvr1ru a quot39 r 392 39 J u SystemeutprintInCte5t1stVur quot testZstVur Systemeutprint1ntest1ver quot quot te5t2ver 3a How many eepies of stimir were ereatred tetel fer the two inetancesteete1amiteet22 y w gt P quoti I V rfa i g Pa t aigfi w v 5 v Hew many copies ef variable are re tntai were eieieeitec fir for the two instances testl and testz lptj J Li39u 39 b41mL UwJd P s Far mitt rug 4 Ca 31 What will the cede above print mt ii 3 10 3 1139 Question 4 A 43 What happens when the felliwing cede is compiled and Z i39unS e1eeit the correct ansiver 2 pt 1 fer int i 1 i lt 3 i er int j 3 j 1 j essert ij i 1 enhr Tut edh i AI he cia Ee nmpiiBS and but does not print anything J I mix 2 e2 9rr5f n 1 0 J 5quot P The niimbier 2 gets printed AssertienEi39rer D The number 3 gets printed with AssertieniErroir E The jpregram generates 21 eempilatien error quot39 r3939g 31392221 39 V 7 V 39 iaey Which of the foltlowing statements are true about the assert e statement There may be more than one correct answer 2 pt 2 F hen a program having assertions is run ea option must be i specified otherwise the assertions get ignored B If 1ogica1epression in the assert statement evaluates to true the program generates an AssertionError he program terminates on its first AssertionEr139or Question 5 Questions 5a Sb and Se refer to the code betlow TreeSetltStringgt words new TreeSetaStringgt word5oddquotFishquot I q werdsoddquotoctopus wordsoddquotshorkquot wordsoddquotfishquot wordsoddquotee1quot Systemoutprint1nwords Sta What will the code print 4 ms E quotat 1 u H Ur Lopui it 39 f39k j a LorJW M LinketiHashSet instead of TreeSet see description of Linked ashset in java Documentation 1pt A H96 Ir E ruua39 gt iim l Eff K Sc If we use Treeset in the example above what will be the value of res alter this statement is executed tlpt String res words1owerCquotmoiiquot 3 i e Zre eeti gt1rwery 9 C odNr539 V 19 Cr M in eq 5 i it e 39 it t1La ci39lVi l HM inst gi r 3 m n2n39a39 v uLu e39 39 I39q 39 quot 7 14 Question 63 The following piece of code shmild implement a library map fer each persea it sheulcl stere a sorted set of heelts the person berrewleld from the library Example quotJonesquot r quotlt1trecluctien to Java quotBeak ef Fairytales quotSmithquot quotC for Dummiesquot quotNepal Travel Guidequot quotBircisquot 63 Fill out the cede for add method of Librarymap Spat 611 Fill nut the code fer printO method of LibraryMap 5p39l 6 Is private member of the class properly encapsulateld Explain your answer 2110 P F mql Mg r1l Ikquot A 13 mafe5 hriup 3 U 5 impart jevauti1 e ma a gm it less Librerymep stores a library record Fer people Fer each persen it maps the pereenla last name te the list et hanks he HF she herrewed tram the library public class Ltibrtnrybiep private Treeiaiapestrtinlg TreeS e ceStringgt map Libraryap map new TreeMapString TreeSetltStringgtgt pu bquottic TreellapString 39Tf EESEtltESt 39i g2r v getMap return map glee m m m clwj quotg 0A A are ruuu uanrnnnuujrscngew f far a peeaan with a given name add the title aF the beak as a aaiae Remember that we may DP may net have added an entry Fan this peesan in the past f public vaid addString name String beak ff Fill cade here it TaLa 51frrU IS ealllf H 0 e i F P 39I3939i quotu39eat Tn Sen E539 L3939 53 1 l39F 3 laJaJJ low 3 z map pm naimr file f print the map ta the eanaale in the fallawing Faemat NameDFPeeean BaakTit1e1 BaakTitleZ N public void print If fill eaae here P P J r1 Equot V p P J Ii Ivl D gyg glean p r J39liI E 1339 jgj I gt it a Tree 5 5 r 39eJ quot 39quot5 t quotquoti ygig f 39 S l7quottreJea HF 7 quotquotquotquot I 7iLi391394quotquotquot quotquot hquot lial whit C in 39 iquot39 mii 4 quotw 391 lA nm l4quotquot I 3 gr a Lrl39f1lje rililir quot quot 539 iqaleatian 7 7a Can one inteirfaclel implement anather interface 1 pt 7b Can lane interface extend anatlier interface lfyes under What circumstances would it e desirable far one interface 2 t extend anather interface Give an example 2 pats 1 A Ff a r1 aTa39i1nnrif C if e EJ B B E EA 1 E 1l f H F B B A 7 Consider Class Shape below public abstract class Shape protected String name publicShabeString shape bme fhi5neme shapeweme public String get eme j return thisneme public abstract double getAree public abstract void draw is this an interface r an abstract class 3 pt A iIinterfec e Abstract class 39 They are the same i D Neither 7d Fill in the missing parts ef class Rectanlel f pts class Rectangle extends Shape implements Comparable private ig width height Rectanglefibd w int h width w height h 1 public debbj geteree j ff fill cede here m i V H J1quotw s n J 1El public in campareTaRectang1e r f Fill cede here aampareTa me had ehauld eamaare rectangles based an area f J p quotquotV X r L1rr dn 3 V 5 aha a V r 3Elr4F eC 399gUfrreaC1f 5 e Llcf reghwn o V 9 Question 3 In the fa awitig code assume there is else a class Animal that has a public member variable name public class Testtlass public static void mainStPing args animal animal new Anima1 anima1name quotFaxquot Systemautprint1nanima1name testFanctiananima1 Systemautprint1nanima1name public etatic void testFunctianAnima1 animal animal new enima1 anima1name quotGoatquot V n n39 quot g quot39La q r39qni at 1lzi l39h3939nF Iquot 39 IdzEu r 11 Be What will be printed by the code above Note that there are twe println statements in the code 3 pts 1 0 a Fa Eb If we change testFunctien as Shawn he1ewwill the eutput change If yes how 2pts public static veid testFunctienAnime1 anima1 enima1neme quotGoatquot 0 V fee 5 My F hf I I E39FE 1L C Dees lava pass by value er pass by reference 2 pie 1 0 4 a ul 5 n 39FL39nh r i 4 3912 Question 9 What will the fullnwing cnde print 3 1115 public class Cquotircle private double radius Circle double rad radius rad double getRc1 dius return radius 3 public s39tmic vnvid muinClStrquotLng nrgs Circle 1 new Circle j Circle 2 1 Cirllle 3 new Clircle 16 c1 3 Systemlnutiprintln clgetRadiu5 Sy5temnutprintlnCc2getRudius Sy5temoutprintlnc3getRndiu5 I 3 P W 0 Question 10 103 Assume that in class A we have the f UHOwiI 1lg nmtlwd public int Funcfloat a Float b Can we lovlerload the meth d to l1avet1e following silgnat1IlI39e puh11 c39 Float Fluncl flnat 1 float to J g A M Explain your answer 1ptj V0 0 N 5 wgt 2 quot 395 J 1 WW I Ewxn n 53J il Q l b Consider cucle below What will be printed in line 10 uftlme main functilnnl 4 pt 3 1394 1 E M N JH quot quot la new 4A 4EIz1n39 nunnE4 class Supartlass public int Func int a iquot39EtUIquotf39l class Sabtlass 0verride as extends SuperC1ass public int func int a racurn aa public static vaid mainString args Supartlass Subclass subi sub2 5UpEFl new Super lass jg sabl new suag gvssi J 39p suparz int rasl int res2 int res 0 J3 Systemaut II saperl suparz Subtlass j Sh 3 as gg ii s 3 3 supar1Func3 HA 9 sab1func3 saparZfancC33 cw L print1nres1 quot res2 ras fa5sub2 5ubC1asssaaer2 A int Fas4 subZfunc3 H7 SystemautpPint1nrcs4 13 10c Is the statement in line 5 af the main 1 Ci I1E1I1EX I plE at apcasting ar dsawncastiang 2pI A C10 H ftJ1 iaj 10a is tha sta temant in line 12 af the main function an example af upcasting r dawncgasting 2p1 DJ M 13 391 nu 39 az ai Jan 1391 19 What will be printed in line 14 int Qif1Estiun 11 Excep tinms 113 What is the pllrpnse of the fin4all3r CIHEISE nfa t y CHTC h l1EHy39 statement lpt PL 3 Mr 1 LG I D o wJE AH 0 V Q tiff Eng ivireiig M139 quotquotquot X J ET Lr h 5 11h What ezvcceiptinns must a mtthnd39s39 WJWS cmse tieclare E vf O h f394rf J 1quot if A a4 rnh 1 b i11bn J 111 What happens if atr339 catcI1fiI11llj39 state111 m1t durs lquotIEJH1EW39 P catch clause tn handle an ezmeptinn that is tl 1139rmn 1Lrithin the hmiy ff the 0 statement E392plE1il l 31111 21Inm31 A 3 ptm E g39 p V o py 08 p 39 L quot 11 EJ r 3 LiJ w39 ef 0 wQuestiunA 13 Consider tI1e nude b1n39w It d l 1ES p l i111Et l i Ef1 A class called Cnntainw that hmIv s nbjml 3 uf gEIH1IquotiI Emit T in 1111 F1rrarLi5t CL1r139eI1t1y this truthquot will Hui EmiI11ilESil1l 39 11111 metlmd calls dD1E1IE1 Hl tIe I391 tE lZl39l f 39l an I1ch ulmlllmt uf t39I1u11 I 1P bI1t methucl iil llbl v lll 1025 11m exist fun grI1t31nI type T Chanwge the class dECIEII E l iElI 1 sllttrwtm in blue 5 tlmt thi mde cnmpile3 4 pts v nEw E 0 P In W it j w J 393 J p 0 A j M Na 1 5 39 F1 quotF 39 E El in 1 0 in ll p quotii I All J L Jquot H ll ah r I E UF rsIquoti7rx 15 Hint any subclass f Number will have duubleVaue method im art avauti1ArraLi5tw V VL f I fquot V r u r 7r amprr 7 l Mil Vquot39 39b39 ArrayListltT data new ArrayLi5tltT public vaid addT elem dataadde1em a h ublic ArrayListltT getData return data public double sumc 7 duuble sum G fnr int i i c datasizeC i sum dutagetidoub1eVu1ueC returnAsum public static void rnuin string IIr gS CantainerltNumbEP C new CnntainerltMumberj cadd1 cudd5f Sy5temautprint1nCquot sum 2 quot c5um IE Qaeatfian 14 Caaeider the caddie belaw In which arder are the threads gaiag ta nish ExaIei n year answer 6 ate class HyThread extends Thread private String name private Thread waitSFar HyThreadString name Thread ea thi5aame name waitsFar e wa auhlic vaid rant try T Theead5Ieep1a catchEInterraatedEaeeptian ie Syatemaatprint1niegetaeseage j g 1 if EwaiteFar nu nu11j fr wait5FarjainC catchInterraptedExeeatian ie Syetemaatarint1nCiegetMe55age3j 3 Syetemaatprint1aname quot finishedquot dpuhlie claaa WaitingThread5 paablic static vaid main 5t ring E aagaj Thread t1 2 new MyThread 1quot null Thread t2 new H3Threadquot2quot t1 Thread t3 new39MwThread quot3 t2 TI t3etartE t2startj tieatart j u eamp5 1 P Z T tf MJW p JaH m ih t e i i J graet ieee 1 gt1 r JJe Hirtcsifi pi i Jr a pL A39nSWEr h 5I J y039n 3 Y e ii3E hintsvi 39l AtIkx gin wo 33951 Le39 g r ELIE s Ema Htliu t g v 39a1 H i 39 39393939 j f7 t 39 39 M J J31ti ta ri3939tt39J1f new p o a39 quotsiiH stat I5 e 39 i J 0 x T f A 4 u quot r f 2 6 an i Ag rm 47rJ uestinn 15 If H n 153 What state is a thread hen It Is eseieut ng 1 1 1 Y un nit pg 15h What state does a thread enter when it cannot acquirie a ieek en an ehject lpt 5 ct te weak W ii 15 What n1ethnd must be implemented by all threads lpt 391 P 9 3 151 Whatquots the difference hetwieten waiting state and blacked state nf a Thread 1 pt 2Z f it re re ea E h ems is L U pQz Q Y V Z quot 9 Z They are the same sX tID s39rtgiv 5 X g MWgr Thread enters waiting state veluntarily as nppinsed to when it is V T zV blocked inveiurntarily C Thread in waitin state usually waits fer a leeksdd resource 15s when can a thread execute a synchronized m ethed lept Z A Based en the erder in which this thread was started After it has acqnired the lock for the n1ethnd39s ebjeet er class After it remained in the blieeked state fer a certain anmunt of time D Anytime 0 V qr EFNFJ 3913 Que5Ii un PkV Cerasideir the fellwing cede public ckeee Ceunter int count 6 public 3ynchrenizedveid add int vu1ue thi5ceunt veiue public class CeunterThrecid extends Threed pretected Ceunter counter null publicCeenterThreudEeunter ceunter thi5Ceunter ceunter public void run j ceunteredd1 public static void meinCString urge new Ceunter new Ceuntertjg Counter ceunter1 Ceunter ceunterz II Thread threadl r Thread threed2 new CeunterThreedceunter1 Anew CeunterThreedceunter2 Fl I1 threed1start threed2stert 163 What is the methecl add of class Counter syrnchrenieed en 0 32 lpt 9391 Jgf0 1 91 P a vwTamp h p 5 gt 19 16h Can threudl and thr ecid2 execute ddC methutls an the 2 cm re5p ndiVng nbjects simultaneously p T v 39nj5 I TA W J5 1 v pX quot iF3 1 W quotJ I139 A39 r Li We J1quot Irw f H r ac 39f r4t 39ma 43941 W 1 U m quotPquot 161 What if we Chane the main fi1ncti I1 tn he as Sh WI l hel w Can thread1 and thread2 execum cidd methnds simultanenusly Hm public static vnid mainString HFQSD new Cuunter j newChunterThreadCcaunterj new CuunterThreadcnunter Cuunter cnunter Thread threudl Thread threadz thPend15tartj thrend25turt t Pd C Pt I t v n I gm hrmmJ tMH V jg t r J g rquotLE3I P t L E J I39 T I j Equot xgr 4v u 9 U j JWH jm h x k pWTj Q Ou gtrI 1rcnE1 J g0 L ak sy H 1fL p xs 21 Extra crseclit 3 pig W113 will the follcrxvirig cadc print c l 0 Public claas Clu55A public static vcid 5tnticMethnd SyatemuutprintlnquotClassA 5taticMethcdquot public class Clnss extends C1nssA cverriding the static methud public static void 5tuticMethcd Sy5tEmnutprintln ClassB 5tnticMethndquot public static vcid mcinCString uFgs Clussh a new Clnss Elass b new Cla55B Class ab 2 new Clns5B a5taticHethndj bstaticMethud ab5tuticMethnd E Jabs PLg 5 A rL1li L T0 V r ItL33 p 3 r quot clef u 0 rfSTahE J ij 3 1jCfA9 we 4 l CS 212 Software Development Professor Karpenko Fall 2013 r 0 Final Exam Monday Dec 2 P l J U Print Your Name 3039 r Wo ilnstructions You haste 1 hour 3 rninutes to eomplete this exam when nished with your exam cloublreehreek your answers and your name and hand yours exam to the instructor This is a closedbrook esan1 eseept that you may reference the Java Mil Doeumentatlron jetty API and Sen let AP on the lab eornputers You can also use the SQL cheatsheet provided to you Yoru mtay not use yours laptop nor Eclipse Clear your desks of all beoks ilaptoos cell phones and other distractions Try to sit apart from other students if possible Fill out each answer leggibly Make sure you answer all parts of each question Some questions require a short answer and esplana on of thatanswe39r Cheering This exam must be eornpleted inclass and individually Using unauthorieed materials will be deemed cheating and will result in a 0 for this esam Looking at or copying the exa39ms ovfyour classmates will also be deemeol cheating and will result in a Win For this exam Question Ia Assume we haste a large shared data structure called DATA What eperatiens new eccur ciencurrently Era1 p Thread 1 reads frern ems thread 2 readsfren1 DATA quotThread 1 reads frem DATA thread 2 writes te quotDATA Ea Thread 1 writes te DliTA tliread 2 writes te DATA Questimfl 1b What is the advantage ef using MeltiRealderLeck rte synchreniee access te shared data as eppesed te using the synchrenlaed kE3 vWEll i 2 pt MultiReaderLeck alliews multiple readers te access the data cenicurrent39ly MuItiReatierLect aliews rnultiple writers te access the data ce nicurrentIr 2 Ne cli erence these twee srnchrenieatien mechanisms are identical Question Ea assurne we have a class Shared Set public class Shered5et private HeshSetlt5tring set public veid eddString s setedds public beeleen centeinsString s return setcenteinss Writes a class Threed5eFeShereidSet where yen ererrlde the metheds efclass She redset te make it threadsafe using lalu391tiFeuderLecL lieu de net need te write the cede fer llut1iRele39deirLeck asstnnte we have this class 3ptj 71Wletlta sax F 5 Vie er ti c J icicril E riciar s391 ic AEi395iirreiquot L Li Cfi rhm wC lay wr MC39r UP39Eramp eager U HH fK i fri g9ht tzieui 3 1 i e acgjciiii V grquot IL39 50 n tEifii9Irlsij Q pd ii U 5 t gt 1ei139an fees It as l a an Pr39caJIC 2 3 it ml 391 5ediced i5WquotJ 39 3 PO p fl 0 e4l L ni5e39t iiiirreei ig Z 39 Ia rr1 p rm P 1 ueet39 K r I39Ir quotq xIu39np 1 I g N V39 W F Question Eb Assume that instead efusing Evlulti evaderleck abmre we make addStri rug s and celntainsf tring sf rnetheds synchronized will there be any difl erenc39e in how rnultiple threads can access ThreadSdFeSha39r39edSet lpt Yfj Pa5 5 p werelfdl ref r em L742 a C pi Pf I F I b F PV Z Lt gill iquotTrquot39 fvx Questginn 2c Censider the cede fer methadds leckwrite and unleckW39rite efclass MuItiReaderLeck will it work cerrectly If net what do we need to change V Please make the changes directly39 in the cede Ept l l public synichrenize d acid lack39c39u39r39itef P c while writers 3 ll llflgii 7 0 V try Haiti catch InterruptedExceptien ea s writers public synchreniaed acid unledcllthquotrite writers N9 39 5 52 J7i039lt39lU fill J P J a W Questilm 3 Let us assume we have lElquotquots implernentaticn cf WerkQueue that yeu used in project 3 and we created an instance cf it 3 pt Werkqueue queue new hletrkqueueicj Lets else assume we have the fcllewing class public class Mywerker implements Runnable e verride public raid run int sum E for int i9 i 1939 i sum i Systemeutprintlnquotsum quot sum What dees the fellawing sttaternent dc queueeaecutenew Mywerker jj A It creates a new thread Mywcrker and starts running it 2 It creates a new thread Mywiesrlzer and adds it tn the peel ef 39I hreads This Rnlnnable work is added to the queue The threads from the peel efthreadrs are n eti ed that new Runnable work has arrived Question ZIJ Assume that instead of using l iu1tiReoder39Locllt above we make odd tring s and contoinsSiiring 5 methods synchronised Willnthere be any 0F difference in how multiple threads can access ThreodSoFeShoredSet Hit A 3 ls L T M an em 44 we 0 C in W l C fwgJJc l gmj3 W Vg y hB B is tell Serum n 1 E 3 frame Question 2 Consider the code for methods lockwrite and unlockWrit39e of class Q Mu ltiReaderLock will it work correctly if not what do we need to change K Please make the changes d39irectl3r in the code 392pt dK J M gr 1i public synchronized void 1ockWriteT TJ l while writers in 9 V i3939 4 7 S P A try noit catch InterruptedEsception en writers public synchronized void unlockwritec writers 1 aa l p t2 p 2 J 7 Question 3 Let us assume we have IBM39s irnplernenltation ofworkqueue that you used in project 3 and we created an instance of it Set 3 Y Le I Work ueue queue new WorkQueueCi Lets also assume we have the folllowing class public class Hyworker implements Runnub1e e uerride public void run int sum 9 For int i6 is 133 i sum i Systemoutprint1nquotsum quot sum P What does the following statement do queueexecutenew Myworker A It creates a new thread ls1rW39orker and starts running it B It creates a new thread Myworker and adds it to the pool of39Threads This Runnable work is added to the queue The threads from the pool o fthreads39 are notified that new Runnable work has arrived 39 Question ea what will the fnlluwing ccmle print What will be in each set will the prcgram finish Explain in detail Em impart jnvcuti1HcshSet public c1n5 Example public static Hc5hSetcStringgt set new Hu5hSctlt5tring 39 cpublic static Hush etc tringy sari new Ha5hSctcStringgt 39 cpublic static vaid muinCString arg5 j I final bjcct lcckl 2 new Dbject J final Object Iuckz new Object j Thread t1 new ThreadC public void run j synchrcni2cd1uck1 Systemoutprint1nquotThread 1 nquired 1nck1quot set1addquotString 1 try Thread5IEEpE5Bj catch InterruptedExceptiun e cgetHe55nge synchronizcd1nckZ Systemuutprint1nCquotThrecd 1 uquircd 1nck2quot 5Et2addquot5tring 1quot if lcck EH luckl quot4 ruru If Thread t1 Thread t2 H new Threud public void run 5ynchranized1 ckZ Systemautprint1n Thread Z aquired 1ack2quot 5etZaddquotString Zquot tF ThreadsIecp5 catch InterruptedExccptiun eEgetMe55agE 5ynchrcnized1ak1j Sy5temuutprint1n Thrend 2 uquircd 1uck1quot 5et1uddfquotStringc2quot t15tart e39 T i j 25tartO J T3 M T W cc W c it Ti1391mJ P It 51 GEE 8 7 in ma I4 Lc1E EN gap e e e 0 1 o 3311 rgf39 5a clriquot C1 p quotij3 L 4 1 cf gquot quotiIquot is The r an 5 LQf J vfa f 39 i tJmfJF l bf l 3 g fgc kE J 39ur39Ined 39 L 14Tr39lV 39V39V H 77 h R ueatitm 4b What can we change in the a39Inwe cede ta make aure bnth threads can finish a their werk nfadding to aettl and EH2 E39v t llaiI1t ZpI Hquot it M M t H1 391 W5 u 9 W J t V u if E ilt Que5 tiu n 5 Give example nfapplicatiena that run an the Internet Ipt 739 p ripe Question 6 Et1nsi der39this URL p t B My 1 quot3q3 i 39h39 l tarv1 m V p 39 r t P I tilesuracIeentmjavasei ftleteafaplfjavaIangfStr ingh Vlength 1 refff V T P T A Questitlim Era which part afthis URL indicates tI1e preteen 39ffi5t Questiun 613quot Which part efthia URL indiea39tea the demain 39551139 Qftiesti m tWh1 h part efthis URL ind39ieates the path and the resource 13939Sptt39t la A Question d which part nfthia URL intlieattes the fragment i5nt P pd re uZ wt 0 a rqgr P 2m4 H Trpn I Hes T 2 P a at t3Pttt eJae 6 9 nnrt hm 39 def E Que539titm 39b Whi39th request can be uses to semi data tn the websetrver Em GET 5 POST Beth GET and PDZST A t D i either ik rt1 Dre j Lu1 I5 Question 10 Censider the feliewing HTML eetle that displays HTML ferrn ltDUETYPE htmle ehtmla ltb dya ltFerm namequotLeginFermquot aetienquotf1egtnquot methedquotgetquot Name ltinput typequottextquot namequotuserquotgt Password input typequottestquot namequotpessquots einput type submitquot va1ue Legin e efferm ltfbedrgt efhtmla Questirn Illa What wil be displayed in the birjewser i i5pt Questiitltl 10b What rnethe d is used its send the data frern the ferm tn the webserver li ptl PB L0 p5 Questtien 1U39 Write an HTTP GET request that will he sent ten the welnsenrer ence the userquot enters quotAlicequot and quotbadijasswerdquot and elicits the Legin hutten Yen ear assume fer the 3 H P purpese at this example that the server is running an IeealhestBiB 251t P 5rar lnliW 3 it l7v39liD39vIii i W p r G 39l 52 39 H es L p l are lquot ii1quot Gnu emlme 391 Cle 23 Qjuestian l d What action will be taken us preeess the data item this farm ease the delta is submitted Hint whet will preeess this request lptj flat 5 2 Jquot139 ps all agape his TE 7 ii 5 I39M 39e 3l T P e C if jrrfiairie t 3 Questiutt 113 quotWrite a regular espressien fer finding HTML tags jessentiallr anything between and a srmbels 2 E 3111 L 0 0 ewe 9 J an i39 lH34139 39 l39v 39 ll 39139 3939l39 i 39llJ39 ils 5 E lll39 5 393 Questinn 11b Write the cede ef funetiren stripTagsSitring text that I Camp39iles a Pattern given the regula39 espressien fr m I lie 2 Creates a I39natehe39r fer a given pattvezm and a given tetti eti1tr n P 1 I llrltrxt m r V f quotA l A A ll J fwmlelier W1 am we au39 P 39 r Laa 1u rquotu r39r u q A I 9 Ti 1 w re quotquotquotquotquot 39i is II391m r n39 en u 1U Questien 1311 which ef the Feiiewing statements are true aheut sserviets Ere The eutpat efsenr1e39t is HTML page Ii BSmwhHsaw hmnen 5 5 Servlet is a small Java pmgram that runs en the webserseir A senr1 e t ean he inveketi by geing ten 1 speei e URL in the brewser T i1itquotse139s39letsissinstantiatedesre339JiIt1s1I1eIiSaelientreqexest Qtteestien 14 What are the rnajer eempveenents efa Jetty server Brit 390 HE TRe i Uquot 5 fZij iHi7 r e t r tier Camp FirLE Vquoti L h eh N quot V Q uestien 1ed Hew ean we make em applieatien secure Frem X33 attacks Ept 1 1 L T 1 7 0 mm P J LL mEJE if tr 2 1 ft er 0 A 11 emquot T j P 93 aiLirtst 8w at 1 x iti39 iu J ht 5 quotii i r n39s if eaif l Question 15 Fill in the missing eede in cleF39es39t rnetheti ef We eeme erviet assume it is mapped te jweleemej This serv1etdispiars an quotHTML farm that lets the user input his er her name After the user elielss quotSubmitquot hutten the servlet sheultl erreate 1 simpIe HTML page that says quotWeleeme usemarneiquot where username is the the name ent39ered en the HTML farm deGet metheti is presideti feryee the net metiiiy it Set public class weleemeservlet extends Http ervlet E verride public veid deGetHtte5erv1etRequest request Http ervlet espense respense Printwriter eut respensegethriter eutprint1nquotlthtm1s eatprint1nquoteheedgtlttit1esWe1eeme page lttit1egtefheedsquotj eutprint1nquotehedysquot eutprintlnquotlth1sP1eese fill this farm eKh1squot eutprintlnquoteFerm actienquotwe1ceme methedK P 5T aquot eutprint1nquotHeme etneut type teatquot nemeEquoteserNemequot ve1ueuquotN sehrsquot euttprint1nquoteinput typequotsuhmitquot ve1ue Sehmit a j eutprint1nquoteffermquot eutprint1n efbedysquot eetprint1nquotefhtm1a 11 public veid dEIIPvD5tHttJi5E39IquotVIEtREqtIE5t request Httpservltetltespenset FESPDHSE7 If FILL IN CUBE HERE 7f Ar quot1 39 tm P i fl m m er 6 9rain wee pjm o l I i T e Z If mi mmeLt quot wmw 3 wet fftyridls u C H i P Jr lquot eit39 J c 1Lvl 5Ef umr W IiE T it I H Pg be gt h1re LJrrimth ll5 Jf m39Iquotrquot39 quotI J 5 JqL CfsJy 9 all gr 1 H 3 d 1 I H 391 t El f 393quot i ti 139 e iiglSu ff dePest class Questien 153 which ef the felletving statements abeut Ceekies are true the re may be mere than one eerreet answer Eptja p Ceekie is a small test le that is sent by server It the elientt Ceekie is stered en the server side P Ceekies are sent back to the server on each reqlaesl Ques39t139nn 1611 which ef the fellewing statements about Servlet Cjeektes are true there may he mure than me enrreet ansvv er Epic Ceekies are added te HttpSerlvetRespense Server quotgetsquot the eeeldes from L HttpSterlvetRequest B Ceekies are added te HttpSterl39vetlReq uest Server reads the EUDIii s firem Http erlvet espensae C Ceetletes are both read and added to Httpsetrlvet equestt D Cereldes are beth read end added to Httpserrlvet espensve 15 we rte Jrr H 3939Jl7F ftfquot 12 fuestilm 161 What are 1he three appreaehes used fer aeasien tracking Zpt F J u 0 A e 5 esenrii J law A A 1 T an e W Qleestl en 16d de we need te do ereseien tracking Give example efa web applieatien that requires eeeeien tracking 2 pt L F Ta Krep z reugpi 52 Lrgfef iej fe ree1 a39n e p J 6 R t p B Ii Qlle lfi flp173Wha IiS MySq eD 5pt 0 M S A tiger F ve e A 2 h A M 4 iii 56 02 p Aquote Lquotu quot Equotquot39p Qzueetien 1Tb Whatia SQL ptl T T ease E 1 5 V T r V l 0O W m39Tir 1 2 If E i3939J39 a 139 4391 0W E1 ta quot ilauf Belew are the tableie that will be used for SQL questilme vendors T T T T T T T Uent d Vaendname Ve niem T ve39ndeepntry 1 T T Apple g San Franeiaee T UTSA J L Ttviierernann iurgaen T I India a 3 T T Lpene39ee Z Bseij39it1g China Tpvreduets T T T N T Predide VendidaT hlameT T a Price W 1 I T iphene EDD 1 T T 139r39IaeF39re E I piped T Z 2 Eaneaee eedlee T 451 W2 3 4 13 5 T T T b T T A58 H T 45nT iV T39LePhnnE 400 T 3T T h H A1wnnkyadM T T 15un rzgustumers T 0 x F CHSLEIEI d Nam5e i1ddres5 T M EEmail e TT T 1 m1E5 T T New fork R TioTnr5hutmaiIicum 2 Qb Li TT ETijing T IigmaiEcojm T 3 T z gm T BangauTrTe TT T b ramgmai39lcom 4 Petversgn Bnstuyn Tpetg5yahun cum s r Tmjgt T orders H E quot39quot Ovrder id Date 1 20131120 39 20131101 20131024 20131 UJ4 21313D9 Z9 order items rder id 3 Questiun 183 Whatis the PRIMARY KEY furthe table c39alle d prnductsquot 1 pt W QlIE539til39II1 1Eb WI391atiVs the PRIMARY KEY for the table called quotard eritemS 39 2 pt 14 Question 13 Write SQL query that will produce the foilowting result 2 pt Vent1name 1 Vendcountr h h h PA Micromiiax a India Lenotro M China E fy UquotnJn3 h p V rug tI39 We ivfn Question 1BdW39I39i1ZE SQL query that will prodiuice the following result rnotice the price column 2 pt A Prodiid H Name Pzrice is T ipotl q j zoo LePhoneT H p e il N 1 Cantrae oodlve 45 o p A58 450 iphone5 600 lquotLquotIF Uquotl A P Pcacezlm SEELECT orJJtmfr otii F iquot quot H p 0 mt 1 t Question 13e Write SQL query that returns the total numbefr ofproducta that have the price of 40 Bot ELe T coomw Perm we 5 W EquotiE 399 t J Question 193 Write SQL query that displays customer names and for each name shows the id of the order that this customer piaced 3pt Name rder quot 4 Li E5 Q 2 Ham 1 Pettergeon 3 9 1V 1quothquotquot rt Qrgfr E 39 T v f C ii 0 o 0 k 11 E ii I uL cmctJ 39 it rte or 5 dd 1 xm Ll it I u a i ume39A A39arI3939 s 5 9e 3915 Question 191 Write SQL query that displays customer names ens for each name shews the total tnumber ef erders that this customer piseedt 1 pt L9 Name T T t1T39rders Jenes T 1 a Li 2 Ram T 1 i Petersein T 1 T I seem as t TE T AVmrnt 4 0 7 W 35 T Q39ll EStiIZIII1 20 What is salt in eryptegraph3rj How is it used 1 pt Q T T F F T g k g h I W d Jigs tr uLt p4E39 1s 1 i I sz11iiue at h C L h j pA 4 i 4 u tT LT isquotL TTT isT reape 1 I is 0 g Pyd r39 is Am 153 f if Pe 42 Qllestitin 21 Consider the feliewing prepared staitementz 239pt a String USERSQL quotSELECT userneme FRUM 1eginTeble WHERE usernsme quot Peeperedstetement statement a eennectienpeepsreStetementUSERESQL b taJ1 tquot 0 ej gW sf 5 s J Write the cede that sets the value efthe parameter in the statement te be quotPetquot executes the query steeds it re the database end gets back the Resultset P L 0 Li ii P iii quot 0 L3939j39AFr1r squotA p J 7 T T T K u 0C P Y P Y tat it i 31r ul quot5 L


Buy Material

Are you sure you want to buy this material for

75 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


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'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.