SAN JOSÉ STATE UNIVERSITY E10 Introduction to Engineering Homework 3 Programming.
SAN JOSÉ STATE UNIVERSITY E10 Introduction to Engineering Homework 3 Programming. SAN JOSÉ STATE UNIVERSITY E10 Introduction to Engineering 2. (6 pts) What is the value of the variable ‘A’ at end of the following program? Show your reasoning. Line 0 Void main (void) Line 1 { Line 2 int A; Line 3 int COUNT; Line 4 A=1; Line 5 COUNT=0; Line 6 while (COUNT 5) Line 7 { Line 8 if (COUNT2) Line 9 { A=A+4; } Line 10 else { Line 11 A=A+COUNT; } Line 12 COUNT = COUNT +1; Line 13 } Line 14 } 3. (6 pts) Find and indicate all of the errors in the following program. (Hint: one of the errors has to do with an unwanted infinite loop) Line 0 void main(void) Line 1 { Line 2 int P; Line 3 int Q; Line 4 int R; Line 5 P = 30; Line 6 Q = 0; Line 7 R= 4; Line 8 if ( P R;) Line 9 { Q = R - P; Line 10 R= 0; Line 11 if ( Q=0) Line 12 { S = P + Q +R ;} Line 13 P =2; Line 14 while (P 20) Line 15 { S=P+1; Line 16 Q=Q+1; Line 17 R= R+1 Line 18 } Line 19 } 5. (3 pts) There are 5 red LEDs on the electronic board (IRB). Describe what it means when they are on. The answer to this is found in the robot documentation on the web site. Hint: read Robot Guidelines. In the Robot Project Guidelines notes, the 5 red LEDs represent as status indication. LED 1, LED 2, and LED 3 are ON, these detectors are at high rate gives out random flashing. LED 4 is ON, 1KHz is selected where the circuit turned to the red beacon. LED 5 is ON, the setting of the circuit is at low sensitivity.
Written for
- Institution
- SAN JOSÉ STATE UNIVERSITY E10 Introduction to Engi
- Course
- SAN JOSÉ STATE UNIVERSITY E10 Introduction to Engi
Document information
- Uploaded on
- April 28, 2023
- Number of pages
- 5
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
san josÉ state university e10 introduction to engineering homework 3 programming