Bird
Raised Fist0
PLC Programmingscripting~20 mins

Program organization units (POU) in PLC Programming - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
POU Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of a POU call sequence
Given the following PLC program organization units (POUs), what will be the final value of the variable counter after execution?
PLC Programming
FUNCTION_BLOCK FB1
VAR
  counter : INT := 0;
END_VAR

METHOD Increment
  counter := counter + 1;
END_METHOD

PROGRAM Main
VAR
  fb1_inst : FB1;
END_VAR

fb1_inst.Increment();
fb1_inst.Increment();
fb1_inst.Increment();
AError: counter not accessible
B3
C0
D1
Attempts:
2 left
💡 Hint
Think about how many times the Increment method is called and how it changes the counter.
📝 Syntax
intermediate
2:00remaining
Identify the correct POU declaration syntax
Which of the following is the correct way to declare a FUNCTION POU named CalculateSum that takes two INT inputs and returns their sum as INT?
A
FUNCTION CalculateSum : INT
VAR_INPUT
  a : INT;
  b : INT;
END_VAR
CalculateSum := a + b;
END_FUNCTION
B
FUNCTION CalculateSum
VAR_INPUT
  a : INT;
  b : INT;
END_VAR
RETURN a + b;
END_FUNCTION
C
FUNCTION CalculateSum : INT
VAR
  a : INT;
  b : INT;
END_VAR
CalculateSum := a + b;
END_FUNCTION
D
FUNCTION CalculateSum : INT
VAR_INPUT
  a, b : INT;
END_VAR
CalculateSum = a + b;
END_FUNCTION
Attempts:
2 left
💡 Hint
Remember that inputs must be declared in VAR_INPUT and the function name is assigned the return value.
🔧 Debug
advanced
2:00remaining
Find the error in this FUNCTION_BLOCK POU
What error will occur when compiling this FUNCTION_BLOCK POU code?
PLC Programming
FUNCTION_BLOCK FB_Timer
VAR
  startTime : TIME;
  elapsed : TIME;
END_VAR

METHOD Start
  startTime := TIME();
END_METHOD

METHOD GetElapsed : TIME
  GetElapsed := TIME() - startTime;
END_METHOD
ANo error, code compiles successfully
BRuntimeError: startTime not initialized
CSyntaxError: TIME() is not a valid function call
DSyntaxError: Missing semicolon after GetElapsed assignment
Attempts:
2 left
💡 Hint
Check the end of each statement carefully for punctuation.
🚀 Application
advanced
2:00remaining
Determine the number of instances created
In a PLC program, if you declare the following PROGRAM and FUNCTION_BLOCK instances, how many total instances of FB_MotorControl exist during runtime?
PLC Programming
FUNCTION_BLOCK FB_MotorControl
VAR
  speed : INT;
END_VAR

PROGRAM Main
VAR
  motor1 : FB_MotorControl;
  motor2 : FB_MotorControl;
  motor3 : FB_MotorControl;
END_VAR

PROGRAM Secondary
VAR
  motorA : FB_MotorControl;
END_VAR
A4
B0
C1
D3
Attempts:
2 left
💡 Hint
Count all declared instances across all programs.
🧠 Conceptual
expert
2:00remaining
Understanding POU execution order in cyclic tasks
In a PLC cyclic task, if you have multiple PROGRAM POUs scheduled in the same task, which statement best describes their execution order?
AAll PROGRAM POUs execute simultaneously in parallel.
BExecution order is random and changes each cycle.
CPROGRAM POUs execute sequentially in the order they are listed in the task configuration.
DOnly the first PROGRAM POU executes; others are ignored.
Attempts:
2 left
💡 Hint
Think about how PLC tasks manage multiple programs in a cycle.

Practice

(1/5)
1. Which of the following is NOT a type of Program Organization Unit (POU) in PLC programming?
easy
A. MODULE
B. PROGRAM
C. FUNCTION
D. FUNCTION_BLOCK

Solution

  1. Step 1: Recall POU types

    The three main POUs are PROGRAM, FUNCTION_BLOCK, and FUNCTION.
  2. Step 2: Identify the incorrect option

    MODULE is not a standard POU type in PLC programming.
  3. Final Answer:

    MODULE -> Option A
  4. Quick Check:

    POUs = PROGRAM, FUNCTION_BLOCK, FUNCTION [OK]
Hint: Remember only three POUs: PROGRAM, FUNCTION_BLOCK, FUNCTION [OK]
Common Mistakes:
  • Confusing MODULE with FUNCTION_BLOCK
  • Thinking FUNCTION_BLOCK is not a POU
  • Mixing hardware modules with POUs
