Sample final: 1) Be able to write a small web page. Know how to name it and to write some tabs. Know the link tab, and perhaps one or two more, including any necessary ones for the page to upload. 2) Be able to simplify programs. Understand program logic. ex: if x > 5 then x = 3 else if x < 5 then x = 3 This simplifies to if x not equal to 5 then x = 3 (I'll make it more complicated). 3) Be able to rewrite "spaghetti code" in structured form: ex: int x = 0; int i = 1; 10 if i < =15 goto 20 x = x + 1 goto 30 20 i = i + 1 x = x + 2 go to 10 30 output (x) This is a loop. We rewrite as i = 1 x = 0 while (i <= 15) do i = i + 1 x = x + 2 end do x = x + 1 output (x) or x = 0 for (i= 1; i <=15, i= i + 1) x = x + 2 x = x + 1 output (x) Of course, we should then simplify it to x = 31 output (x) 4) Show 3 strings in a language which contains the following definition: string ----- x |string| x ---------> | |------------y ---------------> Discussed in class. strings contained in this language include y xyx xxyxx xxxyxxx xxxxyxxxx 5) Explain three fields from the following partial output of ipconfig/all Physical Address. . . . . . . . . : 00-0D-60-C5-20-1 Dhcp Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IP Address. . . . . . . . . . . . : 132.238.16.159 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 132.238.16.40 DHCP Server . . . . . . . . . . . : 132.238.130.12 DNS Servers . . . . . . . . . . . : 132.238.2.17 The first field is the hardware (MAC) address found on the network interface card. The IP address is the network address (IPV4) of the machine issuing the call The default gateway is the router that routes all packets in the subnet numbered 16. It has the same first three IP address fields as the host. This is guaranteed by the values in the subnet mask. 6) Should the use of the Internet be monitored? Should it be regulated? By whom? I'll pick a different topic from the assignments during the previous few weeks. 7) What is the function of the following recursive procedure: procedure exp (N, M) if (N = 0) return 1 else return exp (N-1, M) * M end; The above provides exponentiation of a number to a non-negative power. Multiple choice questions such as 8) Three types of networks are _______________ a) LAN, MAN, WAN b) LAN, BAN, CAN c) WAN, BAN, LAN 9) An instruction to change your default directory in UNIX is a) ls b) mkdir hello c) cd hello d) cat hello 10) Use parenthesis to show how different precedence rules can lead to different outputs in evaluation and show the results. 3 / 5 * 7 - 4 11) Cohesion in software engineering refers to ____________ logical connection between entities of a procedure Strong cohesion is good. Why? How does OOP support maximizing cohesion? 12) Coupling in software engineering refers to ____________ connection between modules loose coupling is good why? How does OOP support minimizing coupling? 13)The use of Reference parameters a) makes passing of large data structures more efficient b) makes coupling between modules looser c) is more reliable than value parameters d) is a recommended software engineering practice answer is (a). The reason reference parameters are used is because they are more efficient for large data structures. 14)The following list is to contain letters arranged in alphabetical order. Provide the values for the links in the missing rows and the head pointer. Assume that the list is stored in locations beginning at address 20 and that each cell contains two addressable unit. ans: HEAD POINTER CONTAINS 22 (B) STORED (GIVEN) LINK (ANS) Z 00 B 26 J 28 F 24 M 20 15) Show a potential linked list representation for the following binary tree: N / \ C P / \ \ A D Z Possible ANS: head pointer contains value: 20 20 N 21 23 22 26 23 C 24 29 25 32 26 P 27 00 28 35 29 A 30 00 31 00 32 D 33 00 34 00 35 Z 36 00 37 00 16)List three advantages of database systems over file systems for data storage. ANS: Data consistency easier access control easier backup and recovery 17) Create a table for an employee relation. Include fields for name, address, ss#, years of service What data types should we assign to each of these attributes? POSSIBLE ANSWER name address ss# age JOHN JOE 1000 River Road 111111111 6 BILL BOE 1000 River Road 222222222 2 JILL JOE 1000 River Road 333333333 9 WILL WOE 2000 River Road 444444444 10 String String String numeric no restriction no restriction 9 char byte 18) For the above relation, design a query to find all employees that have worked at the company at least 10 years. You can either use an SQL language construct (SELECT) or describe how to do it with a GUI in access. POSSIBLE ANS: In access design a query; pick employee table; include age column; for the criteria mark > 9. Also enable output of the employee column. 19) For the above table, would name be a good key? Which field would be a good key? Why? ANS: name is not unique. You might want to define another field for employee key (or use the default ID assignment). 20) Does object oriented programming promote tight (strong) coupling? ans: Actually strong coupling is to be avoided. Object oriented programming supports loose coupling by communication via methods that pass parameters typically by copy (discuss what this means). The data structure itself is available only to the oject implementation. 21)Assume that a stack and a queue are both implemented as linear lists ( A B C D E) and that the last element inserted on each was E. What element will the stack pointer be pointing to? If we next remove an element from each list, what element will be removed from the stack? What element will be removed from the queue? ANS:The stack pointer points to E (the last element inserted. E is removed from the stack; A is removed from the queue. 22) The following is an open source network protocol: a) TCP/ IP b) Microsoft XP c) SNA d) Token ring Answer: (a) 23) computer graphics is the study of how to a) manipulate 2 and 3-dimensional images b) compress photographs c) Render photographs ans: we don't render photographs rendering is the conversion of 3D to 2D graphics compression is certainly part of storing digitized photographs I wouldn't say that computer graphics is the study of compression (a) is your best answer, although there is more to computer graphics than manipulating the images, for example the design of images should be included 24) Finite State Machines are a) more powerful than Turing machines b) more appropriate for analyzing the Halting Problem c) more appropriate for verifying network protocols than Turing Machines