Friday,18 August,2017
header image

Prog Ex

1.Which of these can an Arduino NOT be used for?

  1. controlling servos
  2. displaying analog inputs
  3. building robots
  4. an Arduino cannot be used to do all of these

2.What are the Arduino’s two main program structures?

  1. setup and loop
  2. main and setup
  3. loop and main
  4. int and setup

3.How many analog ports does an Arduino have?

  1. five, and they are labeled A1-A5
  2. six, and they are labeled A0-A5
  3. six, and they are labeled A1-A6
  4. five, and they are labeled A0-A4

4.Which of these is an output device?

  1. pressure sensor
  2. servo
  3. button
  4. potentiometer

5.What command would you use to tell the Arduino that there is an output on port 9?

  1. int sensorPin = 9;
  2. int sensorValue = 9;
  3. digitalWrite(9, HIGH);
  4. pinMode(9, OUTPUT);

6.What command would you use to light up an LED on port 5?

  1. int sensorPin = A0;
  2. int sensorValue = 0;
  3. digitalWrite(5, HIGH);
  4. pinMode(5, OUTPUT);

7.How would you pause a program for 2.5 seconds?

  1. delay(2500)
  2. int sensorValue = 0;
  3. delay(2.5);
  4. pinMode(ledPin, OUTPUT);

===================================================================

The questions in the next section are answered by referring to the following program:

  • int sensorPin = A0;
  • int ledPin = 13;
  • int sensorValue = 0;
  • void setup() {
  • pinMode(ledPin, OUTPUT);
  • }
  • void loop() {
  • sensorValue = analogRead(sensorPin);
  • digitalWrite(ledPin, HIGH);
  • delay(sensorValue);
  • digitalWrite(ledPin, LOW);
  • delay(sensorValue);
  • }

===================================================================

8.What is the purpose of line 4?

  1. To begin the setup program structure
  2. To begin the loop program structure
  3. To set the input value of port 13 to ‘ON’
  4. line 4 has no function in the program

9.What is the purpose of line 9?

  1. Turns off the LED plugged into pin 0
  2. Turns on the LED plugged into pin 13
  3. Turns off the LED plugged into pin 13
  4. Turns on the LED plugged into pin 0

10.What is the purpose of line 5?

  1. To begin the setup program structure.
  2. It turns on the LED plugged into port 13.
  3. To set port 13 to an output.
  4. Line 5 has no function in the program.

11.What does this program do when it is uploaded to the Arduino?

  1. It blinks an LED based on the value of an analog input.
  2. It writes the value of an analog input to the screen.
  3. It changes the brightness of an LED based on the value of an analog input.
  4. It blinks an LED, with no input from analog sources.

12.Byte stores an …… numerical value without decimal points. They have a range of 0-255.

  1. 4-bit .
  2. 8-bit .
  3. 16-bit .
  4. 32-bit .

13.Integer variables will roll over if forced past their maximum or minimum values by an assignment or comparison. For example, if x = 32767 and a subsequent statement adds 1 to x, x = x + 1 or x++, x will then rollover and equal …….

  1. -32767.
  2. 32,768.
  3. -32,768 .
  4. 32767.

14.For floating-point numbers, or numbers that have a decimal point. Floating-point numbers have greater resolution than integers and are stored as a ….. value 

  1. 4-bit .
  2. 8-bit .
  3. 16-bit .
  4. 32-bit .

15.int myArray[5]; // declares integer array w/ …… positions

  1. 0 .
  2. 4 .
  3. 5 .
  4. 6 .

16.myArray[3] = 10; // assigns the …… index the value 10

  1. 3 .
  2. 4 .
  3. 5 .
  4. 10 .

17.Arduino digital pins default to …… , so they don’t need to be explicitly declared as …… with pinMode().

  1. Analog .
  2. Digital .
  3. Input .
  4. Output .

18.The typical baud rate for communicating with the computer is ….. although other speeds are supported.

  1. 4800 .
  2. 9600 .
  3. 38400 .
  4. 115200 .

Enumerate:
1. Arithmetic Operators

2. Datatypes in C

3. Compound Statements

4. Comparisson Operators

5. Logical Operators

6. Flow Controls

7. Digital i/o