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

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

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

Чему будет равно значение переменной str после выполнения приведенной программы?
union test {  char ch1[5];  char ch2[2];  char ch3[1];};int main(void){	union test t;	char *str;	strcpy(t.ch1, "test");	t.ch2[0] = 'b';	t.ch3[0] = 'w';	str = t.ch1;	return 0;}

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

Варианты ответа
test
best
west(Верный ответ)
b
w
Похожие вопросы
Чему будет равно значение переменной str после выполнения приведенной программы?
union test {  char ch1[5];  char ch2[2];  char ch3[1];};int main(void){	union test t;	char *str;	t.ch3[0] = 'w';	strcpy(t.ch2, "be");	strcpy(t.ch1, "test");	t.ch1[2] = '\0';	str = t.ch2;	return 0;}
Чему будет равно значение переменной str после выполнения приведенной программы?
union test {  char ch1[5];  char ch2[2];  char ch3[1];};int main(void){	union test t;	char *str;	strcpy(t.ch1, "test");	strcpy(t.ch2, "be");	t.ch3[0] = 'w';	str = t.ch1;	return 0;}
Чему будет равно значение переменной m в результате выполнения приведенной программы?
int main(void){  FILE *fp;  char str[30] = "Lection 11";  int k, l, m;  if((fp=fopen("g:\\test.txt", "wt+"))==NULL) {    printf("Ошибка при открытии файла.\n");    exit(1);  }  k = fwrite(str, sizeof(char), strlen(str)-3, fp);  rewind(fp);  l = fread(str, sizeof(char), sizeof(str)/sizeof(char), fp);   m= k+l;  fclose(fp);  return 0;}
Чему будет равно значение переменной m в результате выполнения приведенной программы?
int main(void){  FILE *fp;  char str[30] = "Lection 11";  int k, l, m;  if((fp=fopen("g:\\test.txt", "wt+"))==NULL) {    printf("Ошибка при открытии файла.\n");    exit(1);  }  k = fwrite(str, sizeof(char), strlen(str)-3, fp);  rewind(fp);  l = fread(str, sizeof(char), sizeof(str)/sizeof(char), fp);   m= l - k;  fclose(fp);  return 0;}
Сколько символов будет прочитано из файла функцией fread() в результате выполнения приведенной программы?
int main(void){  FILE *fp;  char str[30] = "Lection 11";  if((fp=fopen("g:\\test.txt", "wt+"))==NULL) {    printf("Ошибка при открытии файла.\n");    exit(1);  }  fwrite(str, sizeof(char), strlen(str)-3, fp);    rewind(fp);  fread(str, sizeof(char), sizeof(str)/sizeof(char), fp);    fclose(fp);  return 0;}
Чему будет равно значение переменной s после выполнения приведенного фрагмента кода?
int test();int a = 1;int main (void) {	int b, s;	extern int x;	static int c;	int a;	a = 2;	s = test();	return 0;  }int test() {	int t = a;	return t;}
Чему будет равно значение переменной 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;}	
Какие утверждения будут верными после выполнения приведенной программы?
#include <stdio.h>#include <string.h>#define N 10int main(){		int i = 0;	char ch;	char str1[N] = "test";	char str2[N];	ch= str1[0];	while (ch!='\0')	{		str2[i] = str1[i];		i++;		ch= str1[i];	}		return 0;}