# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

4 Pages

### test3

Course: CS 310, Fall 2009
School: Christopher Newport...
Rating:

Word Count: 376

#### Document Preview

Science Computer 310 Fall 1999 Test 3 Closed book. Closed notes. Name__________ I. Passing parameters (25 points (6/6/6/7) ) Consider the following c program. void q1( int a, int b, int c) { a = a + 1; b = c*2; c = a; } void main() { int x[]={1,2,3,4,5 }; int y = 3; int z = 1; q1( z, x[z], y); for (int i=0; i&lt;4; i++) cout &lt;&lt; x[i] &lt;&lt; &quot; &quot; ; cout &lt;&lt;...

Register Now

#### Unformatted Document Excerpt

Coursehero >> Virginia >> Christopher Newport University >> CS 310

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Science Computer 310 Fall 1999 Test 3 Closed book. Closed notes. Name__________ I. Passing parameters (25 points (6/6/6/7) ) Consider the following c program. void q1( int a, int b, int c) { a = a + 1; b = c*2; c = a; } void main() { int x[]={1,2,3,4,5 }; int y = 3; int z = 1; q1( z, x[z], y); for (int i=0; i<4; i++) cout << x[i] << " " ; cout << y << z << endl; } Show the output produced when the program is executed with each of the following parameter passing techniques: A: Value _______________________________________________________ B: Reference _______________________________________________________ C: Name _______________________________________________________ Explain how binding times explain the difference between passing parameters by reference and passing by name in the example above. II. Multi-dimensional arrays (10 points) Passing multidimensional arrays as parameters demands special attention. Consider the following function prototype. void trythis( int x[10][]); Based solely upon this prototype, would it be more likely that this language stores a 2dimensional array in row-major or column-major order. Why? III. Activation Records (20 (15/5) points) Procedure BIGSUB; Procedure A; Procedure B; Begin {B} . . . End; {B} Procedure C; Begin {C} . . . B; . . . End {C}; Begin {A} . . . C; . . . End {A} Begin { BIGSUB } . . . A; . . . End { BIGSUB } DL SL DL SL DL SL DL SL DL SL Show the stack with all activation record instances, including static (SL) and dynamic chains (DL), when execution reaches the position indicated by the arrow in the skeletal block-structured program. Assume BIGSUB is at the level 1. Explain the difference between the static and dynamic chains. IV. Concurrency (30 points (8/5/5/3/3/3/3) ) A. Give an example of each: physical and logical concurrency B. Define cooperation synchronization. C. Define competition synchronization. D. fork() is a concurrency mechanism available in most languages implemented in Unix. What is the effect of calling fork()? What happens to variables in the program when fork() is called? What happens if a file stream is open when fork() is called? How does a process know whether it is the parent or the child? III. Concurrency Examples (20 points (4/4/4/4/4) ) A. Show the output produced by each of the following examples: #include <> main() { cout << "A"; fork(); cout << "B"; fork(); cout << "C"; } #include <> main() { cout << "A"; if (fork()==0) {cout << "B"; fork(); cout << "C"; } } OUTPUT: OUTPUT: There are many correct answers to the two previous questions! Give a DIFFERENT correct answer for each of these examples. OUTPUT: OUTPUT: Explain why there are multiple correct answers to the examples.
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Christopher Newport University - CS - 310
Computer Science 310 Fall 2000 Test 2Closed book. Closed notes.Name_I. Scope Rules (20 points)Given the following program: program main; var x: integer; procedure sub1; begin {sub1} writeln('x=',x) end; {sub1} procedure sub2; var x: integer; be
Christopher Newport University - CS - 310
Computer Science 310 Fall 1999 Test 2Closed book. Closed notes.Name_I. Scope Rules (20 points)Consider the following c program. void fun(void) { int a,b,c; /* Defn X */ . while(.) { int b,c,d; /* Defn Y */ . while (.) { int c,d,e; /* Defn Z */
Christopher Newport University - CS - 310
Computer Science 310 Fall 2000 Test 3Closed book. Closed notes.Name_I. Lisp/scheme expression evaluation (15 points 2/2/2/3/3/3)Lisp uses a prefix notation for expression evaluation. Evaluate these expressions: Be careful to show a list where a
Christopher Newport University - CS - 310
Computer Science 310 Fall 2000 Test 1Closed book. Closed notes.Name_I. Scope Rules (30 points) Block structured calling rules.Given the following program structure: Complete the following: Program main procedure m begin end; {m} procedure b pr
Christopher Newport University - CS - 310
Computer Science 310 Fall 1999 Test 1Closed book. Closed notes.Name_I. Scope Rules (15 points)Block structured calling rules. Given the following program structure: Program main procedure z procedure f begin . end; {f} procedure e begin . end;
Christopher Newport University - CS - 310
Name_ Computer Science 310 Fall 2003 Test 3Closed book. Closed notes.I. Memory allocation (15 points)Given the following java program from the early weeks of the semester (with a minor modification ): public class BankAccount { public BankAccount
Christopher Newport University - CS - 310
Name_ Computer Science 310 Fall 04 Test 1Closed Book. Closed Notes. I.Java ( 30(35) points 15(5)/15)A. Show the output produced by the following program:OUTPUT(A):public class ComplexNumber { public ComplexNumber () { this(0,0) ; } public Com
Christopher Newport University - CS - 310
Name_ Computer science 310 Test 2 Fall 2003Closed Book. Closed Notes. I. Programming Languages (20 points 2/each)Matching. Write the name of the appropriate language in the blanks indicated C C+ Fortran LISP ALGOL COBOL PL/1 Pascal Prolog Ada Small
Christopher Newport University - CS - 310
Name_ Computer Science 310 Fall 03 Test 1Closed Book. Closed Notes. I.Java ( 30 points 15/15)A. Show the results produced by the following program:public class Question1A { public Question1A () { this(2) ; } public Question1A( int v1 ) { b=v1; a
Christopher Newport University - CS - 310
Computer Science 310 Fall 2000Test 2SolutionsI. With static rules: x=5 With dynamic rules: x=10Visibility of variablesVariabledeclared inasub1ysub1zsub1bsub2xsub3wsub30II.Start Symbol: &lt;S&gt;non-terminals:
Christopher Newport University - CS - 310
Computer Science 310 Fall 2000Test 1SolutionsI.m can call mb can call b c mf can call f z b mmain can call m b zIllegal references to variables:j:=3; CIRCLEj:=3;i:=3; CIRCLEx:=3;i:=3; CIRCLEi:=3; CIRCLE
Christopher Newport University - CS - 310
Intro to Java labVariables and DataNOTE: TO BE DONE ON THE SUN MACHINES IN HUNTER CREECH!This lab will simply show an example very similar to theone in your text. The text example (CH. 2) reads a set of integers, calculates the average and ou
Christopher Newport University - CS - 310
Intro to Java labTEXT IONOTE: TO BE DONE ON THE SUN MACHINES IN HUNTER CREECH!This lab will take you through a few simple activites which willexpose you to the basic structure of a java application . NOTan applet.There are a number of issu
Christopher Newport University - CS - 310
Computer Science 310Fall 2003Test2I. pascalcadasmalltalkfortranlispcobolpl/1algolpl/1II.1/500x10^6 = .2x10^-8 = 2 x 10^-9 = 2 nanosecs1/10^9 = 10^-9 = 1 nanosec1/(2.5 x 10^9) = .4 x 10^9 = .4 nanosecs = 400 picosecs--4 x 1 n
Christopher Newport University - CS - 310
I. What is the most OBVIOUS example of static global memory allocation? Be specific. It might not be so obvious, but the first guess would likely be &quot;a&quot; and/or &quot;b&quot;. The question as to whether &quot;a&quot; and &quot;b&quot; are allocated statically is up to deb
Christopher Newport University - CS - 310
CS310 Test 1 solutionsI. Java Part A. X= 28 11 1 Y= 28 12 2 (note that C is static, one copy for all, once &quot;Y&quot; updates the value for C, X's C (the same one) is also updated). Part B. X= 16 11 1 Y= 17
Christopher Newport University - CS - 310
CS 310 test 1 solutionsI.4(3)+(4)i(4)+(3)i(-4)+(-3)i57Using static:To provide access to methods or properties withouthaving to declare an object.Main()?One can't (doesn't have to) declare an object containingthe main in order to run
Christopher Newport University - CS - 310
Tannenbaum Simulator LabPURPOSE:1. Create some familiarity with running a simulator and specifically to understand some of the peculiarities.2. Provide some specific examples which will illustrate how the registers and memory.3. Provide e
Christopher Newport University - CS - 310
{dgame@sappho:~ } g+ fork.C{dgame@sappho:~ } a.outabcabcabcabc {dgame@sappho:~ } cat fork.C#include &lt;iostream.h&gt;#include &lt;sys/types.h&gt;#include &lt;unistd.h&gt;void main(){ cout &lt; &quot;a&quot; ; fork(); cout &lt; &quot;b&quot; ; fork(); cout &lt; &quot;c&quot;;}{dgame@sa
Christopher Newport University - CS - 310
{dgame@sappho:~ } g+ fork.C{dgame@sappho:~ } a.outabcbccc{dgame@sappho:~ } cat fork.C#include &lt;iostream.h&gt;#include &lt;sys/types.h&gt;#include &lt;unistd.h&gt;void main(){ cout &lt; &quot;a&quot; &lt; endl ; fork(); cout &lt; &quot;b&quot; &lt; endl ; fork(); cout &lt; &quot;c
Christopher Newport University - CS - 446
Active XMicrosofts Answer to Dynamic ContentReference: Using Active X by Brian Farrar QUE pub. @96Static Content1 Client 2 www Internet 2 1 Server1- Browser asks for a page 2- Server returns page and Browser displaysCGIs1 Client 3 www Inter
Christopher Newport University - CS - 446
Linux SecurityAn overview notes from Linux Network Security HowTOBasic Approach Focus on OSI model Most initial probes are service-level attacks enter through a port try to compromise the server use the &quot;server&quot; to gain access to other info a
Christopher Newport University - CS - 336
Christopher Newport University - CS - 335
ProtocolsDefining Interactions VERTICALApplication Presentation Session Transport Network Data Link PhysicalOK Its Done or Sorry I couldnt Please do this for meHorizontal Interactionshttp request Application Presentation Session Transport Netw
Christopher Newport University - CS - 502
LAN PerformanceFrom Stallings text on LANsCSMA/CDWhat is the maximum utilization possible for n nodes?A= P=Probability of ONE node transmitting Probability each node transmittingMaximize A with respect to P n 1 A = P (1 - P) n -1 = n
Christopher Newport University - CS - 502
SocketsA popular API for client-server interactionComplete view of a socketApplication Presentation Session Transport Network Data Link Physical Applications talk to each other via APIs like sockets. Sockets provide the interface to the other lay
Christopher Newport University - CS - 502
Error DETECTION &amp; CORRECTIONDetection in oral communicationNo, UCLA won today Sender No, you see LA won today ReceiverIn verbal communication we use the most likely interpretation and only question when there seem to be ambiguities or inconsiste
Christopher Newport University - CS - 502
EncodingHow is information represented?Way of looking at techniquesData MediumDigitalNRZ Manchester Differential ManchesterAnalogPhase Coded Modulation (digitized voice)DigitalAnalogASK FSK PSKmodemsAM/FM radio TelevisionAnalog
Christopher Newport University - CS - 502
SocketsA popular API for client-server interactionComplete view of a socketApplication Presentation Session Transport Network Data Link Physical Applications talk to each other via APIs like sockets. Sockets provide the interface to the other lay
Christopher Newport University - CS - 502
Computer Science 502Objectives and Main Areas of Coverage Basic Concepts OSI Analysis of Networks Client-serversBasic ConceptsCommunication is fundamentally complicated.transmitter MEDIUM receiverI told you before!I didn't understand.
Christopher Newport University - CS - 502
Internet (IP) AddressesNaming every interface!Naming Naming every interface in the world is not easy Networks evolved from vendors with DIFFERENT naming schemes. Use the same scheme compilers use to solve the one language many processors issue
Christopher Newport University - CS - 502
LAN PerformanceFrom Stallings text on LANsCSMA/CDWhat is the maximum utilization possible for n nodes?Determine Optimal Behavior of Each Node1. Calculate probability of one node transmitting. 2. Optimize that probability with respect to N (it
Christopher Newport University - CS - 502
IP BasicsIPNetwork ARP Link PhysicalICMP RoutingTablesIP Basics IP encapsulates TCP IP packets travel through many different routers (hops) before reaching its destination MTU variation at the physical layer requires IP to fragment the mess
Christopher Newport University - CS - 502
Repeaters and BridgesRelay StationsRepeaters Add delays comparable to BIT times Clean and reamplify the digital signal Do not examine the contents of the message Function at the physical level of OSIOther Layers Other LayersREPEATERphysica
Christopher Newport University - CS - 502
Queueing SystemsThey're EVERYWHERE!Basic ConceptService.RequestRequestRequestDoneNumerous requests made for service Lines back up waiting for service Waiting times increase non-linearlyConsider a perfect system Customers arrive in
Christopher Newport University - CS - 502
LANsMedia Access Control Step 1 in Sharing ResourcesLots of Strategies Ethernet Token Ring Token Bus ATM DSL FDDI Sonet .General Interest Qualitative understanding of the function Comparison/Contrast of a few strategies Design tradeo
Christopher Newport University - CS - 502
Transmission ModesDifferent ways of characterizing the transmissionTiming of the transmission of the data bits0 1 0 1 1 0 1 0 1 1 Serial11010 Data bits transmitted at different times One bit after the other0 1 0 1 1 Parallel Multiple b
Christopher Newport University - CS - 502
ProtocolsBasicsDefining Interactions VERTICALApplication Presentation Session Transport Network Data Link PhysicalOK It's Done or Sorry I couldn't Please do this for meHorizontal Interactionshttp request Application Presentation Session Tran
Christopher Newport University - CS - 502
Transmission ModesDifferent ways of characterizing the transmissionTiming of the transmission of the data bits0 1 0 1 1 0 1 0 1 1 Serial11010 Data bits transmitted at different times One bit after the other0 1 0 1 1 Parallel Multiple b
Christopher Newport University - CS - 502
RoutingGoing from one network to the nextWhere is routing handled? IP serves the functions of routing universal naming Identification is easiest if naming has uniformity Need a function/service to map IP addresses to MAC (e.g. ethernet) addr
Christopher Newport University - CS - 502
Protocol StrategiesIdle RQ (Stop-and-Wait)Transmission Initiated Ack Received Send NextSend NSend N+1 Fig 1.23Message is lostSend NRepeat NSend N+1Fig 1.23Ack is lostSend NRepeat NSend N+1Fig 1.23Message PropagatesFirst
Christopher Newport University - CS - 502
LANsMedia Access Control Step 1 in Sharing ResourcesLots of Strategies Ethernet Token Ring Token Bus ATM DSL FDDI Sonet .General Interest Qualitative understanding of the function Comparison/Contrast of a few strategies Design tradeo
Christopher Newport University - CS - 502
The OSI ModelA layman's view of the internetOSI StructureApplication Presentation Session Transport Network Data Link PhysicalEach layer has a specific function. It relies on the layer below to provide a service.Please do this for meOK It's
Christopher Newport University - CS - 502
ProtocolsDefining Interactions VERTICALApplication Presentation Session Transport Network Data Link PhysicalOK Its Done or Sorry I couldnt Please do this for meHorizontal Interactionshttp request Application Presentation Session Transport Netw
Christopher Newport University - CS - 502
Calculating aFrames on a linka Used as a term in analyzing many network characteristics Has a physical interpretation Represents the number of frames on a link.LinkWorkstation AWorkstation BConnection between workstations/computersMul
Christopher Newport University - CS - 502
Client-Server ApplicationsIndirect Top Level InteractionApplication ApplicationApplication ApplicationApplication ApplicationClient asks server to connectApplication ClientConnect requestApplication ServerConnect requestSocket provide
Christopher Newport University - CS - 502
Cable ModemsFrom a presentation by Donner GrigsbyCPSC 611What are Cable Modems? The cable TV plant dedicates a standard cable TV channel to data transfer for Internet and multimedia services. A computer equipped with a cable modem is then conne
Christopher Newport University - CS - 446
Firewalls and Info Services Prevent unathorized access between nets Most of the protection is based upon examination of the IP packets There is always a tradeoff between security and ease of usePROTECToutside and outside inside insidePrimary
Christopher Newport University - CS - 446
EncryptionAn OverviewFundamental problems Internet traffic goes through many networks and routers Many of those networks are broadcast media Sniffing allows for many to see transmissions Tamper/alter transmission Spoof identitiesSecurity I
Christopher Newport University - CS - 446
Microsoft COMComponent Object ModelMicrosoft CorporationTMWhat is COM? Build software from parts, not from scratch A framework for creating and using componentsMakes software easier to write and reuse Provides widest choice in services, t
Christopher Newport University - CS - 446
TCP/IP BasicsA review for firewall configurationConfiguring a firewall Primary approach to configuring a firewall Study service IP ADDRESSES PORTS Set up rules for allowing or denying access to the services you want utilized. Problem: Some
Christopher Newport University - CS - 446
IP MasqueradingHomes and Businesses:When you only have one IP but you have LOTS of machinesThe problem Extra IPs are an additional cost of you internet service. Masquerading lets you hook up multiple machines to the same IP Some companies wan
Christopher Newport University - CS - 446
SambaIntegrating SMB file systems with UNIXSamba Provides a file server compatible with Windows 9x and NT . SMB Can function in NETBIOS name browsing as seen in network neighborhood Provides for authentication of users Provides an NT domain se
Christopher Newport University - CS - 446
inetd.Server of Servers Looks at a number of ports Determines when a service is needed on any of those ports Calls the appropriate server Restarts new server for each client ( nowait ) when the previous server dies (wait ) Interacts with sysl
Christopher Newport University - CS - 446
#E#1#5#P#(#(#y#[# # # # # # # # # # # # # # # #N# #p# # #P# # ## # # # # # # # # # # # # # # # # ## # # f~c# # # # ? # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # #
Christopher Newport University - CS - 446
#E#1#P#(#(#y#[# #V# #r# #5# # # # #uar fea red lesers chi# #ef##_ # # # # ## # ## # # ## # # # ## # # ## # # # # # # ## # ## # # # ## # ## # # #K#DY # # # ## ## # ## # # # # ## # ### # ## # ## # # d# # # # # # j#i i# }#@#s.#(#j#S#&amp;#g\$#\$#@#\$#\$#`#\$#&amp;
Christopher Newport University - CS - 446
Linux Security ConfigurationTCP WrappersAt the machine levelCheck Request ServerWhat checks the request? External Firewalls (not here) Hosts Allow/Deny Individual servers Firewall software ipchains iptables shorewall(X)inetd based req
Christopher Newport University - CS - 446
SyslogdTracking system eventsLog servers Applications are constantly encountering events which should be recorded users attempt to login with bad passwords servers cant properly start disk runs out of space and others Many system servers ar
Christopher Newport University - CS - 446
Scaling Service RequestsLinux: ipvsadm &amp; iptoipInitiallyOutside Client Gateway Outside Client137.155.37.33Inside Server137.155.37.34At this stage the server is able to keep up with client requests at a satisfactory level! No masquerading as
Christopher Newport University - CS - 446
KerberosAuthenticating Over an Insecure NetworkInitial requestAuthentication Server (only real user can decode) user to service User key Session key Service nameuserService key Session key User nameserviceKerberos Server User and Server D
Christopher Newport University - CS - 446
An Overview of ActiveXCharlie Kindel Architect &amp; Chief Technical Advisor Microsoft Developer Relations GroupOutline WhatisActiveX? TheComponentObjectModel CurrentStatusWhat is ActiveX? Amarketingnameforasetof technologiesandservices,allbased