Retro C++ quiz #52

Given the following C code

#include <stdio.h>

int main(void) {
for (size_t i=0;i<6;++i) {
typedef int VLA[i++];
printf("%zu",i);
}
}

W/o checking what is the output?

A. 012345
B. 135
C. ¯\_(ツ)_/¯ undefined behavior
D. Varies on standard version

#CPolls
#cpppolls
#Programming

A
14.8%
B
33.3%
C
33.3%
D
18.5%
Poll ended at .

Retro C++ quiz #46

Given the following in C:

unsigned short x=0xFFFF,y=0xFFFF;

Without checking, assuming LP64. What is the correct format specifier X below and result:

printf( “%X\n”, x*y);

% | result
=========
A. d | -131071
B. u | 4294836225
C. d | UB
D. u | UB

#CPolls
#Programming

A
13%
B
37%
C
34.8%
D
15.2%
Poll ended at .

Retro C++ quiz #43

Given the following in C and C++:

int f() {
char arr[100];
return sizeof(0, arr);
}

w/o checking, the results of f(), assuming LP64

https://ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbcpx01/datatypesize64.htm

are:

C| C++
========
A. 8 | 8
B. 100 | 100
C. 8 | 100
D. 100 | 8

#Cplusplus
#Cpppolls
#CPolls

A
26.3%
B
21.1%
C
31.6%
D
21.1%
Poll ended at .
ILP32 and LP64 data models and data type sizes