Which function repeats consecutively until Arduino is turned off?a) Loop()b) Setup()c) delay()ANS: Loop()
Which function is used to remove all elements from the set?a) clear()b) update()c) remove()ANS: clear()
On the palette under which selection will you find a Button?a) User Interfaceb) sensorsc) LayoutANS: User Interface
Steps to start a new project in App Inventor:
Open App Inventor and sign in with your Google account.
Click on "Create Apps!" and select "Start a New Project".
Enter a project name (e.g., "MyFirstApp") without spaces.
Open the Designer Window:
Drag and drop components (Buttons, Labels, TextBoxes) onto the screen.
Switch to the Blocks Editor:
Click on the "Blocks" button.
Use the Blocks Editor to add logic using drag-and-drop code blocks.
Test Your App:
Using Emulator: Connect via Emulator.
Using Phone: Install MIT AI2 Companion app and connect via Wi-Fi or USB.
Save and Export Your App:
Click Build > App (APK) to generate the app.
Download and install on your Android device.
Arduino Components and Their Uses:
Arduino Controller: A microcontroller board like Arduino Uno.
Jumper Wires: Used to make connections.
Resistors: Limit current flow to protect components like LEDs.
setup() and loop() Functions in Arduino:
setup() Function: Initializes components once.
Example:
void setup() {
pinMode(13, OUTPUT);
}
loop() Function: Executes main logic continuously.
Example:
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Program to display odd numbers from 51 to 61 using loops:
For Loop:
print("Odd numbers from 51 to 61 using for loop:")
for i in range(51, 62, 2):
print(i)
While Loop:
print("Odd numbers from 51 to 61 using while loop:")
i = 51
while i <= 61:
print(i)
i += 2
Define set and its operations:
A set is an unordered collection of unique elements, used for storing multiple values without duplicates.
Creating a set:
my_set = {1, 2, 3, 4, 5}