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

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

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

Используя таблицу кодировки символов ASCII, определите, что будет выведено на экран в результате выполнения приведенного фрагмента кода?
	int i = 0;	char t1 = 218;	char tr = 191;	char b1 = 192;	char br = 217;	char g = 196;	char v = 179;	printf("%c", t1);	for (i=0; i<32; i++) printf("%c",g);	printf("%c\n", tr);	printf("%c", v);	for (i=0; i<32; i++) printf("%c",' ');	printf("%c\n", v);	printf("%c", b1);	for (i=0; i<32; i++) printf("%c",g);	printf("%c\n", br);

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

Варианты ответа
хаотичный набор символов
прямоугольная рамка(Верный ответ)
при выполнении программы возникнет ошибка
Похожие вопросы
Какая ошибка содержится в приведенной программе?
int main (void){	typedef struct {    		char nazn[40];  		int numb; 		char time[10];	} train;	train tr[3];		int i = 0, sum = 0, ch=0;	char str[10], search[10];	while(ch!=121) {		printf("\nEnter information about train (Q - quit): \n");		printf("Enter destination of the train: ");		gets(tr[i].nazn);		printf("Enter number of the train: ");		gets(str);		tr[i].numb = atoi(str);		printf("Enter time of scheduled departure: ");		gets(tr[i].time);		++i;		printf("Quit? (y/n): ");		ch = _getche();	};		printf("\n\nEnter train destination: ");	gets(search);	for (i=0; i<3; i++) {		if (strcmp(tr[i].nazn,search)==0) {			printf("\n\tTrain number: %d", tr[i].numb);			printf("\n\tTime: %s", tr[i].time);		}	}	if (i>=3)		printf("There is no train to this destination");    return 0; }
Какая ошибка содержится в приведенной программе?
int main (void){	typedef struct {    		char nazn[40];  		int numb; 		char time[10];	} train, train_info;	train_info ti[3];	train tr[3];		int i = 0, sum = 0, ch=0;	char str[10], search[10];	while(ch!=121) {		printf("\nEnter information about train (Q - quit): \n");		printf("Enter destination of the train: ");		gets(tr[i].nazn);		printf("Enter number of the train: ");		gets(str);		tr[i].numb = atoi(str);		printf("Enter time of scheduled departure: ");		gets(tr[i].time);		++i;		printf("Quit? (y/n): ");		ch = _getche();	};		printf("\n\nEnter train destination: ");	gets(search);	for (i=0; i<3; i++) {		if (strcmp(tr[i].nazn,search)==0) {			printf("\n\tTrain number: %d", tr[i].numb);			printf("\n\tTime: %s", tr[i].time);		}	}	if (i>=3)		printf("There is no train to this destination");    return 0; }
Чему будет равен результат вычисления значения 5+6 в результате выполнения приведенного фрагмента кода?
  int a, b, res;  char op;  int f = 1;  printf("Введите 1й операнд: ");  scanf("%d", &a);  printf("Введите знак операции: ");  scanf("%s", &op);  printf("Введите 2й операнд: ");  scanf("%d", &b);  switch (op) {	  case '+': res = a+b; 	  case '-': res = a-b; break;	  case '*': res = a*b; break;	  case '/': res = a/b; break;	  default: 		  printf("Неизвестная операция");		  f = 0;  }  if (f) printf ("Результат: %d", res);
Что будет выведено на экран в результате выполнения приведенных инструкций при попытке пользователя вычислить значение 5^6?
  int a, b, res = 0;  char op;  int f = 1;  printf("Введите 1й операнд: ");  scanf("%d", &a);  printf("Введите знак операции: ");  scanf("%s", &op);  printf("Введите 2й операнд: ");  scanf("%d", &b);  switch (op) {	  case '+': res = a+b; break;	  case '-': res = a-b; break;	  case '*': res = a*b; break;	  case '/': res = a/b; break;	  default: 		  printf("Неизвестная операция\n");		  f = 0;  }  if (f) printf ("Результат: %d", res);
