C173 Scripting and Programming Foundations Questions with and
Answers with Verified Solutions | Latest 2026 Update
Q: return <value> Specifies the value to be returned by a function back to its
function call
Answer:
def <Name>(<Parameters>): Defines a function in Python.
terminal A value that cannot be broken down further. Once you get to a terminal
there is
nothing else you can replace it with. In programming grammar, these never appear
on the left
side of a rule.
non-terminal A value that can be reduced further by the grammar rules until it is
reduced to
a terminal value.
cost (time,memory) depends on the input.
worst case When analysing programs it's the worst-case execution time that is
important.
The worst-case execution time is the time it takes for the case where the input for a
given size
takes the longest to run
, Q: Making lookup Faster hash function. Given a keyword, the hash function will
tell you where
Answer:
to look in the index. It will map the keyword to a numbe
Expression → Expression Operator Expression Expression → Expression Operator
Expression
Logical Operators 1. NOT is evaluated first
2. AND is evaluated next
3. OR is evaluated last
NOT Evaluator The Logical NOT Operator is used to reverse the logical state of its
operand.
For example, if a condition is evaluated to false then the Logical NOT operator will
make the
answer true. Here are a few examples:
not True → False
not False → True
not (True and False) → True
not (True or False) → False
AND Evaluator When work with AND evaluator, if the first expression evaluates to
false,
then the second expression is ignored and the entire statement evaluates to false.
Here are a
few examples:
false AND true → false
Answers with Verified Solutions | Latest 2026 Update
Q: return <value> Specifies the value to be returned by a function back to its
function call
Answer:
def <Name>(<Parameters>): Defines a function in Python.
terminal A value that cannot be broken down further. Once you get to a terminal
there is
nothing else you can replace it with. In programming grammar, these never appear
on the left
side of a rule.
non-terminal A value that can be reduced further by the grammar rules until it is
reduced to
a terminal value.
cost (time,memory) depends on the input.
worst case When analysing programs it's the worst-case execution time that is
important.
The worst-case execution time is the time it takes for the case where the input for a
given size
takes the longest to run
, Q: Making lookup Faster hash function. Given a keyword, the hash function will
tell you where
Answer:
to look in the index. It will map the keyword to a numbe
Expression → Expression Operator Expression Expression → Expression Operator
Expression
Logical Operators 1. NOT is evaluated first
2. AND is evaluated next
3. OR is evaluated last
NOT Evaluator The Logical NOT Operator is used to reverse the logical state of its
operand.
For example, if a condition is evaluated to false then the Logical NOT operator will
make the
answer true. Here are a few examples:
not True → False
not False → True
not (True and False) → True
not (True or False) → False
AND Evaluator When work with AND evaluator, if the first expression evaluates to
false,
then the second expression is ignored and the entire statement evaluates to false.
Here are a
few examples:
false AND true → false