10 Pages

mse-2007

Course: COMP 2300, Fall 2009
School: Allan Hancock College
Rating:
 
 
 
 
 

Word Count: 986

Document Preview

AUSTRALIAN THE NATIONAL UNIVERSITY Mid Semester Examination, April 2007 COMP2300 (Introduction to Computer Systems ) Writing Period: 1 hour duration Study Period: 0 minutes duration Permitted Materials: One A4 page with notes on both sides. NO calculator permitted. Questions are NOT equally weighted. This exam will contribute 20% to your nal assessment. The questions are followed by labelled, framed blank panels...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> Allan Hancock College >> COMP 2300

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.
AUSTRALIAN THE NATIONAL UNIVERSITY Mid Semester Examination, April 2007 COMP2300 (Introduction to Computer Systems ) Writing Period: 1 hour duration Study Period: 0 minutes duration Permitted Materials: One A4 page with notes on both sides. NO calculator permitted. Questions are NOT equally weighted. This exam will contribute 20% to your nal assessment. The questions are followed by labelled, framed blank panels into which your answers are to be written. Additional answer panels are provided (at the end of the paper) should you wish to use more space for an answer than is provided in the associated labelled panels. If you use an additional panel, be sure to indicate clearly the question and part to which it refers to. The marking scheme will put a high value on clarity so, as a general guide, it is better to give fewer answers in a clear manner than to outline a greater number in a sketchy, half-answered fashion. The Appendix contains information on the PeANUt instruction set, as well as a table with powers of 2 values in decimal. Please write clearly if we cannot read your writing you may lose marks! Name (family name rst): Student Number: Ofcial use only: Q1 (13) Q2 (17) Total (30) COMP2300 Mid Semester Exam, April 2007 Page 1 of 10 QUESTION 1 [13 marks] (a) Assume memory addresses 0x02000411 to 0x02000415 contain the following 8-bit binary values: Address 0x02000411 0x02000412 0x02000413 0x02000414 0x02000415 Binary value 00100010 10001101 11001000 01100011 00110000 Assume sizeof(x) = 2 and sizeof(y) = 2, &x = 0x02000412 and &y = 0x02000414, and the data storage is big endian. (i) What would be printed by the following C statement? printf("Values for x+y: %x %o", x+y, x+y); Clearly show how you derive your answers. QUESTION 1(a)[i] [2 marks] (ii) What would be printed by the following C statement? printf("Values for x+y: %d %u", x+y, x+y); Clearly show how you derive your answers. QUESTION 1(a)[ii] [2 marks] COMP2300 Mid Semester Exam, April 2007 Page 2 of 10 Question 1 (continued) Student Number: ................................ (b) The IEEE single-precision oating-point standard is: 1 bit sign, 8 bits exponent with a bias of 127, and the remaining 23 bits are the mantissa (with an implicit leading bit). To four decimal digits, what oating point number is represented by the following 32-bit number (given in hexadecimal representation): 0xC1B80000 QUESTION 1(b) [2 marks] (c) Consider the following C code: char c1 =0; unsigned char c2 =0; while (1) { c1 ++; c2 ++; } Describe the patterns of values of c1 and c2 9in decimal) that would be generated by the iterations of the loop, as it endlessly executes. QUESTION 1(c) [1 mark] COMP2300 Mid Semester Exam, April 2007 Page 3 of 10 Question 1 (continued) (d) Name two limitations of oating point arithmetic that might adversely affect the accuracy of any numerical calculations carried out with it. What is the underlying reason that is common to both these limitations and the phenomenon associated with the integer arithmetic illustrated in Question 1(c)? QUESTION 1(d) [2 marks] (e) Briey describe the functions of the main components of the Central Processing Unit (CPU) of a typical computer. QUESTION 1(e) [2 marks] (f) State Moores Law. Briey describe its impact on computer technology over the last 50 years. QUESTION 1(f) [2 marks] COMP2300 Mid Semester Exam, April 2007 Page 4 of 10 Student Number: QUESTION ................................ 2 [17 marks] (a) The following program manipulates character strings from the standard C library. # include < stdio .h > # include < string.h > int main (){ char str1 [100] = " computer "; char str2 [100] = " systems"; char * str3 ; str3 = strcat( str1 , str2 ); printf(" str1 ( length =%2 d) is : %s\n" , strlen( str1 ), str1 ); printf(" str2 ( length =%2 d) is : %s\n" , strlen( str2 ), str2 ); printf(" str3 ( length =%2 d) is : %s\n" , strlen( str3 ), str3 ); return 0; } Relevant details of strlen() and strcat() functions are: int strlen( const char *s ); // returns the length of the string s , // not including the terminating \0 character char * strcat( char * dest , const char * src ); // appends the src string to the dest string , overwriting the // \0 character at the end of dest , and then adds a // terminating \0 character . It returns the value of dest (i) Write the output that the program would generate when it is compiled and run. QUESTION 2(a)[i] [2 marks] COMP2300 Mid Semester Exam, April 2007 Page 5 of 10 Question 2 (continued) (ii) Write an implementation of the function strcat() as dened above. Your code must not call any other function except strlen(). QUESTION 2(a)[ii] [6 marks] (b) A C program myprogram.c has its main program function declared as int main (int argc, char *argv[]);. (i) Describe in words the meaning of the declaration char *argv[]. QUESTION 2(b)[i] [1 mark] (ii) State the signicance of the declaration, in the context when myprogram.c is compiled into an executable program, i.e. with gcc -Wall -o myprogram myprogram.c. QUESTION 2(b)[ii] [2 marks] COMP2300 Mid Semester Exam, April 2007 Page 6 of 10 Question 2 (continued) Student Number: ................................ (c) Briey state the purpose of a function prototype (header) and explain how these can support separate compilation of libraries. QUESTION 2(c) [2 marks] (d) In C, function parameters are passed by value. Explain, in ...

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:

