Quiz 2 Flashcards

Quiz from 4 to 6 (3 cards)

1
Q

The Fruit Basket

Ask the user to enter fruits and quantities until they type ‘done’. Print them in reverse order.

Input:
Apples 14
Oranges 12
Banana 28
Avocado 30
Mango 5
done

Output:
Mango Quantity: 5
Avocado Quantity: 30
Banana Quantity: 28
Oranges Quantity: 12
Apples Quantity: 14

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Ohm’s Law

Ask the user to enter voltage and resistance with units. Calculate and print current with appropriate unit (A or mA).

Input:
Enter voltage: 20V
Enter Resistance: 120ohms

Output:
Current: 16.67mA

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Binary Coded Decimal (BCD)

Ask the user to input Mode (1 for BCD to Binary, 2 for Binary to BCD), then a number to convert.

Input:
Enter Mode (1 or 2): 2
Enter Number: 1234

Output:
Enter Mode (1 or 2): 2
Enter Number: 0001 0010 0011 0100

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly