Variable declarations require a colon ':' between name and type.
Step 2: Check given code for syntax errors
The code misses ':' after Temperature before INT, causing syntax error.
Final Answer:
Missing colon ':' between variable name and type -> Option A
Quick Check:
Colon required between name and type [OK]
Hint: Always put ':' between variable name and type [OK]
Common Mistakes:
Omitting colon ':'
Assuming END_VAR is optional
Thinking variable names must be lowercase
5. You want to declare two variables in a PLC program: Count as an integer starting at 0, and Status as a boolean starting as TRUE. Which is the correct declaration?
hard
A. VAR
Count INT := 0;
Status BOOL := TRUE;
END_VAR
B. VAR
Count : INT := 0;
Status : BOOL := TRUE;
END_VAR
C. VAR
Count : INT;
Status : BOOL;
END_VAR
Count := 0; Status := TRUE;
D. VAR
Count : INTEGER = 0;
Status : BOOLEAN = TRUE;
END_VAR
Solution
Step 1: Check syntax for multiple variable declarations with initialization
Each variable must have name, colon, type, and optional initialization with := inside VAR...END_VAR.
Step 2: Evaluate each option's correctness
VAR
Count : INT := 0;
Status : BOOL := TRUE;
END_VAR correctly uses colon, types INT and BOOL, and initializes with := 0 and := TRUE. Others have syntax errors or wrong type names.
Final Answer:
VAR
Count : INT := 0;
Status : BOOL := TRUE;
END_VAR -> Option B
Quick Check:
Use colon and := for initialization inside VAR block [OK]
Hint: Declare and initialize variables inside VAR...END_VAR with := [OK]
Common Mistakes:
Using '=' instead of ':=' for initialization
Omitting colon ':' between name and type
Using wrong type names like INTEGER or BOOLEAN
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.