Allan Hancock College - COMP - 2300
PeANUt Module Overviewq a simple microprocessor simulator for teaching purposes q main topics: s s s sPeANUt architecture, machine language and assembler programming branches and conditions, loops, input/output, traps, macros procedures and functi
Allan Hancock College - COMP - 2300
Operating System Issuesq ref: [Tanembaum, sect 1.2, (6.1) &amp; 6.4] [OH&amp;Bryant, sect 8.2] q operating system (O/S) functions q a brief history of operating systems q key concepts: s process management x scheduling, process state, multiprocessing s sto
Allan Hancock College - COMP - 2300
Operating System IssuesA Brief History of Operating Systems (1)q Zeroth Generation (1940's) s no real O/S: users hand-coded all functions in machine language s programs loaded via a bootstrap program s I/O facilitated by subroutine libraries q Fir
Allan Hancock College - COMP - 2300
Welcome to COMP2300 Introduction to Computer SystemsCourse Scheduleq lectures: three one hour lectures per week, ve modules: s s s s s sDigital building blocks (4) C language (4) PeANUt or Assembly Level Machine Organisation (9) Memory Systems a
Allan Hancock College - COMP - 2300
Course Review and Exam Discussionq review Q4(a) from 2006 exam (maybe a few others) q nal examination: s details s topics q review of major underlying themes q outlook for computer systems q other issues: s 14:0014:15: CEDAM Surveys x please take an
Allan Hancock College - COMP - 2300
Allan Hancock College - COMP - 2300
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY First Semester Examination June 2000 COMP2300 Introduction to Computer Systems ENGN2213 Computer Organisation Study Period: 15 minutes Time Allowed: 3 hours Permitted Materials: One A4 page with notes on both sides
Allan Hancock College - COMP - 2300
PeANUt Assembly Language: a Better Way to Initialize the PeANUtq ref: [PeANUt Spec, sect 4] q today: s s s smotivation addressing modes revisited assembly language format translating C into PeANUtq over next 4 lectures: s a second pass of PeANUt
Allan Hancock College - COMP - 2300
15-213The course that gives CMU its Zip!Machine-Level Programming I: Introduction Sept. 10, 2002TopicsAssembly Programmers Execution Model Accessing Information Registers Memoryclass05.pptArithmetic operationsIA32 ProcessorsTotally
Allan Hancock College - COMP - 2300
15-213&quot;The course that gives CMU its Zip!&quot;Machine-Level Programming V: Miscellaneous Topics Sept. 24, 2002Topics Linux Memory Layout Understanding Pointers Buffer Overflow Floating Point Code1class09.ppt15-213, F'02FFLinux Memory L
Allan Hancock College - COMP - 2300
From Physical Memory To Virtual Memory: Understanding the Memory HierarchyAlistair RendellComputer Systems: A Programmers Perspective Randal E Bryant and David OHallaron Structured Computer Organization Andrew Tanenbaum1Memory Chips: SRAM Rem
Allan Hancock College - COMP - 2300
Operating Systems: Memory ManagementAlistair Rendell(minor updates by Peter Strazdins)Computer Systems: A Programmers Perspective Randal E Bryant and David O'Hallaron Structured Computer Organization Andrew Tanenbaum1Memory Management: Objec
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 6More PeANUt assembly language Loops in assembly code Arrays in assembly Evaluating complex expressions Reference: Specification of the PeANUt computer (Section 4) Additional reading: Section 3.8 i
Allan Hancock College - COMP - 2300
Module N: NetworksLecture 1Computing systems and communications Introduction Computer-Communication revolution Communications model Communications tasks Communications architecture Reference: Data and computer communications, William Stall
Allan Hancock College - COMP - 2300
Instruction Set Architecture and the SPARC: Referencesq iwaki.anu.edu.au: an UltraSPARC IIICu system s system configuration info from the commands prtconf and fpversion q Structured Computer Organization, Andrew S. Tanenbaum, Edition 3 q SPARC Arch
Allan Hancock College - COMP - 2300
Background: why use computer simulation?q or, why not just run and time the application on the computer itself? q advantages of simulating applications: s can have full visibility: actual H/W may not count all events of interest s the simulated comp
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 8Procedure calls and address parameters in PeANUt Procedure calls With local variables With return values (non-void functions) Address parameters Ability to modify data Indirect memory reference vi
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 5PeANUt assembly language Motivation Addressing modes revisited Assembly language format Translating C into PeANUt Reference: Specication of the PeANUt computer (Section 4)1COMP2300, 2006Asse
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 3Home work and unsupervised lab this week Home work 2 is now online on COMP2300 Web site Part 1 on paper (estimated one hour work) Part 2 in labs (normal lab times, but no tutor available) (experiment
Allan Hancock College - COMP - 2300
Operating System ConceptsLecture 1Operating system issues Operating system (O/S) functions A brief history of operating systems Processes and Process Management References: Tanenbaum, chapters 1.2, (6.1) and 6.4 Specification of the PeANUt
Allan Hancock College - COMP - 2300
Module N: NetworksLecture 2Network Routing and the Internet Network switching Network routing Local area networks (LANs) Inter-networking Redundancy Internet protocols and addressing References: Bryant and O'Hallaron, Sect 12.1 12.3 (Da
Allan Hancock College - COMP - 2300
Module 1: Digital Building BlocksLecture 4Computer History 1642: Pascal built add/subtract machine 1672: Leibniz built add/sub/mul/div machine 1822: Babbage built a difference machine with punch card output. Later he designs a general purpose
Allan Hancock College - COMP - 2300
COMP2300 Encoding and TransmissionFrom Computer Organization and Architecture, Linda Null and Julia Lobur, ISBN 0 7637 0444 XCodes for Data Transmission and Recording Digital switches, such as memories, are either on or off with nothing in betwee
Allan Hancock College - C - 2300
#include &lt;stdio.h&gt;#include &lt;string.h&gt;int main(){ char fname[]=&quot;KKKKKKKKKKKKKKKKKKKK&quot;; char sname[]=&quot;LLLLLLLLLLLLLLLLLLLL&quot;; char fullname[40]; int i=-1,j=-1; printf(&quot;Enter your Full Name\n&quot;); do {i+; scanf(&quot;%c&quot;,&amp;fname[i]); }wh
Allan Hancock College - COMP - 2300
#include &lt;stdio.h&gt;#include &lt;string.h&gt;int main(){ char fname[]=&quot;KKKKKKKKKKKKKKKKKKKK&quot;; char sname[]=&quot;LLLLLLLLLLLLLLLLLLLL&quot;; char fullname[40]; int i=-1,j=-1; printf(&quot;Enter your Full Name\n&quot;); do {i+; scanf(&quot;%c&quot;,&amp;fname[i]); }wh
East Los Angeles College - GEOG - 5071
Geog5071M GIS and Urban Planning Unit 6 PracticalGIS and Education1 Background and InformationThe practical task associated with this unit will consider the provision of secondary schools in Leeds relative to the geographies of demand for these ed
Allan Hancock College - C - 2300
#include&lt;stdio.h&gt;int main(void) { int array1[]={1,2,3,4}; int array2[]={-1,-2,-3,-4}; int i; printf(&quot;\nInitial Values of Array1 and Array2\n&quot;); for(i=0; i&lt;4; i+){ printf(&quot;Element %d Array1 = %4d Array2 = %4d\n&quot;, i,array1[i], array2
Allan Hancock College - COMP - 2300
#include&lt;stdio.h&gt;int main(void) { int array1[]={1,2,3,4}; int array2[]={-1,-2,-3,-4}; int i; printf(&quot;\nInitial Values of Array1 and Array2\n&quot;); for(i=0; i&lt;4; i+){ printf(&quot;Element %d Array1 = %4d Array2 = %4d\n&quot;, i,array1[i], array2
Allan Hancock College - C - 2300
#include &lt;stdio.h&gt;int next_year(int y);int main(void) { int a,b; a=1981; b=next_year(a); if (b=1982) { printf(&quot;1982\n&quot;); } else { printf(&quot;Help!\n&quot;); } printf(&quot;Fin
Allan Hancock College - COMP - 2300
#include &lt;stdio.h&gt;int next_year(int y);int main(void) { int a,b; a=1981; b=next_year(a); if (b=1982) { printf(&quot;1982\n&quot;); } else { printf(&quot;Help!\n&quot;); } printf(&quot;Fin
Allan Hancock College - COMP - 2300
COMP2300 2007 MSE Q2(a)(ii) givenint strlen(const char *s);/ returns the length of the string s,/ not including the terminating '\0' characterchar *strcat(char *dest , const char *src);/ appends the src string to the dest string , overwritin
East Los Angeles College - GEOG - 5071
Geog5071M GIS and Urban Planning Unit 6 PracticalGIS and Education1 Background and InformationThe practical task associated with this unit will consider the provision of secondary schools in Leeds relative to the geographies of demand for these ed
Allan Hancock College - COMP - 2300
/* Rename this file as: prog.c */#include &lt;stdio.h&gt;#include &quot;factorial.h&quot;int main(void){ int n,fact; printf(&quot; Input factorial\n&quot;); scanf(&quot;%d&quot;,&amp;n); fact = factorial(n); printf(&quot;Factorial %d = %d\n&quot;,n,fact); return 0;}
East Los Angeles College - GEOG - 5025
GEOG5021M: Using Databases and GIS Unit 2 PracticalUsing Access: Database Creation, Query Construction and Reporting IntroductionThe practical is in three parts. The first part gets you started with Microsoft Access by requiring you to build your o
Allan Hancock College - COMP - 2300
COMP2300 - TuteLab 09http:/cs.anu.edu.au/student/comp2300/labs/TuteLab09.htmlCOMP2300 Laboratory 09 Caches, SPARC Assembly and Linking and LoadingSemester 1, 2007 Week 11 (14 - 20 May)As well as the Preparation Exercises for this class, you ar
Allan Hancock College - COMP - 2300
Evolution of the ComputerComputer Technologyq First Generation (1945 1955): vacuum tubes and electromagnetic relaysq Refs: [OH&amp;Bryant, ch 1,3.1]; TextRefNull&amp;Loburch 1; [Tanembaum, Ch 1,2];related web linksq Second Generation (1955 1965): t
Allan Hancock College - COMP - 2300
Procedures and Functions in PeANUtq number systems (bases) in .mli les q procedure / function calls q nested procedures q the stack: s stack pointer register s stack addressing mode s the stack frame q ref: [PeANUt Spec, ]; additional reading: [OH&amp;
Allan Hancock College - COMP - 2300
15-213&quot;The course that gives CMU its Zip!&quot;Machine-Level Programming I: Introduction Sept. 10, 2002Topics Assembly Programmer's Execution Model Accessing Information Registers M emoryclass05.pptArithmetic operationsIA32 ProcessorsTota
Allan Hancock College - COMP - 2300
From Physical Memory To Virtual Memory: Understanding the Memory Hierarchyq ref: [O'H&amp;Bryant, sect 6.16.4] or [Null&amp;Lobur, sect 6.26.4];additionally [O'H&amp;Bryant, sect 6.56.7]q recall the memory hierarchy q (main) memory: types, organization of ch
Allan Hancock College - COMP - 2300
Instruction Set Architecture and the SPARC: Referencesq [OH&amp;Bryant, sect 4.4, 5.7]; [Null&amp;Lobur, sects 4.14, 5.6, 9.2, 9.4.1] q two representative CISC designs q iwaki.anu.edu.au: an UltraSPARC IIICu system s system conguration info from the command
Allan Hancock College - COMP - 2300
COMP2300 - TuteLab 06http:/cs.anu.edu.au/student/comp2300/labs/TuteLab06.htmlCOMP2300 Tutorial / Laboratory 06 - PeANUt AssemblerSemester 1, 2007 Week 7 (2 - 6 April)Draft! In particular the unexpected problem of assembler/join commands ceasing
East Los Angeles College - GEOG - 5025
GEOG5021M: Using Databases and GIS Unit 2 PracticalUsing Access: Database Creation, Query Construction and Reporting IntroductionThe practical is in three parts. The first part gets you started with Microsoft Access by requiring you to build your o
Allan Hancock College - C - 2300
#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; /*for alloc(), free()*/int main(void) { int i, n, *A, si; scanf(&quot;%d&quot;, &amp;n); A = (int *) malloc(n * sizeof(int); / allocates n elements for (i=0; i&lt;n; i+) A[i] = i
Allan Hancock College - COMP - 2300
#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; /*for alloc(), free()*/int main(void) { int i, n, *A, si; scanf(&quot;%d&quot;, &amp;n); A = (int *) malloc(n * sizeof(int); / allocates n elements for (i=0; i&lt;n; i+) A[i] = i
East Los Angeles College - GEOG - 5041
Geog5041M Advanced Proprietary GIS Unit 2 NotesArcCatalogThe aims of this unit are to introduce you to: file types ArcCatalogOn completion of this unit you should: understand file types have a basic understanding of how ArcCatalog works.C
East Los Angeles College - GEOG - 5835
GEOG5835 Quantitative Data AnalysisSolo Exercises for Unit 3: Statistical TestingComplete all of the following solo exercises (D-H), collecting all of your answers together in a single word document. You will submit this as a single portfolio at t
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY First Semester Examination June 2004 COMP2300 Introduction to Computer Systems Study Period: 15 minutes Time Allowed: 3 hours Permitted Materials: One A4 page with notes on both sides. NO calculator permitted. Ques
Allan Hancock College - COMP - 2300
Procedure Calls and Address Parameters in PeANUtProcedure Calls: Key Ideasq ref: [PeANUt Spec, sect 4] q procedure calls s with local variables s with return values (non-void functions) q address parameters s ability to modify data s indirect mem
Allan Hancock College - COMP - 2300
D1: Digital Building BlocksLecture 1Number systems Decimal Octal Hexadecimal Binary Negative numbers Twos complement Overow Sign extension References: Section 2.1 to 2.3 in Bryant and OHallaron Appendix A in Tanenbaum Related links o
East Los Angeles College - GEOG - 5075
Geog5075/M Spatial Analysis with GIS Unit 6 PracticalStepwise Linear Regression and the Geographical Analysis MachineThe first section of this practical provides you with instructions on how to run stepwise linear regression in SPSS. The second par
Allan Hancock College - COMP - 2300
Pointers, Arrays and StructuresPointers as Parametersq passing a pointer as a parameter to a function allows the function to change thevariable the pointer refers toq pointers: example, as parameters q dynamically allocated arrays q command li
East Los Angeles College - GEOG - 5041
Geog5041M Advanced Proprietary GIS Unit 3 PracticalArcMap IntroductionThis practical is designed to give you some practical experience in using ArcMap and to gain familiarity with some of the routine procedures and commands for managing and display
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY First Semester Examination, June 2008 COMP2300 / COMP6300 (Introduction to Computer Systems) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4 page with notes on both sid
East Los Angeles College - GEOG - 5041
Geog5041M Advanced Proprietary GIS Unit 2 NotesArcCatalogThe aims of this unit are to introduce you to: file types ArcCatalogOn completion of this unit you should: understand file types have a basic understanding of how ArcCatalog works.C
Allan Hancock College - COMP - 2300
Bit Operations and Traps in PeANUtq ref: [PeANUt Spec, sect 2.8.3 and Appendix B] q bitwise operations q traps: s concepts s in PeANUt; x predefined and user-definable s trap handler and trap table q debugging q other issues: s s s s s sMinute Pape
Allan Hancock College - COMP - 2300
Procedures and Functions in PeANUtq number systems (bases) in .mli files q procedure / function calls q nested procedures q the stack: s stack pointer register s stack addressing mode s the stack frame q ref: [PeANUt Spec, ]; additional reading: [O'
Allan Hancock College - COMP - 2300
/* %ANU_GPL_License% *//* $Id: load_elf.cc,v 1.4 2004/11/30 02:06:26 wpc Exp $ * * loading of elf files in &quot;boot from main&quot; mode */lib 20020225 */#include &lt;fcntl.h&gt;/ for mode macros (open)#include &quot;sulima/elf_wrapper.hh&quot;#include &quot;
Allan Hancock College - TDM - 110
Eur. Phys. J. B 58, 207220 (2007) DOI: 10.1140/epjb/e2007-00216-2THE EUROPEAN PHYSICAL JOURNAL BMulti-scale correlations in dierent futures marketsM. Bartolozzi1,2,a , C. Mellen1 , T. Di Matteo3 , and T. Aste31 2 3Research Group, Grinham Mana
Allan Hancock College - JXM - 107
Charles Darwin University Performance and Development Review System Manual November 2005ContentsBackground. 4 Introduction.. 5 Purpose of the PDRS. 5 Participants in the PDRS.. 7 Performance and Development Review System Overview.7 Phase One: Perf
Allan Hancock College - INFS - 8005