Questions and CORRECT Answers
True or false: Learning the concepts, logic and problem solving of programming unlocks our
ability to learn knew languages. - CORRECT ANSWER - True
Reliability speaks to how easily a programmer can express themselves reliably within the
language. - CORRECT ANSWER - False
Is sort orthogonality one-to-many, many-to-many, or a general lack of restriction? - CORRECT
ANSWER - One-to-many
Is compositional orthogonality one-to-many, many-to-many, or a general lack of restriction? -
CORRECT ANSWER - Many-to-many
Is number orthogonality one-to-many, many-to-many, or a general lack of restriction? -
CORRECT ANSWER - General lack of restriction on reproducing features in your code
What does one-to-many mean? - CORRECT ANSWER - if you can combine one command in
a set of command with another command in another
What does many-to-many mean? - CORRECT ANSWER - if you can combine all the
commands in one set with all commands in another set
If I have set of commands S1 that describe data types in my language and a set of commands S2
that describe creation of variables:
S1: int, decimal, bool
S2: <type> <name>, <type> <name> = <value>, constant <type> <name> = <value>
,The set S3: int <name>, int <name> = <value>, constant int <name> = <value> -- demonstrates
what kind of orthogonality? - CORRECT ANSWER - Sort orthogonality
Sort Orthogonality is _ - CORRECT ANSWER - one-to-many
Compositional Orthogonality is: - CORRECT ANSWER - many-to-many
Number orthogonality is: - CORRECT ANSWER - General lack of restriction on reproducing
features in your code
Syntax Error asks what? - CORRECT ANSWER - Is the statement built correctly?
Context Error asks what? - CORRECT ANSWER - Is the statement built from the right stuff?
Semantic Error asks what? - CORRECT ANSWER - Is the program doing the right things?
PEBCAK Error is what? - CORRECT ANSWER - When the user/programmer is being stupid
True or False: In Backus Naur Form, non-terminals contained in () are required in the syntax. -
CORRECT ANSWER - False
True or False: Backus Naur Form allows for recursive definitions of non-terminal symbols. The
definitions are usually separated with a | (aka a "pipe"). - CORRECT ANSWER - True
Which command will have a loop when expressed in a syntax graph?
1. while-loop
2. if-then-else
3. switch
,4. if-then - CORRECT ANSWER - switch
Which of the following cannot be checked by an imperative or object-oriented compiler. (Check
all that applies.)
1. Lexical
2. Semantics
3. Contextual
4. Syntactic - CORRECT ANSWER - Semantics
If your program was designed to print "Hello World" ten (10) times, but during execution, it
printed eleven (11) times. What type of error is it? - CORRECT ANSWER - Semantics error
Which commands (constructs) do NOT have a loop when expressed in syntax graphs? Select all
that apply
1. if-then-else
2. while (condition) do {statements;}
3. switch (expr) { case value: statements ;}
4. for ( <init-expr>; <test-expr>; <increment-expr> ) {<statements>} - CORRECT
ANSWER - 1, 2, 4
Given Very Simple Programming Language (VSPL):
<char> ::= a | b | c | ... | z | 0 | 1 | ... | 9
<operator> ::= + | - | * | / | % | < | > | == | >= | <=
<variable> ::= <char> | <char> <variable>
<expr> ::= <variable> <operator> <variable> | ( <expr> ) <operator> ( <expr> )
<assign> ::= <variable> = <expr>;
<statements> ::= <assign> | <assign> <statements>
, Is the following valid?
my_int = int1 + int2; - CORRECT ANSWER - No, not valid because of the underscore. To be
valid, the underscore would have to be in the VSPL symbols
Given Very Simple Programming Language (VSPL):
<char> ::= a | b | c | ... | z | 0 | 1 | ... | 9
<operator> ::= + | - | * | / | % | < | > | == | >= | <=
<variable> ::= <char> | <char> <variable>
<expr> ::= <variable> <operator> <variable> | ( <expr> ) <operator> ( <expr> )
<assign> ::= <variable> = <expr>;
<statements> ::= <assign> | <assign> <statements>
Is the following valid?
myvar = (x + y) * (a - c); - CORRECT ANSWER - Yes. variable = expression (operator)
expression. (Reminder: | means or)
Given Very Simple Programming Language (VSPL):
<char> ::= a | b | c | ... | z | 0 | 1 | ... | 9
<operator> ::= + | - | * | / | % | < | > | == | >= | <=
<variable> ::= <char> | <char> <variable>
<expr> ::= <variable> <operator> <variable> | ( <expr> ) <operator> ( <expr> )
<assign> ::= <variable> = <expr>;
<statements> ::= <assign> | <assign> <statements>
Is the following valid?