2. Which syntax correctly declares a FUNCTION_BLOCK named MotorControl in IEC 61131-3 standard?
easy
A. PROGRAM MotorControl END_PROGRAM
B. FUNCTION MotorControl END_FUNCTION
C. FUNCTION_BLOCK MotorControl END_FUNCTION_BLOCK
D. FUNCTION_BLOCK MotorControl() END_FUNCTION_BLOCK

Solution

  1. Step 1: Identify correct POU declaration syntax

    FUNCTION_BLOCK declaration starts with 'FUNCTION_BLOCK Name' and ends with 'END_FUNCTION_BLOCK'.
  2. Step 2: Check each option

    FUNCTION_BLOCK MotorControl END_FUNCTION_BLOCK matches correct syntax; PROGRAM and FUNCTION declare different POUs; the version with parentheses is invalid.
  3. Final Answer:

    FUNCTION_BLOCK MotorControl\nEND_FUNCTION_BLOCK -> Option C
  4. Quick Check:

    FUNCTION_BLOCK syntax = FUNCTION_BLOCK MotorControl END_FUNCTION_BLOCK [OK]
Hint: FUNCTION_BLOCK has no parentheses in declaration [OK]
Common Mistakes:
  • Adding parentheses to FUNCTION_BLOCK
  • Confusing FUNCTION and FUNCTION_BLOCK syntax
  • Using PROGRAM keyword for function blocks
3. Given the following FUNCTION in a PLC program:
FUNCTION AddTwo : INT
VAR_INPUT
  a : INT;
  b : INT;
END_VAR
AddTwo := a + b;
END_FUNCTION

What is the output of calling AddTwo(3, 5)?
medium
A. 8
B. 35
C. Error: FUNCTION cannot be called like this
D. 0

Solution

  1. Step 1: Understand FUNCTION behavior

    The FUNCTION AddTwo takes two INT inputs and returns their sum.
  2. Step 2: Calculate the output for inputs 3 and 5

    3 + 5 = 8, so the function returns 8.
  3. Final Answer:

    8 -> Option A
  4. Quick Check:

    3 + 5 = 8 [OK]
Hint: Functions return values; sum inputs to get output [OK]
Common Mistakes:
  • Concatenating inputs as strings
  • Thinking FUNCTION_BLOCKs return values
  • Assuming syntax error on call
4. Identify the error in this FUNCTION_BLOCK declaration:
FUNCTION_BLOCK Timer
VAR
  StartTime : TIME;
END_VAR
METHOD Start()
  StartTime := TIME();
END_METHOD
END_FUNCTION_BLOCK
medium
A. METHOD keyword is not allowed inside FUNCTION_BLOCK
B. TIME() is not a valid way to get current time
C. StartTime variable must be VAR_INPUT
D. FUNCTION_BLOCK must not have variables

Solution

  1. Step 1: Check METHOD usage in FUNCTION_BLOCK

    METHODs are allowed inside FUNCTION_BLOCKs to define actions.
  2. Step 2: Verify TIME() usage

    TIME() is not a standard function to get current time in PLC; this causes an error.
  3. Final Answer:

    TIME() is not a valid way to get current time -> Option B
  4. Quick Check:

    Invalid TIME() call = TIME() is not a valid way to get current time [OK]
Hint: Check if functions used are standard PLC functions [OK]
Common Mistakes:
  • Assuming METHODs are disallowed
  • Thinking all variables must be inputs
  • Believing FUNCTION_BLOCKs can't have variables
5. You want to create reusable code that holds internal state and can be called multiple times with different inputs. Which POU type should you choose and why?
hard
A. FUNCTION, because it can be called multiple times with different inputs
B. PROGRAM, because it organizes the entire PLC project
C. FUNCTION, because it returns a value and holds state internally
D. FUNCTION_BLOCK, because it can hold data and be reused with different instances

Solution

  1. Step 1: Understand POU types and their features

    FUNCTION_BLOCKs can hold internal data/state and be instantiated multiple times.
  2. Step 2: Compare with other POUs

    FUNCTIONs return values but do not hold state; PROGRAMs organize code but are not reusable units with state.
  3. Final Answer:

    FUNCTION_BLOCK, because it can hold data and be reused with different instances -> Option D
  4. Quick Check:

    Reusable with state = FUNCTION_BLOCK [OK]
Hint: Use FUNCTION_BLOCK for reusable code with internal state [OK]
Common Mistakes:
  • Choosing FUNCTION for holding state
  • Confusing PROGRAM with reusable unit
  • Ignoring difference between FUNCTION and FUNCTION_BLOCK
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard