DOC PREVIEW
UNCC ECGR 4101 - Midterm Exam

This preview shows page 1 out of 4 pages.

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

Unformatted text preview:

ECGR 4101/5101 - Midterm Exam Page 1 of 4 Batteries To LED UNC Charlotte–ECGR4101/5101-Midterm Exam –10/12/05 You are permitted 50 minutes to take this test, no more. This is an open book/open notes test. You are allowed the following items for the test: calculators, 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 the answer sheet - use only that paper. Turn in the answer sheet at the end of the test. You may keep this test booklet. Multiple Choice - Questions 1-15: Each of these multiple choice questions is worth 5 points for a correct answer, 0 points for an incorrect answer. Circle your answers on the bubble sheet. 1) According the ECGR4101 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 2) Which of the following does the ncrt0.a30 C start-up module NOT do? a. Load static variables with their initialized values b. Initialize the stack pointer c. Set all digital general purpose I/Os to inputs d. Set up the variable interrupt vector table e. Define the location of ROM and RAM 3) What is the one thing that all of our code should have? a. Your name and file name in comments at the top of every file. b. Twelve subroutine. c. a while(1) loop in every subroutine d. a function call to the skp_lcd.c file. e. None of the above 4) You have several 650mAh 1.5V batteries and a LED that has an average drain of 3.5mA at 4.5V. If you had the following battery configuration how long would the LED stay lit? a. 557.1 hours b. 185.7 hours c. 371.4 hours d. 209.3 hours e. 191.4 hours 5) What is the number of address bits required to address any byte in a memory that contains 4096 bytes? a. 2 b. 8 c. 12 d. 16 e. 20 6) How many bits does program counter register consist of? a. 20 bit b. 16 bit c. 8 bit d. 10 bit e. 12 bitECGR 4101/5101 - Midterm Exam Page 2 of 4 7) In C, the term volatile is applied to a variable in order to: a. Tell the compiler that a variable's value may change due to forces other than the program in which the variable appears. b. Tell the compiler that a variable's value is not constant c. Mark that a variable may be optimized out of the code when unused d. Tell the compiler to store the variable's value in ``volatile'' ram instead of ``non-volatile'' ram such as an EEPROM e. None of the above 8) Use the following C code for these questions: void main() { char bird[10]; /* bird starts at memory location 0810H */ char c1,c2; int i; char *ptr1; i=2; strcpy(bird, “robin”); ptr1=&bird[1]; ptr1=ptr1+i; c1=*ptr1; c2=bird[0]; } 9) What is the memory location of c1? a. 0800H b. 0810H c. 0811H d. 0820H e. 0821H 10) What is the value of ptr1 after the program has run? a. 0810H b. 0811H c. 0812H d. 0813H e. 0822H 11) What is the value of c1 after the program has run? a. r b. o c. b d. i e. n 12) What is the value of c2 after the program has run? a. null b. Can’t tell from the program. c. ‘r’ d. ‘o’ e. 2ECGR 4101/5101 - Midterm Exam Page 3 of 4 13) What will happen if you try to write to an array element larger then your array? a. An error will be reported b. The program won’t compile c. Nothing. d. You don’t know, but it will most likely be bad. e. The array will redefine itself bigger. 14) What is the total address space for our class microcontroller? a. 31 kbytes b. 384 kbytes c. 415 kbytes d. 419 kbytes e. 1024 kbytes 15) According to the assembly code below, what does it perform in C language? a. While loop b. If-Else statement c. Switch statement d. For loop e. None of the above mov.w #0000H, -6[FB] L7: cmp.w #000aH, -6[FB] jge L8 add.w #0001H, -6[FB] jmp L7 L8: … Written Answer 16) What area of RAM is available for the user program on the SKP30262 board, assuming the monitor program is still used? List the range of addresses and exact size in bytes (not k bytes). (5 points) 17) 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 an 10-bit ADC with a reference voltage of 5 volts. • The digital representation is 0001 0010. 18) Imagine you have an embedded system that uses your SKP board. The system will: •••• Req. 1: Use C programming language •••• Req. 2: Use the skp_bsp.h file provided, especially the Macros. •••• Req. 3: Use the other standard .A30, .H, and .INC files •••• Req. 4: Sent the processor to always read the thermistor value with the ADC, 8-bits •••• Req. 5: Poll SW1. When it is pressed, light all lights. •••• Req. 6: Also when SW1 is pressed, read the 8-bit thermistor value from the ADC register and write the lower 8 bits to an unused 8-bit port on the SKP (use the hardware schematic to help). •••• Req. 7: Make the written code as short as possible, using the provided macros where possible. You only need the main subroutine. •••• Req. 8: Include a few comments. Part a) Write the pseudocode which implements the above functionality (30 points) Part b) Write the C code which implements the above functionality (45 points)ECGR 4101/5101 - Midterm Exam Page 4 of 4 UNC Charlotte–ECGR4101/5101-Midterm Exam –10/12/05 Name: _______________________________ User ID ____________________________ Question Multiple Choice 1-10 Short Answer 16-17 Long Answer 18 Total Score /60 /15 /75 /150 Please read and sign this statement: I have not received from anyone nor assisted others while taking this test. I have also notified the test proctor of any of these violations noted above. Signature: ____________________________________ Problem 1-15: Answer on the bubble sheet. Enter your name on the sheet (not your ID number, etc). 16. 17. 18 on back and on extra


View Full Document

UNCC ECGR 4101 - Midterm Exam

Documents in this Course
Load more
Download 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 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 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?