1. The von Neumann bottleneck is caused by: a. the connection between a computer
ID: 3548757 • Letter: 1
Question
1. The von Neumann bottleneck is caused by:
a. the connection between a computer's memory and its processor.
b. inherent inefficiencies in compilers.
c. slow disk access caused by mechanical inefficiencies.
d. several programs trying to concurrently access a disk.
3. Write a BNF description for the C++ if statement. Assume the following are already defined:
stmt: a single statement (not including any semicolon)
stmts: one or more statements (including each statement's following semicolon)
expression: an expression (suitable for a condition)
Make sure your description allows for if statements with a single statement in the "body" of the if, and for those with multiple statements. Remember to include all syntax elements, including braces and semicolons.
4. Consider each of the following examples of axiomatic semantics:
a. {num >= 100} d = num * 3 {d >= 300}
b. {value > 10} result = value + 1 {result > 0)
Which example follows the principle of using the weakest precondition? Explain. Change the other example's precondition so that it is the weakest precondition.
while x <= 10 do x = x + 1; y = y + 1 end {y = 20}
For this statement and postcondition, create a valid precondition, and explain how you arrived at your answer.
int* maker()
{
int x;
int *pInt;
x = 3;
pInt = new int;
*pInt = x;
return pInt;
}
9. According to the text, a language is strongly typed if:
a. it is specifically designed for one purpose
b. type errors are always detected
c. the type for all variables must be declared
d. it uses coercion to force agreement of operators
10. Consider the following program:
program main;
var x, y, z : integer;
procedure sub1;
var a, y, z : integer;
procedure sub2;
var a, b, z : integer;
begin { of sub2 }
{ sub2 processing }
end; { of sub2 }
begin { of sub1 }
{ sub1 processing }
end;
procedure sub3;
var a, x, w : integer;
begin { of sub3 }
{ sub3 processing }
end; { of sub3 }
begin { of main }
{ main processing }
end.
List all variables, along with the program units where they are declared, that are visible in the bodies of sub1, sub2, and sub3. Assume static scoping is use
Explanation / Answer
Give an example of C++ code that creates an alias. template auto g(Args&&... args) -> decltype(f(std::forward(args)...)) { return f(std::forward(args)...); }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.