A tier-2 help desk technician is updating a Python script that configures remote network monitoring. The script attempts to concatenate a string variable containing a host domain name with an integer variable representing a service port number, resulting in a runtime error. Which basic scripting concept must the technician apply to fix this error?
- Data types and type castingAnswer
- BEnvironment variable expansion
- CConditional branch evaluation
- DCommand-line switch parsing
Answer
Data types and type casting
The option specifying data types and type casting is correct because programming and scripting languages distinguish between different data representations, such as strings (text) and integers (numbers). Attempting to join a string and an integer directly causes a type mismatch error unless explicit or implicit type casting is used to convert the integer to a string.
Step-by-Step Solution
Key Concept
Data Types and Type Conversion in Scripting