WorksheetsPLTW CIM-Lesson 1.2/Control Systems(Part 2: RobotC)
Total questions: 71
Worksheet time: 49mins
When is the while loop TRUE in the code shown?
Never
Always
When hit bumpSwitch
When hit limitSwitch
The Ultrasonic Range Finder (sonar) can measure in
mm
cm
in
all of these
All of these are digital sensors except?
bumpswitch
light sensor
shaft encoder
ultrasonic range finder
The value range associated with the limit switch is?
-127 to 127
0 to 127
-1 to 1
0 or 1
An axle in your optical shaft encoder rotated exactly 1 revolution. How can you know this by looking at sensor data?
it changed from 0 to 1
it increased by 3.14 times
it shows a change of 360
it can't be known by looking at the data
One of the first things you should do every day after opening the ROBOTC software is:
check your Instagram
snap your finger
give a high five to your classmate
update the firmware
Comments in RobotC are what color text?
Blue
Green
Orange
Red
This shape represents what in a flowchart?
Decision
Process
Input/Output
Start or Stop
A motor can be reversed by_____________.
Standing on my head and looking at the motor upside down
changing the sign (+/-) of the speed in the program
Check "Reverse" in Motors & Setup
turn the motor with my LEFT hand instead of my right hand
Which battery condition allows the fastest motor rotation?
50% charged
75% charged
100% charged
charged to my credit card
Find the error in this RobotC code.
turnLEDOff(red);
turnLEDOff(yellow)
turnLEDOff(green);
turnLEDOn(red);
untilTouch(touchSensor);
turnLEDOff(red);
Missing a parameter
Missing a semicolon
Reversed parameters
Wrong notation for name of sensor/command
What programming language does RobotC use?
CC
C++
C#
C
What is the purpose of the line 'task main() followed by { }'?
It's a comment used to define the main scope
Sets up multitasking
Sets up a program's main task only
Sets up a program's main task and scope
What is the purpose of the 'while(true)' statement?
creates a finite loop to check for changes in your VEX components a number of times
creates an infinite loop to check for mistakes in the program functions
creates a finite loop to check for mistakes in the program functions
creates an infinite loop to continually check for changes in your VEX components
Which is NOT an acceptable example of an infinite loop?
while(true)
while(1==1)
while(not false)
while(55==55)
What do '#Pragma config()' statements do?
Update the VEX Cortex firmware
Downloads the code to your robot
They configure settings which live in their own section of flash memory that is outside of your program code. They are available as soon as the microcontroller gets power, regardless where they are written in your code. This is important because sometimes they are needed before your program is executed.
not sure
A pragma config command for VEX robot motors contain either 5 or 6 arguments. Which is NOT a one of these arguments?
port type
button or channel
component type
component orientation
component name
What do these lines of code do?
motors for ports 2 and 5 half power in reverse, motors for ports 3 and 4 half power, only while button 6-d is pressed
motors for ports 3 and 4 full power in reverse, motors for ports 2 and 5 full power, only if button 6-d is pressed
motors for ports 2 and 5 half power in reverse, motors for ports 3 and 4 half power, only if button 6-d is pressed
motors for ports 2 and 5 full power in reverse, motors for ports 3 and 4 full power, only when button 6-d is pressed
3000 milliseconds is the same as
3 minutes
3 hours
3 seconds
3ml
Statements run in English reading order. As soon as one command is complete, the next runs.
(right-to-left, top-to-bottom).
(left-to-right, bottom-to-top).
(left-to-right, top-to-bottom).
(right-to-left, bottom-to-top).
When the program runs out of statements and reaches the ____ symbol in task main, all motors stop, and the program ends.
]
;
{
}
How does RobotC know where one statement ended and the other began?
It knows because of the semicolon at the end of each line.
It knows because of the curly brackets at the end of each line.
It knows because of the square brackets at the end of each line.
It knows because of the bracket at the end of each line.
Every __________________ ends with a semicolon. It’s like the period at the end of a sentence.
sentence
code
statement
option
Every punctuation pair consists of an “_______” punctuation mark and a “________” punctuation mark.
"first" "last"
"starter" "ending"
"initial" "ending"
"opening" "closing"
Different commands make use of different punctuation. The motor command uses square brackets and the wait1Msec command uses _____________.
curly brackets
parentheses
square brackets
semi-colon
The control structure “___________” directs the program to the main body of the code. When you press “Start” or “Run” on the robot, the program immediately goes to task main and runs its code.
task main
starting up
main body
body start
The left and right curly braces { } belong to the_________structure. They surround the commands which will be run in the program
running
main body
command
task main
Normally, statements run only once, but with a __________, they can be told to repeat over and over for as long as you want
while loop
repeater
duplicator
infinity runner
Statements are commands to the robot. Each statement is also usually written on its own line to make it ________.
easier for the robot to read
organized
neat
easier for humans to read.
A program is
A logical and step-by-step set of directions for the robot to follow.
A logical and step-by-step set of directions for the programmer to follow.
A set of directions, written in paragraph form, that even a robot can follow.
D. None of the answers are correct.
Pseudocode is
A false code
A code, written in English, that the robot can understand.
A code, written in binary language, that the robot can understand.
A set of basic steps that the human can use to plan the program.
________ are a convenient way to talk about what the robot is doing and what it must do to carry out the plan created by the programmer.
Operations
Actions
Behaviors
Instructions
Which of the following is a reason that programmers use pseudocode?
It keeps the plan for the program organized.
Writing out the exact code commands takes too much time.
It allows people who can’t read code to understand the plan for the program.
All of the answers are true.
If one of a paired punctuation such as parentheses is missing:
The robot will assume that it is there and continue running
The program will not compile and the programmer will see an error message
The program will bypass that statement
The program will delete the paired punctuation that is not missing
A multiline comment ends with:
The pressing of the Enter key
A single slash /
An asterisk and a slash */
Two slashes //
Where do you start writing your code?
1
2
3
4
How will behave the robot within these codes below?
motor[leftMotor] = 0;
motor[rightMotor] = 100;
Move Forward
Move Backward
Turn Right
Turn Left
How will behave the robot within these codes below?
motor[leftMotor] = 100;
motor[rightMotor] = 0;
Move Forward
Move Backward
Turn Right
Turn Left
How will behave the robot within these codes below?
motor[leftMotor] = 100;
motor[rightMotor] = 100;
Move Forward
Move Backward
Turn Right
Turn Left
What does == mean?
Is equal to
is not equal to
greater than
less than
What does != mean
is equal to
is not equal to
greater than
less than
What does <= mean
Is equal to
is not equal to
is less than or equal to
is greater than or equal to
What does && mean?
Is equal to
Next
OR
AND
What does || mean?
A Wall
A Path
And
OR
What does the following line of code do?
int speed;
Nothing
Sets the speed
Assign the variable speed as an integer
not allowed in Robotc
Of the options available, to get the robot to move in a circle, you would:
Use the MotorCirlce command
Turn on only one motor
Assure that the Wait1Msec command was at least 3000
Make sure that the motor is connected to Port 1
If you wanted your robot to move for 5 seconds you would use the _____ command
wait1sec (5000);
wait1sec (5);
wait1Msec (5);
wait1Msec (5000);
Assuming the Motors and Sensors Setup has been properly configured, which robot behaviors will this piece of code cause the robot to perform?
Pivot Turn Left / Pivot Turn Right
Forward / Reverse
Swing Turn Left / Swing Turn Right
Value of touch sensor when not pressed
0
1
63
127
True or False: If I change this program's power, I must also change its wait time?
True
False
True or False: This program does not require a wait1Msec() command.
True
False
Using a standard tire, how many degrees should be programmed for the robot to travel 100 cm?
1300
360
2107
2046
Which is an example of pseudocode?
What is pseudocode?
Shorthand notation for programming which uses a combination of informal programming structures and verbal descriptions of code.
Set of instructions that control the operation of a computer.
Anything your robot does
Which of the following are rules for Variable Names?
A variable name can not have spaces in it
A variable name can have symbols in it
A variable name can not start with a number
A variable name can not be the same as an existing reserved word
Which of the following are proper Variable Names?
line counter
distance3
timeCounter
time1[T1]
Which data type has positive and negative whole numbers, as well as zero?
String
integer
Boolean
Floating Point Decimal
Which data type has a string of characters that can include numbers, letters, or typed symbols?
integer
string
boolean
floating point decimal
Which data type uses True or False and is useful for expressing the outcomes of comparisons?
floating point decimal
integer
string
boolean
Which one is the correct description of the following statement?
sum = variable1 + variable2;
Adds the value in “variable1” to the value in “variable2”
stores the result in the variable “sum”
Adds the value in “variable1” to the value in “variable2”, and stores the result in the variable “sum”
Adds the sum of variable 2 and 2 as the increment
Which is the correct description for the following statement?
count = count + 1;
Adds 1 to the current value of “count” and places the result back into “count” (effectively, increases the value in “count” by 1)
Adds 1 to the current value of “count” and places the result back into “count” (effectively, increases the value in “count” by 2)
Adds the current value of “count” to 1 and places the result plus one back into “count” (effectively, increases the value in “count” by 2)
Which one is the most correct description of the following statement?
int zero = 0;
Add zero as the integer
(combination declaration and assignment statement)
Creates the variable x with an initial value of 0 (combination declaration and assignment statement)
Declare zero as an integer
Declare zero as an initial integer
