База ответов ИНТУИТ

Программирование на языке C в Microsoft Visual Studio 2010

<<- Назад к вопросам

Чему будет равно значение переменной b в результате выполнения приведенной программы?
int main(void){	struct Options {		unsigned int  centerX : 1;		unsigned int centerY : 1;		unsigned int shadow : 2;		unsigned int palette : 4;	};		int b;	struct Options t, *pt;	t.shadow = 10;	t.palette = 12;	b = t.shadow + t.palette;	printf("b = %d\n", b);	return 0;}	

(Отметьте один правильный вариант ответа.)

Варианты ответа
10
12
14(Верный ответ)
22
Похожие вопросы
Чему будет равно значение переменной b в результате выполнения приведенной программы?
int main(void){	struct Options {		unsigned int  centerX : 1;		unsigned int centerY : 1;		unsigned int shadow : 2;		unsigned int palette : 4;	};		int b;	struct Options t, *pt;	t.shadow = 12;	t.palette = 10;	b = t.shadow + t.palette;	printf("b = %d\n", b);	return 0;}	
Чему будет равно значение переменной b в результате выполнения приведенной программы?
int main(void){	struct Options {		unsigned int  centerX : 1;		unsigned int centerY : 1;		unsigned int shadow : 2;		unsigned int palette : 4;	};		int b;	struct Options t, *pt;	t.shadow = 10;	t.palette = 10;	b = t.shadow + t.palette;	printf("b = %d\n", b);	return 0;}	
Чему будет равно значение переменной c после выполнения приведенной программы?
int main(void){	struct test {		unsigned int a : 2;		unsigned int b : 8;	};		int c;	struct test t;	t.b = 255;	t.a = 3;	c = t.b | t.a;	printf("c = %d\n", c);	return 0;}	
Чему будет равно значение переменной c после выполнения приведенной программы?
int main(void){	struct test {		unsigned int a : 2;		unsigned int b : 8;	};		int c;	struct test t;	t.b = 255;	t.a = 3;	c = t.b ^ t.a;	printf("c = %d\n", c);	return 0;}	
Чему будет равно значение переменной t.a после выполнения приведенной программы?
int main(void){	struct test {		unsigned int a : 2;		unsigned int b : 8;	};		int c;	struct test t;	t.b = 255;	t.a = t.b & 3;	printf("t.a = %d\n", t.a);	return 0;}	
Определите, содержит ли приведенная программа ошибки? Если содержит, укажите, какие именно?
int main(void){	struct test {		unsigned int  : 3;		unsigned int f1 : 1;		unsigned int f2 : 1;		unsigned int f3 : 1;		unsigned int type : 8;		unsigned int index : 18;	};		int b;	struct test t, *pt;	pt = &t;	pt->f1 = 11;	t.type = 3439;	b = t.f1 + t.type;	printf("b = %d\n", b);	return 0;}
Определите, содержит ли приведенная программа ошибки? Если содержит, укажите, какие именно?
int main(void){	struct test {		unsigned int  : 3;		unsigned int f1 : 1;		unsigned int f2 : 1;		unsigned int f3 : 1;		unsigned int type : 8;		unsigned int index : 18;	};		int a : 4, b;	struct test t;	t.type = 3439;	b = a + t.type;	//printf("t.type = %d\n", t.type);	return 0;}		
Определите, что делает приведенная программа?
void printBits(unsigned int var);int main (void) {	unsigned int number1, number2;	printf("\n The program on demonstration digit-by-digit operator OR ( | ):\n");	printf("\n\t Enter the unsigned number of N1: ");	scanf_s("%u", &number1);	printf("\t Enter the unsigned number of N2: ");	scanf_s("%u", &number2);	printf("\n\t Binary representation of the number of N1 (%u) and\n", number1);	printf("\t Binary representation of the number of N2 (%u):\n", number2);	printBits(number1);	printBits(number2);	printBits(number1 | number2); 	printf("\n\n Press any key: ");	_getch();	return 0;}void printBits(unsigned int var) {	unsigned int b;	unsigned int num = 1 << 31; 	printf("\n\t %10u = ", var);	for (b = 1; b <= 32; ++b) {		printf("%c", var & num ? '1' : '0');		var <<= 1; 		if (b % 8 == 0)			putchar(' ');	} } 
Определите, что делает приведенная программа?
void printBits(unsigned int var);int main (void) {	unsigned int number, mask;	printf("The program on demonstration digit-by-digit operation And ( & )\n");	printf("Enter a whole number of unsigned: ");	scanf_s("%u", &number);	printf("Enter the number of unsigned-mask: ");	scanf_s("%u", &mask);	printf("Binary representation of the starting number(%u) and\n", number);	printf("Binary representation of the number-masks (%u):\n", mask);	printBits(number);	printBits(mask);	printBits(number & mask); 	return 0; }void printBits(unsigned int var) {	unsigned int b;	unsigned int mask = 1 << 15; 	printf("\n%10u = ", var);	for (b = 1; b <= 16; ++b) 	{		printf("%c", var & mask ? '1' : '0');		var <<= 1; 		if (b % 8 == 0)			putchar(' ');	}} 	
Чему будет равно значение переменной s в результате выполнения приведенной программы?
int main (void){	struct A { 		int number;		int count;	} a1[2], a2[2];	int s;		a1[0].number = 1;	a1[0].count = 12;	a1[1].number = 1;	a1[1].count = 12;	a2[0] = a1[0];	s = a1[0].count + a2[0].count;	return 0; }