Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign output address %Q0.1 to the motor start coil.
PLC Programming
MotorStart := [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using input address %I0.1 instead of output %Q0.1
Using memory bit %M0.1 which is not an output
Using wrong output byte like %Q1.0
✗ Incorrect
The output address %Q0.1 correctly refers to the first output byte, bit 1, which is used for output coils like MotorStart.
2fill in blank
mediumComplete the code to turn on the output at address %Q2.3.
PLC Programming
Outputs[[1]] := TRUE;Attempts:
3 left
💡 Hint
Common Mistakes
Using %Q2.3 inside array index which is invalid
Swapping byte and bit numbers like 3.2
Using Q2.3 without % which is not standard
✗ Incorrect
When using an array or bit addressing, the index is given as '2.3' meaning byte 2, bit 3. The %Q prefix is not used inside the array index.
3fill in blank
hardFix the error in the output assignment to %Q1.7.
PLC Programming
OutputBit := [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using input address %I1.7 instead of output
Using memory bit %M1.7 instead of output
Omitting % in address
✗ Incorrect
The correct output address uses %Q prefix. %I is input, %M is memory bit, and Q1.7 without % is invalid.
4fill in blank
hardFill both blanks to create a mask for output byte 3 to set bit 5.
PLC Programming
Mask := 1 [1] 5;
Attempts:
3 left
💡 Hint
Common Mistakes
Using right shift >> which moves bits the wrong way
Using subtraction instead of addition
Mixing up operators order
✗ Incorrect
To set bit 5, shift 1 left by 5 bits (1 << 5).
5fill in blank
hardFill all three blanks to create a dictionary mapping output names to addresses with condition bit 2 set.
PLC Programming
outputs = { [1]: [2] for [3] in output_list if ([2] & (1 << 2)) != 0 }Attempts:
3 left
💡 Hint
Common Mistakes
Using same variable for key and loop variable
Using wrong variable names causing errors
Not matching variable names in condition
✗ Incorrect
We map each output name to its address. The loop variable is 'output'. The condition checks if bit 2 of address is set.
