logo

Crowdly

Browser

Додати до Chrome

Questions Bank (1475304 total)

Given the following code fragment:

// Assume the 64-bit GCC compiler provides storage for array a 

// and variable p at addresses 100 and 200, respectively

int a[] = { 5, 8, 3, 2, 1, 9, 0, 4, 7, 6 }, *p = a + 2;

evaluate expression -3[p]. If the expression cannot be compiled, write [for compile-time error]. If the expression generates undefined behavior, write [for undefined behavior]. Otherwise, write the exact value resulting from the expression's evaluation.

Brief side-note on undefined behavior: The C standard says that statements such as c = (b = a + 2) - (a = 1); and c = (b = a + 2) - (a = 1); cause undefined behavior [because we don't know whether the left or right operand of operator - is evaluated first]. When a program ventures into the realm of undefined behavior, all bets are off. The program may behave differently when compiled with different compilers. But that's not the only thing that can happen. The program may not compile in the first place, if it compiles it may not run, and if it does run, it may crash, behave erratically, or produce meaningless results. In other words, undefined behavior should be avoided like the plague.

Переглянути це питання

У реченні "До роботи по впорядкуванню парків долучаються всі охочі" є помилка.

98%
2%
Переглянути це питання

У реченні "Наша компанія повністю забезпечена освідченими кадрами" є помилка.

94%
6%
Переглянути це питання

У реченні "Усі пропозиції громадян по вдосконаленню роботи нами ретельно аналізуються" є помилка.

95%
5%
Переглянути це питання

У реченні "На виборчі дільниці прийшло лише 52 відсотка виборців" є помилка.

93%
7%
Переглянути це питання

У реченні "Про останні події у світі ми дізнаємося з преси" є помилка.

19%
81%
Переглянути це питання

У реченні "Результати перевірки будуть оголошені по її закінченні " є помилка.

94%
6%
Переглянути це питання

У реченні "На митниці від нас вимагали супроводжуючі документи" є помилка

95%
5%
Переглянути це питання

У реченні "Для вирішення проблеми треба було співставити факти" є помилка.

93%
7%
Переглянути це питання

У реченні "Я вчасно прийшов на зустріч з Іваном Петровичом" допущено помилку.

94%
6%
Переглянути це питання