MCQ Modul.08
Correct ans.
Correct ans.
Question 1
1 / 1 pts
Choose the right phrase to make the statement true: When a variable declaration starts with...
Choose the right phrase to make the statement true: When a variable declaration starts with...
const int c ...
...a pointer to such a variable could not be taken in any way
Correct!
...the only way of setting its value is doing it through its initializer
...it could not be passed as an argument to any function
...a compiler protects it from all indirect modifications
Question 2
1 / 1 pts
The pointer named p, declared in the following way, is a:
char * const p = "";
the declaration is invalid
Correct!
const-qualified pointer to char
const-qualified pointer to const-qualified char
pointer to const-qualified char
Question 3
1 / 1 pts
The following snippet:
int v = 1;
const int *p = &v;
may cause compiler warning
Correct!
is fully correct
may cause runtime error
will cause compiler error
Question 4
1 / 1 pts
The following function:
void f(int i) {
int n = i;
if(n < 10) {
here:
i++;
goto here;
}
}
is fully correct
will cause runtime error
incorrectly uses the goto statement and will cause compilation error
Correct!
will cause infinite loop
Question 5
1 / 1 pts
One of the following statements is false ‑ which one?
the goto jump may not lead to the outside of compound statement
Correct!
the goto jump may lead to the outside of a function
the goto jump may not lead to the inside of a function
the goto jump may not lead to the inside of compound statement
Question 6
1 / 1 pts
The setjmp() function behaves as it had:
more than one entry and one exit
more that one entry and more then one exit
Correct!
one entry and more then one exit
one entry and one exit
Question 7
1 / 1 pts
Assuming the following f() function's declaration, point the correct example of its invocation:
void f(char s[1\]);
f("a")
Correct!
f("")
f("ab")
f("abc")
Question 8
1 / 1 pts
A syntax used in the following snippet is named:
char s[2\] = { [1\] = 'a', [0\] = 'b' };
indexed initializer
Correct!
designated initializer
enumerated initializer
free initializer
Question 9
1 / 1 pts
The two commonly used assembly language syntax conventions are named:
AT&T and Bell
Motorola and Intel
Correct!
AT&T and Intel
Bell and Motorola
Question 10
1 / 1 pts
The place where previous side effects have occurred already and none of next side effects have occurred yet is named:
characteristic point
compound point
local point
Correct!
sequence point
Question 11
1 / 1 pts
The following function prototype...
int doit(const int *);
...requires the argument to be const qualified pointer
...requires the argument to be a pointer to const qualified value
...requires the argument to be literal
Correct!
...is a promise that the argument won't be modified during invocation
Question 12
1 / 1 pts
Select the false statement:
Correct!
a variable must not be const and volatile at the same time
a compiler will avoid storing the const-volatile variable in CPU registers
a const-volatile variable must not be explicitly modified in the code containing its declaration
a const-volatile variable may be implicitly modified by the background process
Question 13
1 / 1 pts
The following snippet:
int const v = 1;
int const * const p = &v;
Correct!
is fully correct
will cause compiler error
may cause compiler warning
may cause runtime error
Question 14
1 / 1 pts
The following function:
int f(int i) {
if(i == 0) goto 123;
i++;
123:
return i;
}
will cause infinite loop
Correct!
will cause compilation error
is fully correct
will cause runtime error
Question 15
1 / 1 pts
Complete the sentence to make it true: When a function is declared in the following way:
int fun(int restrict *v1, int *v2) { ... }
the executable code is expected to be longer
the compiler will check if v1 and v2 don't cover the same memory area
the execution time will be longer
Correct!
the programmer is obliged to ensure that v1 and v2 don't cover the same memory area
Question 16
1 / 1 pts
What should be placed instead of question marks to make the code working properly?
int main(void) {
if(setjmp(buf) ?? 0)
f();
else
puts("returned from long jump");
return 0;
}
<
Correct!
==
>
!=
Question 17
1 / 1 pts
Assuming the following f() function's declaration, point the correct example of its invocation containing the shortest argument
void f(char s[static 3\]);
f("")
Correct!
f("ab")
f("abc")
f("a")
Question 18
1 / 1 pts
Which of the following headers is valid?
int f(int T[2\][2\][static 2\])
Correct!
int f(int T[static 2\][2\][2\])
int f(int T[2\][static 2\][2\])
int f(int T[static 2\][2\][static 2\])
No comments:
Post a Comment