Какая ошибка содержится в приведенной программе?
int main (void){	struct train_info {    		char nazn[40];  		int numb; 		char time[10];	};	typedef struct train_info train;	train tr[3];		int i = 0, sum = 0, ch=0;	char str[10], search[10];	while(ch!=121) {		printf("\nEnter information about train (Q - quit): \n");		printf("Enter destination of the train: ");		gets(tr[i].nazn);		printf("Enter number of the train: ");		gets(str);		tr[i].numb = atoi(str);		printf("Enter time of scheduled departure: ");		gets(tr[i].time);		++i;		printf("Quit? (y/n): ");		ch = _getche();	};		printf("\n\nEnter train destination: ");	gets(search);	for (i=0; i<3; i++) {		if (strcmp(tr[i].nazn,search)==0) {			printf("\n\tTrain number: %d", tr[i].numb);			printf("\n\tTime: %s", tr[i].time);		}	}	if (i>=3)		printf("There is no train to this destination");    return 0; }
Задан фрагмент кода:
			int n, m;	char *ptr; 	printf(&\nEnter a dimention of character array: &);	scanf_s(&%d&, &n);	_flushall();	ptr = (char *)malloc((n+1)*sizeof(char));	if (!ptr) {	printf(&\nERROR! Out of memmory (error in malloc() function). Press any key...&);	_getch(); 	exit(1); 	}	printf(&Enter a character array (not more than %d characters): &, n);	gets_s(ptr, n+1);	m = strlen(ptr);	printf(&\nStart line: %s&, ptr);	ptr = (char *)realloc(ptr, (m+2)*sizeof(char));	if (!ptr) {		printf(&\nERROR! Out of memmory (error in realloc() function). Press any key...&);		_getch();		exit(1);	}	strcat_s(ptr, m+2,  &!&);	printf(&\nStart line and character \&%c\&: %s&, '!', ptr);		free (ptr);
В запросе размерности массива пользователь задал 80. В запросе ввода строки пользователь ввел строку "Lection 9". Для чего в данном случае будет использована функция realloc()?
Какой файл будет получен в результате выполнения приведенной программы?
#include <stdio.h>int main( void ){   FILE *stream;   char list[30];   int  i, numread, numwritten;   if( (stream = fopen("g:\\fread.out", "w+t")) != NULL )   {      for ( i = 0; i < 26; i++ )         list[i] = (char)('z' - i);       numwritten = fwrite( list, sizeof( char ), 26, stream );      printf( "Wrote %d items\n", numwritten );      fclose( stream );   }   else      printf( "Problem opening the file\n" );   if( (stream = fopen("g:\\fread.out", "r+t" )) != NULL )   {       numread = fread( list, sizeof( char ), 26, stream );      printf( "Number of items read = %d\n", numread );      printf( "Contents of buffer = %.26s\n", list );      fclose( stream );   }   else      printf( "File could not be opened\n" );}
При каких значениях размерности n символьного массива и строки, на которую указывает указатель ptr, в результате выполнения приведенной программы возникнет ошибка?
		#include <stdio.h>#include <conio.h>#include <stdlib.h>#include <string.h>int main(void) {	int n, m;		char *ptr; 	printf("\nEnter a dimention of character array: ");	scanf_s("%d", &n);	_flushall();	ptr = (char *)malloc((n+1)*sizeof(char));	if (!ptr) {		printf("\nERROR! Out of memmory (error in malloc() function). Press any key...");		_getch(); 		exit(1); 	}	printf("Enter a character array (not more than %d characters): ", n);	gets_s(ptr, n+1);	m = strlen(ptr);	strcat_s(ptr, m+2,  "!");	printf("\nStart line and character \"%c\": %s", '!', ptr);		free (ptr);	printf("\n\nPress any key: ");	_getch();	return 0; }
Что делает приведенная программа?
#include <stdio.h>#include <conio.h>int main(){		int n=0, i=0, j=0;	char ch, str[30]="";	printf("Введите строку: ");	scanf("%s", str);	printf("Введите символ: ");	ch = _getche();	for(i=0; i<strlen(str); i++)	{		for (j=0; j<strlen(str); j++) {			if(str[j]==str[i]) n++;		}		printf("\n%c - %d", str[i], n);		n = 0;	}	printf("\n");	return 0;		}
Что делает приведенная программа?
#include <stdio.h>#include <conio.h>int main(){		int n=0, i=0, j=0;	char ch, str[30]="";	char *ptr1, *ptr2;	printf("Введите строку: ");	scanf("%s", str);	printf("Введите символ: ");	ch = _getche();	ptr1 = str;	while(*ptr1!='\0')	{		ptr2 = str;		while (*ptr2!='\0') {			if(*ptr1==*ptr2) n++;			++ptr2;		}		printf("\n%c - %d", *ptr1, n);		n = 0;		++ptr1;	}	printf("\n");	return 0;		}