Computers and Technology

Answer: 12. Examine the following code: CREATE OR REPLACE PROCEDURE update sal(v emp id NUMBER, v increment NUMBER) BEGIN UPDATE emp SET salary- salary +v increment WHERE employee id-v_emp_iod; END update_sal; CREATE OR REPLACE PROCEDURE do update (b emp id NUMBER, b increment NUMBER) BEGIN update_sal (b emp id, b increment); END do_update; After compiling the two procedures, you invoke the do update procedure using the following code: EXECUTE do update (12, 5000); Which statements are correct with reference to this code? (Choose all that apply.) A. The b _emp id and b_increment parameters are actual parameters for the do update procedure. B. The b emp id and b increment parameters are actual parameters for the update sal procedure. C. The b emp id and b increment parameters are formal parameters for the update sal procedure. D. The v emp id and v increment parameters are actual parameters for the update sal procedure. E. The v emp_ id and v_increment parameters are formal parameters for the update sal procedure. 13. The calc_comm procedure is no longer needed and should be removed. Which statement will successfully remove this procedure from the current user's schema? A. DROP calc comm B. REMOVE calc comm; C. DROP PROCEDURE calc_comm; D. ALTER calc comm DROP PROCEDURE; Answer 14. Which statement about declaring parameters is true? A. Only data type is required. B. Data type and maximum length are required. C. Data type and maximum length are not required. D. Only maximum length is required for the VARCHAR2 data type. . Examine this procedure: CREATE PROCEDURE update theater IS BEGIN UPDATE theater SET name V name WHERE id-34; END Because a value for the new theater name must be passed to this procedure upon invocation, you decide to create a parameter called V _NAME to hold the value. To be successful, which additional change should you make to this procedure? A. Add (v_name IN VARCHAR2) immediately after the IS keyword B. Add (v_name VARCHAR2(30)) immediately after the IS keyword C. Add (v _name IN VARCHAR2) immediately before the IS keyword D. Add (v name IN VARCHAR2) immediately after the BEGIN keyword. Answer 16. Examine this procedure: CREATE OR REPLACE PROCEDURE find seats_sold(v movie id IN NUMBER) IS v-seats-sold gross-receipt. seats-sold%TYPE; BEGIN SELECT seats_sold INTO v seats sold FROM gross receipt WHERE movie id -v movie id; END END; The value of v seats sold must be returned to the calling environment. Which change should you make to the code? A. Declare v_seats_sold as an OUT argument. B. Declare v seats sold as a RETURN argument. C. Add RETURN v_seats_sold immediately before the IS keyword. D. Add RETURN v_seats_sold immediately before the END keyword. Answer 17. The MODIFY_PAYROLL procedure contains many SQL statements and will be executed from multiple client applications. Where should this procedure be stored? A. server only B. system global area C. client workstations D. server and client workstations Answer:
Finding Numbers in a Haystack In this assignment you will read through and parse a file with text and numbers. You will extract all the numbers in the file and compute the sum of the numbers. Data Files We provide two files for this assignment. One is a sample file where we give you the sum for your testing and the other is the actual data you need to process for the assignent. - Sample data: http://py4e-data.dr-chuck.net/regex_sum_42.txt (There are 90 values with a sum=445833) - Actual data: http://py4e-data.dr-chuck.net/regex_sum_1789341.txt (There are 93 values and the sum ends with 508) These links open in a new window. Make sure to save the file into the same folder as you will be writing your Python program. Note: Each student will have a distinct data file for the assignment - so only use your own data file for analysis. Data Format The file contains much of the text from the introduction of the textbook except that random numbers are inserted throughout the text. Here is a sample of the output you might see: Why should you learn to write programs? 7746 1219298827 Writing programs (or programming) is a very creative 7 and rewarding activity. You can write programs for many reasons, ranging from making your living to solving 8837 a difficult data analysis problem to having fun to helping 128 someone else solve a problem. This book assumes that everyone needs to know how to program ... The sum for the sample text above is 27486 . The numbers can appear anywhere in the line. There can be any number of numbers in each line (including none). Handling The Data The basic outline of this problem is to read the file, look for integers using the re.findall(), looking for a regular expression of '[0-9]+' and then converting the extracted strings to integers and summing up the integers.