DOC PREVIEW
UNCC ECGR 4101 - ECGR 4101 Midterm Exam

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECGR 4101/5101 - Midterm Exam Page 1 of 3 UNC Charlotte–ECGR4101/5101-Midterm Exam –10/14/09 Multiple Choice - Questions 1-10: Each of these multiple choice questions is worth 4 points for a correct answer, 0 points for an incorrect answer. Circle your answers on the bubble sheet. 1) Which of the following fully describes the outcome of the code at the right? a. Add all the numbers from 0 to 100 and put the result in sum. b. Add all the odd numbers from 0 to 100 and put the result in sum. c. Add all the even numbers from 0 to 100 and put the result in sum. d. Add all the odd numbers from N to 100 and put the result in sum. e. Add all the even numbers from N to 100 and put the result in sum. int i,sum; sum = 0; i = 0; for(i=N;i<100;i++){ if((i % 2)) sum += i; } 2) MCU can run in three modes: single chip, memory expansion, microprocessor modes. If used in single-chip mode what areas in memory could be addressed. a. Only internal areas (SFR, internal RAM, internal ROM) b. Internal areas (SFR, internal RAM, internal ROM) and external memory areas c. SFR, internal RAM and external memory d. SFR, external memory e. Only external memory 3) What is the number of address bits required to address any byte in a memory that contains 65536 bytes? a. 2 b. 8 c. 12 d. 16 e. 20 4) If I used the MCU30262 instruction ‘enter #2’ at the beginning of a function, how many bytes does the corresponding ‘exitd’ instruction deallocate from the stack if no other enter, exitd, jsr, pop or push operations are performed within the function? a. 6 b. 7 c. 8 d. 9 e. 10 5) Which assembly language code below adds the value of global integer variable shoe (defined in a C program) to the value in R1 and stores the result in R1: a. add.w shoe, R1 d. add.w _shoe, R1 b. add.w R1, shoe e. add shoe + R1 c. add _shoe, R1 6) How far apart in time can two interrupts be and still be considered as simultaneous (assume a 16 MHz clock)? a. 92 ns d. 40 ps b. 62.5 ns e. None of the above c. 50 ns Consider the piece of C-code to the right for questions 7 and 8: 7) How is the char b in the code passed to the function choosechar(a,b)? a. Stack d. R1H b. R1L e. R2 c. R1 f. None of the above 8) How is the int d passed in the function dothemath(c,d)? a. Stack d. R1H b. R1L e. R2 c. R1 f. None of the above main(){ char a = ‘x’; char b = ‘a’; char new; int d = 5; float c = 3.14; float result; new = choosechar(a,b); result = dothemath(c,d); }ECGR 4101/5101 - Midterm Exam Page 2 of 3 9) The double word 0x AC35 FA34 is stored in memory addresses N through N+3. Which of the following represents storage using big endianness? a. N 43 c. N AC e. N 34 N+1 AF N+1 35 N+1 FA N+2 53 N+2 FA N+2 35 N+3 CA N+3 34 N+3 AC b. N FA d. N 35 N+1 34 N+1 AC N+2 AC N+2 34 N+3 35 N+3 FA 10) According the ECGR4101/5101 programming standards, which of the following should be included in the header of a subroutine? a. Subroutine name d. Interfaces b. Assumptions e. All of the above c. Inputs/Outputs Short Answer 11) You have several 1Ahr 1.2V batteries and a LED that has an average drain of 3.5mA at 4.8V. a. Draw the configuration of the minimum number of batteries needed to light the LED.(2 points) b. With your battery configuration how long would the LED stay lit? (3 points) 12) Given the following information of a particular analog to digital converter, determine the value of the digitally represented voltage and the step size of the converter. (10 points) • The device is a 10-bit ADC with a + reference voltage of 3.3 volts and a – reference voltage of -0 volts. • The digital representation is: 0100110010. 13) What are the benefits of a microprocessor/microcontroller-based embedded system over an FPGA-based embedded system? (10 points) (in three to five sentences) 14) Can you, the user, store a value at memory location 00CBCh? Why or why not? (5 points) 15) Write the code to set up an A/D conversion for the first four channels of P2, 10-bit sample-and-hold, one shot and store the data in four variables (unsigned int sample0, sample1, sample2, sample3). Include all set-up bytes needed. If you use any .h files, tell me which ones you use. (25 points) 16) A) Imagine you have an embedded system that uses your QSK board. The system will: •••• Req. 1: Use the C programming language. •••• Req. 2: Continually poll SW1. While it is pressed, light the LED1. •••• Req. 3: Continually poll SW2. While it is pressed, light the LED2. •••• Req. 4: Continually poll SW3. While it is pressed, light the LED3. •••• Req. 5: Two or three LEDs can be lit at the same time. •••• Req. 6: Continually have an ISR put an analog value on Port 0, bit 0 put it in the variable printme. •••• Req. 7: Continually print the value in printme on the LCD. •••• Req. 8: You may not use any string libraries. •••• Req. 9: Include a few comments, including headers. Identify the "architecture" of this problem, dividing the work into appropriate functions. Substantiate your design decisions. (20 points) B) Write the algorithms (general steps) which implements the above functionality of all functions. (35 points)ECGR 4101/5101 - Midterm Exam Page 3 of 3 UNC Charlotte–ECGR4101/5101-Midterm Exam –10/14/09 Name: _______________________________ Mosaic User ID ____________________________ Question 1-10 11 12 13 14 15 16 Total Score /40 /5 /10 /10 /5 /25 /55 /150 You are permitted 75 minutes to take this test, no more. This is an open book/open notes test. You are allowed the following items for the test: calculator, books, notes, homework, labs, pencils and erasers. You are not permitted to have any of the following on your desk during the test: computer, cell phone, or other electronic assistance. Failure to abide by this policy will result in a zero for the test and a visit to the UNC Charlotte honor board. Put your answers on paper provided, and turn in this sheet and the answer pages - use


View Full Document

UNCC ECGR 4101 - ECGR 4101 Midterm Exam

Documents in this Course
Load more
Download ECGR 4101 Midterm Exam
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ECGR 4101 Midterm Exam and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ECGR 4101 Midterm Exam 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?