EE472 Mid Term SOLUTION KEY. Rules. Prof. Blake Hannaford Department of Electrical Engineering The University of Washington 31-Oct-2005 NAME
|
|
- Vanessa Moody
- 5 years ago
- Views:
Transcription
1 EE472 Mid Term SOLUTION KEY Prof. Blake Hannaford Department of Electrical Engineering The University of Washington 31-Oct-2005 NAME Rules Individual Work Closed Book, Closed Notes, No Calculators 1-page 1-sided cheat sheet may be used. 1 hour and 10 minutes 60 points DO ANY 4 PROBLEMS No partial credit will be given for work on a 5th problem. 1
2 1 C Programming (15 pts) pts Write a C function to use bitwise logical operators to find out whether or not an unsigned int, x, isa power of two. In other words, if x == 2 n return 1, else return 0. Where n is an integer: 0 n 15. Solution Attached pts Extend your C function to use bitwise logical operators to find out whether or not an int (two s complement representation) is a positive OR negative power of two. In other words, if x == ±2 n return 1, else return 0. Where n is an integer: 0 n 15. Solution This problem relies on understanding of two s-complement representation of negative integers. Attached. 2
3 2 Logical Operators in C (15 pts) Evaluate the following C expressions: #define A #define B #define C 0x33 0x20 0xB7 unsigned char a,b,c,d,e; a = (A B) & C; b = ~(A & B); c = A^C; d = B<<3; e = C B ~A; Give answers in binary: Solution Attached. 3
4 3 Pointers (15 pts) (Similar to questions in a Microsoft job interview!) For the following declarations and statements, // declarations int i,j,k[10]=2,4,6,8,10,12,14,16,18,20; int *ip; char a,b,c[10]=11,12,13,14,15,16,17,18,19,20; char *cp; void *vp; typedef struct stst int i; char *p; st; // assignment statements st x; ip = &k[4]; vp = ip; cp = &c[0]; x.p = cp+3; x.i = 27; Evaluate the following expressions (if the expression is an error, indicate that with X ): Solution *(ip+2) + c[3] ; (*cp +1); *(ip) + 6; 16 vp = &x ; ((st*)vp)->p; *(ip-2) ; X (p is still a pointer, need another deref) 6 4
5 4 Schedulers (15 pts.) Consider a Pre-emptive, Priority Based Scheduler. Diagram the schedule for the following three tasks: A: (Priority 2) int i = 0; while(1) i++; compute(0.2333ms); if(i==3) OS_start(Task_C); OS_IO(device, buffer); B: (Priority 3) while(1) compute(0.2333ms); yield(); C: (Priority 1) while(1) compute(0.6566ms); OS_delay(3); The scheduler is pre-emptive and priority-based. Whenever it runs, this scheduler starts the highest priority task whos status is READY. A clock interrupt starts the scheduler every 1.0ms. Assume the scheduler always takes 0.1ms to operate. Priorities use low numbers for high priority (like golf). All tasks are initially READY, except task C which is INACTIVE. A function yield() is available which immediately starts the scheduler. Each task may call a function void OS_IO(int device, char *buffer ) which requests the OS to perform I/O on a certain device. All I/O requests take ms. Calling OS IO immediately sets the current task status to WAIT and calls the scheduler. A task may call a function void OS_start(Task *task) where *task is a pointer to a task struct. This function changes the state of task from INACTIVE to READY and starts the scheduler immediately. Completion of I/O delay does NOT invoke the scheduler immediately, but the task status becomes READY. Each task may call a function void OS delay(unsigned int n) which causes its status to be set to WAIT until n clock interrupts have occured. The scheduler starts immediately when this function is called. 5
6 Solution: 6
7 5 Real Time Systems (15 pts) Consider the following problem statement and then answer the questions below. This is deliberately an open-ended question. There may be more than one right answer. Select answers to these questions which illustrate that you understand how to match concepts we have covered in EE472 to the task requirements. Assume a processor with about the same capabilities as the 80188/TERN board in the lab. A photocopier controller must have the following functions: 1. To make a single copy, it must generate timing signals (pulses) to all the paper handling hardware so that a sheet of paper goes all the way through the machine, flash the copying light, etc. These pulses range from 10ms to 500ms in length and must have an accuracy of ±50μsec. The entire copy cycle takes 2.0 seconds. 2. It must update the LCD display on the control panel at least three times per second. Humans will notice any timing errors greater than 10ms. 3. It must scan the buttons on the control panel at least 100 times per second (to eliminate multiple signals due to button bounce ). (This only takes 100μsec. each time) 4. If copying is complete and no buttons are pressed for 20 seconds, a task must clear all settings and reset the zoom lens. This takes 2.0 seconds. 5. When the user pressess the big green button, it must initiate N copy cycles, where N is the number entered by the user using control panel buttons. 6. Each hour it must send the number of copies made over a serial port to a supervisory computer. 7. A sensor signal can give a measure of copy quality if it is Fourier transformed and certain frequency bands are examined. At least once per day, this analysis should be completed and if quality is low, a signal should be sent to the maintenance service. With no other tasks running, this task would take 20 seconds on the machines microcontroller pts What type of scheduler would you use? Explain how your answer meets the task requirements. Solution: These tasks could probably be accomplished with several scheduler types. The timing requirements of the copier timing signals are quite strict (50μsec). This suggests that we need synchronization and priorities so that this task always gets the CPU when needed. The last task (quality measurement) is an ideal background task because it needs CPU time but has a very long deadline (24 hrs). The Fourier Transform is a complex calculation and it would be very nice if we don t have to figure out how to put a lot of scheduler yield() functions in it. This strongly suggests we need a preemptive scheduler. 7
8 5.2 8pts List the tasks you would design as parts of the real-time software system. For each task, give its type (either Periodic, Complex, Intermittent, or Background); list its inputs and outputs; if applicable, its period, P, and deadline, D. If it is not specified in the functional description, assume that each task will take 500μsec per cycle. Solution: Task Type Inputs/Outputs P C D CopyCycle Periodic timing/pulses 1ms 10μ?? 50μ LCD Periodic data/lcd 333ms.500ms 10ms Bscan Periodic keypad/data 10ms 100μ 5ms? Reset Complex Timer/lens Copy Complex Green Button / start CopyCycle Report Periodic Timer 1hr.500ms 1min? QCtl Background Timer 24hr 20sec. 1hr? Notes: C was not specified for the CopyCycle task but it clearly cannot be 500μsec because of the 50μsec requirement. From experience with the TERN boards, we know that it only takes a couple of μsec to set or clear a pulse, so with proper coding this task might take as little as 10μsec each time. Also, we have to add the constraint that pulses must be an integral multiple of 1ms because otherwise we need a 50μsec scheduler cycle which is beyond the capacity of our 40Mhz chip. There is some guesswork here on Deadlines, not all of them are clear from the requirements. 8
9 Solution to Problems 1-3 EE 472 University of Washington * Midterm Exam 31-Oct-2005 * Solutions to programming problems void prob1_1(); void prob1_2(); void prob1_2a(); void prob2(); void prob3(); void bin_display(unsigned int x); main() printf("ee 472 A2005\n MIDTERM SOLUTIONS\n\n"); prob1_1(); prob1_2(); prob1_2a(); prob2(); prob3(); void prob1_1() * a positive number is a power of 2 if just one bit is set. * int j; unsigned int x[3] = 2, 7, 16; printf("\nproblem 1.1\n"); for (j=0;j<3;j++) if(power2(x[j])) printf("%d is a power of two\n",x[j]); else printf("%d is NOT a power of two\n",x[j]); #define TRUE 1 #define FALSE 0 #define SIGN_BIT 0x8000 // bit 15 int power2(unsigned int x) unsigned int j, mask, bitcount; mask = 1; bitcount = 0; while(mask) // check all bits if(x & mask) bitcount++; mask = mask << 1; if(bitcount == 1) return(true); return(false); 9
10 void prob1_2() int j; #define NUM_TESTS 6 int x[num_tests] = -2, -7, -16, 13, 128, -256; printf("\nproblem 1.2\n"); for (j=0;j<num_tests;j++) if(power22(x[j])) printf("%d is a power of two\n",x[j]); else printf("%d is NOT a power of two\n",x[j]); int power22(int x) * a positive number is a power of 2 if just one bit is set. * * a negative number is a power of 2 if all bits with position * >= n are 1 and positions <n are 0. Example: * -64 = int j,mask,bitcount; int bit1_0 = 0, bit0_1 = 0, prev_bit=0; if(!(x & SIGN_BIT)) // positive numbers printf("%d is positive\n",x); mask = 1; bitcount = 0; while(!(mask & SIGN_BIT)) // don t check the sign bit if(x & mask) bitcount++; mask = mask << 1; if(bitcount ==1) return(true); else // negative numbers printf("%d is negative\n",x); mask = 1; bitcount = 0; prev_bit = 0; for(j=0;j<16;j++) // don t check the sign bit if(!(x & mask) && prev_bit!= 0) bit0_1++; if( (x & mask) && prev_bit == 0) bit1_0++; prev_bit = x & mask; mask = mask << 1; if(bit1_0 == 1 && bit0_1 == 0) return(true); return(false); void prob1_2a() * a positive number is a power of 2 if just one bit is set. * int j; 10
11 #define NUM_TESTS 6 int x[num_tests] = -2, -7, -16, 13, 128, -256; printf("\nproblem 1.2a (alternate solution to 1.2)\n"); for (j=0;j<num_tests;j++) if(power22a(x[j])) printf("%d is a power of two\n",x[j]); else printf("%d is NOT a power of two\n",x[j]); int power22a(int x) * a positive number is a power of 2 if just one bit is set. * * a negative number is a power of 2 if all bits with position * >= n are 1 and positions <n are 0. Example: * -64 = int j,mask,bitcount; int bit1_0 = 0, bit0_1 = 0, prev_bit=0; * This method is easier and OK if((x & SIGN_BIT)) x = ~x + 1 ; // better than x *= -1 because it s bitwise! printf("+-%d is either positive or negative\n",x); mask = 1; bitcount = 0; while(!(mask & SIGN_BIT)) // don t check the sign bit if(x & mask) bitcount++; mask = mask << 1; if(bitcount ==1) return(true); else return(false); * Problem 2 void prob2() #define A 0x33 #define B 0x20 #define C 0xB7 unsigned char a,b,c,d,e; printf("\nproblem 2\n"); a = (A B) & C; b = ~(A & B); c = A^C; d = B<<3; e = C B ~A; printf ("\n a = Ox%x = ",a); bin_display(a); 11
12 printf ("\n b = Ox%x = ",b); bin_display(b); printf ("\n c = Ox%x = ",c); bin_display(c); printf ("\n d = Ox%x = ",d); bin_display(d); printf ("\n e = Ox%x = ",e); bin_display(e); printf("\n"); * bin_display * * Display the individual bits of an integer void bin_display(unsigned int x) unsigned int i,j; for(i=0;i<16;i++) j = 1<<(15-i); if(j & x) printf("1"); else printf("0"); * Problem 3 - pointers void prob3() // declarations int i,j,k[10]=2,4,6,8,10,12,14,16,18,20; int *ip; char a,b,c[10]=11,12,13,14,15,16,17,18,19,20; char *cp; void *vp; typedef struct stst int i; char *p; st; printf("\nproblem 3\n"); // assignment statements st x; ip = &k[4]; vp = ip; cp = &c[0]; x.p = cp+3; x.i = 27; printf ("*(ip+2) + c[3] = %d\n",*(ip+2) + c[3]); printf ("(*cp +1) = %d\n", (*cp +1)); printf ("*(ip) + 6 = %d\n", *(ip) +6); vp = &x ; printf ("vp = &x ; ((st*)vp)->p; = %d\n", ((st*)vp)->p ); printf ("*(ip-2) = %d\n", *(ip-2)); 12
13 ************************************************************** Results: code]$ gcc mt_a05.c mt_a05.c: In function prob2 : mt_a05.c:190: warning: large integer implicitly truncated to unsigned type [blake@beagle code]$./a.out EE 472 A2005 MIDTERM SOLUTIONS Problem is a power of two 7 is NOT a power of two 16 is a power of two Problem is negative -2 is a power of two -7 is negative -7 is NOT a power of two -16 is negative -16 is a power of two 13 is positive 13 is NOT a power of two 128 is positive 128 is a power of two -256 is negative -256 is a power of two Problem 1.2a (alternate solution to 1.2) +-2 is either positive or negative -2 is a power of two +-7 is either positive or negative -7 is NOT a power of two +-16 is either positive or negative -16 is a power of two +-13 is either positive or negative 13 is NOT a power of two is either positive or negative 128 is a power of two is either positive or negative -256 is a power of two Problem 2 a = Ox33 = b = Oxdf = c = Ox84 = d = Ox0 = e = Oxff = Problem 3 *(ip+2) + c[3] = 28 (*cp +1) = 12 *(ip) + 6 = 16 vp = &x ; ((st*)vp)->p; = *(ip-2) = 6 [blake@beagle code]$ // this should be answered "X" 13
EE472 Final Exam SOLUTION KEY. Prof. Blake Hannaford Department of Electrical Engineering The University of Washington 9-DEC-2008
EE472 Final Exam SOLUTION KEY Prof. Blake Hannaford Department of Electrical Engineering The University of Washington 9-DEC-2008 Problem 1 / 15 Problem 2 / 25 Problem 3 / 25 Problem 4 / 15 Problem 5 /
More informationEE 472 Embedded Systems. Name solutions. Instructions:
Name solutions Instructions: Write your name and student id on every page. You may not consult any other materials or anyone in the class. If you are unsure of what a question is asking, write your assumptions
More informationLecture 02 C FUNDAMENTALS
Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void
More informationMidterm Exam Answers Instructor: Randy Shepherd CSCI-UA.0201 Spring 2017
Section 1: Multiple choice (select any that apply) - 20 points 01. Representing 10 using the 4 byte unsigned integer encoding and using 4 byte two s complements encoding yields the same bit pattern. (a)
More informationCS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015
CS 141 - Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015 You may take this test with you after the test, but you must turn in your answer sheet. This test has the following sections:
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationBachelor of Engineering in Computer and Electronic Engineering
Bachelor of Engineering in Computer and Electronic Engineering Computer Engineering 1 Year 2 Semester 3 Autumn 08 Niall O Keeffe Instructions to Candidates: - 2 hours duration Answer 4 out of 6 questions.
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationEE251: Tuesday December 4
EE251: Tuesday December 4 Memory Subsystem continued Timing requirements Adding memory beyond 4 Gbyte Time Allowing: Begin Review for Final Exam Homework #9 due Thursday at beginning of class Friday is
More informationCOP 3223 Introduction to Programming with C - Study Union - Spring 2018
COP 3223 Introduction to Programming with C - Study Union - Spring 2018 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationLab 3a: Scheduling Tasks with uvision and RTX
COE718: Embedded Systems Design Lab 3a: Scheduling Tasks with uvision and RTX 1. Objectives The purpose of this lab is to lab is to introduce students to uvision and ARM Cortex-M3's various RTX based Real-Time
More informationTime: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:
ECE 120 Midterm 1 HKN Review Session Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location: Your Room on Compass What to bring: icard, pens/pencils, Cheat sheet (Handwritten) Overview of Review Binary IEEE
More informationSignature: 1. (10 points) Basic Microcontroller Concepts
EE 109 Practice Final Exam Last name: First name: Signature: The practice final is one hour, ten minutes long, closed book, closed notes, calculators allowed. To receive full credit on a question show
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices
More informationCS 237 Meeting 19 10/24/12
CS 237 Meeting 19 10/24/12 Announcements 1. Midterm: New date: Oct 29th. In class open book/notes. 2. Try to complete the linear feedback shift register lab in one sitting (and please put all the equipment
More informationIntroduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C
Final Review CS304 Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation
More informationMidterm I Exam Principles of Imperative Computation Frank Pfenning. February 17, 2011
Midterm I Exam 15-122 Principles of Imperative Computation Frank Pfenning February 17, 2011 Name: Sample Solution Andrew ID: fp Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationUnited States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017
United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes
More informationSample Examination. Family Name:... Other Names:... Signature:... Student Number:...
Family Name:... Other Names:... Signature:... Student Number:... THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF COMPUTER SCIENCE AND ENGINEERING Sample Examination COMP1917 Computing 1 EXAM DURATION: 2 HOURS
More informationCSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators
CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to
More informationEECS 373 Practice Midterm / Homework #3 Fall 2014
Exam #: EECS 373 Practice Midterm / Homework #3 Fall 2014 Name: Uniquename: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: Problem #
More informationIntroduction: The Unix shell and C programming
Introduction: The Unix shell and C programming 1DT048: Programming for Beginners Uppsala University June 11, 2014 You ll be working with the assignments in the Unix labs. If you are new to Unix or working
More informationCS-537: Midterm Exam (Spring 2009) The Future of Processors, Operating Systems, and You
CS-537: Midterm Exam (Spring 2009) The Future of Processors, Operating Systems, and You Please Read All Questions Carefully! There are 15 total numbered pages. Please put your NAME and student ID on THIS
More informationQ1: Functions / 33 Q2: Arrays / 47 Q3: Multiple choice / 20 TOTAL SCORE / 100 Q4: EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2018 Exam 2 March 30, 2018 Name: Lecture time (circle 1): 8-8:50 (Sec. 201) 12-12:50 (Sec. 202) For this exam, you may use only one 8.5 x 11 double-sided page
More informationSOFTWARE Ph.D. Qualifying Exam Spring Consider the following C program which consists of two function definitions including the main function.
(i) (5 pts.) SOFTWARE Ph.D. Qualifying Exam Spring 2018 Consider the following C program which consists of two function definitions including the main function. #include int g(int z) { int y
More informationSpecial Topics for Embedded Programming
1 Special Topics for Embedded Programming ETH Zurich Fall 2018 Reference: The C Programming Language by Kernighan & Ritchie 1 2 Overview of Topics Microprocessor architecture Peripherals Registers Memory
More informationCS 0449 Sample Midterm
Name: CS 0449 Sample Midterm Multiple Choice 1.) Given char *a = Hello ; char *b = World;, which of the following would result in an error? A) strlen(a) B) strcpy(a, b) C) strcmp(a, b) D) strstr(a, b)
More informationBit Manipulation in C
Bit Manipulation in C Bit Manipulation in C C provides six bitwise operators for bit manipulation. These operators act on integral operands (char, short, int and long) represented as a string of binary
More informationINDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator
INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator EXAMINATION ( End Semester ) SEMESTER ( Autumn ) Roll Number Section Name Subject Number C S Subject Name Programming and Data
More informationMidterm Exam 2 Solutions, C programming
Midterm Exam 2 Solutions, C programming April 26, 2010 Rules: Open book, open notes, open any printed or handwritten material. No electronic devices (except a music player). If you use a music player nobody
More informationMIDTERM EXAM. CS 217 October 28, Name: Precept: Honor Code: Score: Problem Score Max
MIDTERM EXAM CS 217 October 28, 1999 Name: Precept: Honor Code: Score: Problem Score Max 1 15 2 5 3 10 4 15 5 5 6 10 7 10 Total 70 1 1. Number Systems (a) Translate the following decimal numbers to binary,
More informationCS360 Midterm 1 - February 21, James S. Plank. Put all answers on the answer sheet. In all of these questions, please assume the following:
CS360 Midterm 1 - February 21, 2017 - James S. Plank Put all answers on the answer sheet. In all of these questions, please assume the following: Pointers and longs are 4 bytes. The machine is little endian
More informationExam Principles of Imperative Computation, Summer 2011 William Lovas. June 24, 2011
Exam 3 15-122 Principles of Imperative Computation, Summer 2011 William Lovas June 24, 2011 Name: Andrew ID: Instructions This exam is closed-book with one double-sided sheet of notes permitted. You have
More informationEE 312 Fall 2017 Midterm 1 October 12, 2017
EE 312 Fall 2017 Midterm 1 October 12, 2017 Name: EID: Recitation time: Recitation TA (circle one): Colin Huy Give clear, legible answers. If you give more than one answer, we will randomly choose one
More informationCOMP1917 Computing 1 Written Exam Sample Questions
COMP1917 Computing 1 Written Exam Sample Questions Note: these sample questions are intended to provide examples of a certain style of question which did not occur in the tutorial or laboratory exercises,
More informationCSC369H1 S2016 Midterm Test Instructor: Bogdan Simion. Duration 50 minutes Aids allowed: none. Student number:
CSC369H1 S2016 Midterm Test Instructor: Bogdan Simion Duration 50 minutes Aids allowed: none Student number: Last name: First name: Lecture section: L0101(day) L5101(evening) (circle only one) Do NOT turn
More informationCourse Outline Introduction to C-Programming
ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,
More information8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers
8051 Peripherals On-Chip Memory Timers Serial Port Interrupts Computer Engineering 2 2-1 8051 Timers 8051 Timers The 8051 has 2 internal 16-bit timers named Timer 0 and Timer 1 Each timer is a 16-bit counter
More informationExercise Session 2 Systems Programming and Computer Architecture
Systems Group Department of Computer Science ETH Zürich Exercise Session 2 Systems Programming and Computer Architecture Herbstsemester 216 Agenda Linux vs. Windows Working with SVN Exercise 1: bitcount()
More informationCMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization. October 9, 2002
Name: Student Id: General instructions: CMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization October 9, 2002 This examination booklet has 10 pages. Do not forget
More informationQ1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2016 Exam 1 February 19, 2016 Name: Section (circle 1): 201 (8-8:50, P. Li) 202 (12-12:50, M. Geiger) For this exam, you may use only one 8.5 x 11 double-sided
More informationStructures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; };
Structures EECS 2031 25 September 2017 1 Basics of Structures (6.1) struct point { int x; int y; keyword struct introduces a structure declaration. point: structure tag x, y: members The same member names
More informationUnited States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring 2015
United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring 2015 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes
More informationUniversity of Maryland College Park Dept of Computer Science CMSC106 Fall 2016 Midterm I
University of Maryland College Park Dept of Computer Science CMSC106 Fall 2016 Midterm I Last Name (PRINT): First Name (PRINT): University Directory ID (e.g., umcpturtle) I pledge on my honor that I have
More informationComputer Science /21/2000
Computer Science 126 01/21/2000 Final Exam with Answers 1:30-4:30pm 1. Linked Lists and Recursion [11] This is based on final review question #6. Assume the following linked list definition. typedef struct
More informationQ1: Multiple choice / 20 Q2: Arrays / 40 Q3: Functions / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2017 Exam 2 March 29, 2017 Name: Section (circle 1): 201 (Dr. Li, MWF 8-8:50) 202 (Dr. Geiger, MWF 12-12:50) For this exam, you may use only one 8.5 x 11 double-sided
More informationEE251: Thursday November 30
EE251: Thursday November 30 Course Evaluation Forms-fill out Memory Subsystem continued Timing requirements Adding memory beyond 4 Gbyte Time Allowing: Begin Review for Final Exam Homework due next Tuesday,
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()
More informationC OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure
C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces
More informationCS-211 Fall 2017 Test 1 Version Practice For Test on Oct. 2, Name:
CS-211 Fall 2017 Test 1 Version Practice For Test on Oct. 2, 2017 True/False Questions... Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a)
More informationMidterm Exam 1 Solutions C Programming Dr. Beeson, Spring 2009
Midterm Exam 1 Solutions C Programming Dr. Beeson, Spring 2009 March 10, 2009 Instructions: Please write your answers on the printed exam. Do not turn in any extra pages. No interactive electronic devices
More information1996 ILLINOIS JETS TEAMS DISTRICT COMPUTER FUNDAMENTALS TEST. 1. A computer program is:
1996 ILLINOIS JETS TEAMS DISTRICT COMPUTER FUNDAMENTALS TEST 1. A computer program is: a. a sequence of binary machine instructions b. a sequence of operations to carry out a defined task c. a set of computer
More information'C' Programming Language
F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax
More informationUniversity of Washington EE 472: Microcomputer Systems Exam Autumn 2015
University of Washington EE 472: Microcomputer Systems Exam Autumn 2015 November 26, 2015 Name: Student ID: Exam Information: The test is closed book, and no calculators/devices are allowed. There are
More informationBits, Bytes and Integers
Bits, Bytes and Integers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationTime (self-scheduled): Location Schedule Your Exam: What to bring:
ECE 120 Midterm 1B HKN Review Session Time (self-scheduled): Between Wednesday, September 27 and Friday, September 29, 2017 Location: 57 Grainger Engineering Library (in the basement on the east side)
More informationCMSC 313 Fall2009 Midterm Exam 1 Section 01 October 12, 2009
CMSC 313 Fall2009 Midterm Exam 1 Section 01 October 12, 2009 Name Score UMBC Username Notes: a. Please write clearly. Unreadable answers receive no credit. b. For short answer questions your answer should
More informationBy the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab
By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy
More informationEE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.
More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems
More informationUniversity of Maryland College Park Dept of Computer Science CMSC106 Fall 2013 Midterm I Key
University of Maryland College Park Dept of Computer Science CMSC106 Fall 2013 Midterm I Key Last Name (PRINT): First Name (PRINT): University Directory ID (e.g., umcpturtle) I pledge on my honor that
More informationExam Principles of Imperative Computation, Summer 2011 William Lovas. June 24, 2011
Exam 3 15-122 Principles of Imperative Computation, Summer 2011 William Lovas June 24, 2011 Name: Sample Solution Andrew ID: wlovas Instructions This exam is closed-book with one double-sided sheet of
More informationMake sure the version number is marked on your scantron sheet. This is Version 1
Last Name First Name McGill ID Make sure the version number is marked on your scantron sheet. This is Version 1 McGill University COMP 208 -- Computers in Engineering Mid-Term Examination Tuesday, March
More information15-213, Fall 2007 Midterm Exam
Andrew login ID: Full Name: 15-213, Fall 2007 Midterm Exam October 17, 2007, 1:00pm-2:20pm Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID
More informationMidterm Exam. CSCI 2132: Software Development. March 4, Marks. Question 1 (10) Question 2 (10) Question 3 (10) Question 4 (10) Question 5 (5)
Banner number: Name: Midterm Exam CSCI 2132: Software Development March 4, 2019 Marks Question 1 (10) Question 2 (10) Question 3 (10) Question 4 (10) Question 5 (5) Question 6 (5) Total (50) Instructions:
More informationMidterm II Exam Principles of Imperative Computation Frank Pfenning. March 31, 2011
Midterm II Exam 15-122 Principles of Imperative Computation Frank Pfenning March 31, 2011 Name: Sample Solution Andrew ID: fp Section: Instructions This exam is closed-book with one sheet of notes permitted.
More informationAGENDA Binary Operations CS 3330 Samira Khan
AGENDA Binary Operations CS 3330 Logistics Review from last Lecture Samira Khan University of Virginia Jan 31, 2017 Binary Operations Logical Operations Bitwise Operations Examples 2 Feedbacks Quizzes
More informationName: Login: cs61c- Decimal Ternary 5 12 three three
Name: Login: cs61c- Question 5: Three s a Crowd (15 pts, 36 min) Breaking news! We have just developed hardware that has 3- states: {false=0, true=1, and maybe=2! Now we can store all our numbers in base
More informationMTH 307/417/515 Final Exam Solutions
MTH 307/417/515 Final Exam Solutions 1. Write the output for the following programs. Explain the reasoning behind your answer. (a) #include int main() int n; for(n = 7; n!= 0; n--) printf("n =
More informationHigh Performance Computing
High Performance Computing MPI and C-Language Seminars 2009 Photo Credit: NOAA (IBM Hardware) High Performance Computing - Seminar Plan Seminar Plan for Weeks 1-5 Week 1 - Introduction, Data Types, Control
More informationVariables Data types Variable I/O. C introduction. Variables. Variables 1 / 14
C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition
More informationLab 3b: Scheduling Multithreaded Applications with RTX & uvision
COE718: Embedded System Design Lab 3b: Scheduling Multithreaded Applications with RTX & uvision 1. Objectives The purpose of this lab is to introduce students to RTX based multithreaded applications using
More informationEmbedded Systems Programming - PA8001
Embedded Systems Programming - PA8001 http://bit.ly/15mmqf7 Lecture 1 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering
More informationCS , Fall 2001 Exam 2
Andrew login ID: Full Name: CS 15-213, Fall 2001 Exam 2 November 13, 2001 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationComputer Organization & Systems Exam I Example Questions
Computer Organization & Systems Exam I Example Questions 1. Pointer Question. Write a function char *circle(char *str) that receives a character pointer (which points to an array that is in standard C
More informationAdministrivia. Introduction to Computer Systems. Pointers, cont. Pointer example, again POINTERS. Project 2 posted, due October 6
CMSC 313 Introduction to Computer Systems Lecture 8 Pointers, cont. Alan Sussman als@cs.umd.edu Administrivia Project 2 posted, due October 6 public tests s posted Quiz on Wed. in discussion up to pointers
More informationComp 310 Computer Systems and Organization
Comp 310 Computer Systems and Organization Lecture #10 Process Management (CPU Scheduling & Synchronization) 1 Prof. Joseph Vybihal Announcements Oct 16 Midterm exam (in class) In class review Oct 14 (½
More informationMidterm Sample Questions. a) What evaluates to FALSE in C? What evaluates to TRUE?
Midterm Syllabus: 1. Number systems a. Signed and unsigned representations b. Conversion between different representations c. Overflow condition 2. C Pointers 3. Dynamic Memory Allocation 4. C Data structures:
More informationEECS 373 Midterm Winter 2017
EECS 373 Midterm Winter 2017 Name: unique name: Sign the following honor code pledge. I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: Problem Points 1 /12
More informationEECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution
EECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationCS16 Exam #1 7/17/ Minutes 100 Points total
CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding
More informationComputer Systems C S Cynthia Lee
Computer Systems C S 1 0 7 Cynthia Lee 2 Today s Topics LAST TIME: Number representation Integer representation Signed numbers with two s complement THIS TIME: Number representation The integer number
More informationImplementation of Sequential Function Charts with microcontrollers
Implementation of Sequential Function Charts with microcontrollers N. A. Ivanescu, Th. Borangiu, S. Brotac and A. Dogar University Politehnica, Bucharest, Romania Abstract The paper describes an efficient
More information// middle priority ISR Status.flag = 1; Status.y = 6;
EE445L Spring 2018 Quiz 1A Page 1 of 6 Jonathan W. Valvano First: Last: March 1, 2018, 3:30pm-4:45pm. This is a closed book exam, with one 8.5 by 11-inch crib sheet. You have 75 minutes, so please allocate
More informationIntroduction to the MC9S12 Hardware Subsystems
Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators
More informationHardware: Logical View
Hardware: Logical View CPU Memory Bus Disks Net USB Etc. 1 Hardware: Physical View USB I/O controller Storage connections CPU Memory 2 Hardware: 351 View (version 0) instructions? Memory CPU data CPU executes
More information(VERSION WITH ANSWERS) CORE EXAMINATION Department of Computer Science New York University September 26, 2008
(VERSION WITH ANSWERS) CORE EXAMINATION Department of Computer Science New York University September 26, 2008 This is the common examination for the M.S. program in CS. It covers three core computer science
More informationUniversity of Texas at Austin Electrical and Computer Engineering Department. EE319K, Embedded Systems, Spring 2013 Final Exam
University of Texas at Austin Electrical and Computer Engineering Department EE319K, Embedded Systems, Spring 2013 Final Exam Directions There are 6 problems worth a total of 100 points. The number of
More informationCSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)
Name: Email address: Quiz Section: CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will
More informationWe do not teach programming
We do not teach programming We do not teach C Take a course Read a book The C Programming Language, Kernighan, Richie Georgios Georgiadis Negin F.Nejad This is a brief tutorial on C s traps and pitfalls
More informationCS-537: Midterm Exam (Fall 2008) Hard Questions, Simple Answers
CS-537: Midterm Exam (Fall 28) Hard Questions, Simple Answers Please Read All Questions Carefully! There are seven (7) total numbered pages. Please put your NAME and student ID on THIS page, and JUST YOUR
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices
More informationEmbedded Controller Programming 2
Embedded Controller Programming 2 Section 1: Introduction and Getting Started - Ken Arnold ecp2@hte.com Copyright 2006 Ken Arnold Welcome! ECP II Course Overview Instructor & Student Introductions Review
More informationC OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed
C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages
More informationCOS 318: Midterm Exam (October 23, 2012) (80 Minutes)
COS 318: Midterm Exam (October 23, 2012) (80 Minutes) Name: This exam is closed-book, closed-notes. 1 single-sided 8.5x11 sheet of notes is permitted. No calculators, laptop, palmtop computers are allowed
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Midterm Examination October 20, 2011 6:15 p.m. 8:00 p.m. (105 minutes) Examiners: J. Anderson, T. Fairgrieve,
More informationIntroduction to Mechatronics
ME 6405 Introduction to Mechatronics Fall 2004 Instructor: Professor Charles Ume Lecture on Introl C compiler Contents Overview of C compliers for HC11 Overview of Introl CODE Introl CODE Project Project
More informationExercise Session 2 Simon Gerber
Exercise Session 2 Simon Gerber CASP 2014 Exercise 2: Binary search tree Implement and test a binary search tree in C: Implement key insert() and lookup() functions Implement as C module: bst.c, bst.h
More informationCSSE 332 OPERATING SYSTEMS
CSSE 332 OPERATING SYSTEMS EXAM 1 MAKEUP SOLUTIONS, SPRING 2007-2008 This exam is to be done on paper with limited computer usage. The exam consists of 12 problems on 11 pages for a total of 100 points.
More informationFinal Exam. Date: May 12, 2017
Final Exam Date: May 12, 2017 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationC PROGRAMMING QUESTIONS AND
8/26/2011 C C PROGRAMMING QUESTIONS AND ANSWER http://cquestionbank.blogspot.com Ritesh kumar (1) What will be output if you will compile and execute the following c code? struct marks{ int p:3; int c:3;
More information