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

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

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

Каким будет результат выполнения приведенной программы?
#include <stdio.h>#include <string.h>#define N 10int main(){			char strLow[N];	int i;	printf("Enter string in low register (%d symbols): \n", N);	scanf("%s", strLow);	for (i=0; i<strlen(strLow); i++)		putchar(strLow[i] - 32);	printf("\n");	return 0;}

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

Варианты ответа
все символы строки strLow будут преобразованы в верхний регистр
на экран будет выведена строка strLow в верхнем регистре(Верный ответ)
при выполнении приведенной программы возникнет ошибка выполнения
Похожие вопросы
Каким будет результат выполнения приведенной программы?
#include <stdio.h>#include <string.h>#define N 10int main(){			char ch, strLow[N] = "test";	int i = 0;	ch= strLow[0];	while (ch!='\0')	{		putchar(strLow[i] - 32);		i++;		ch= strLow[i];	}	printf("\n");	return 0;}
При каких значениях размерности 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 <stdlib.h>#define N 10int main(void){	int i;	int *arr;		arr = (int *)calloc(N, sizeof(int));	if (!arr) {		printf("\nERROR! Out of memory in calloc() function. Press any key: ");		_getch(); 		exit(1); 	};	for (i=0; i<N+2; i++) {		arr[i] = i+1;		printf("arr[%d] = %d\n", i, arr[i]);	}	free(arr);	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;}
Задана программа, в которой выполняется подключение файла arr.h:
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <conio.h>#include <stdlib.h>#include <locale.h>#ifndef ARR#define ARR#include "arr.txt"#endifint main (void)  {	int i = 0 , j = 0, n;		setlocale (LC_ALL, "rus");	printf("Введите количество человек (от 1 до 3): ");	scanf("%d", &n);    	if (n<1 || n>3) {		printf("Ошибка ввода данных. Нажмите любую клавишу: ");		_getch();		exit(1);	}	#undef ARR	#ifdef ARR		for (i=0; i<n; i++)			printf("%d. %s %s\n", i+1, names[i], surnames[i]);	#endif	return 0;}
Содержание файла arr.h:
char *names[] = {"Иван", "Пётр", "Илья"};char *surnames[] = {"Иванов", "Пётров", "Ильин"};
Определите, будут ли выведены на экран сочетания имён и фамилий из файла arr.h при выполнении приведенной программы? Если не будут, то почему?
Чему будет равно значение переменной s в результате выполнения приведенной программы?
#include <stdio.h>#include <stdlib.h>#define n 2#define m 3int sum(int *a, int x, int y);int main( void ){	int i, s;	int a[n][m] = {{1,2,3}, {4,5,6}};		s = sum(*a, n, m);	printf("Сумма элементов а: %d\n", s);		return 0;}int sum(int *a, int x, int y){   int i, j, s = 0;   for (i=0; i<x; i++) 	   for (j=0; j<y; j++) s += a[i*y+j];   return s;}
Чему будет равно значение переменной s в результате выполнения приведенной программы?
#include <stdio.h>#include <stdlib.h>#define n 2#define m 3int sum(int *a, int x, int y);int main( void ){	int i, s;	int a[n][m] = {{1,2,3}, {4,5,6}};		s = sum(a, n, m);	printf("Сумма элементов а: %d\n", s);		return 0;}int sum(int *a, int x, int y){   int i, j, s = 0;   for (i=0; i<x; i++) 	   for (j=0; j<y; j++) s += a[i*y+j];   return s;}
Используя таблицу кодов ASCII, определите, что будет выведено на экран в результате выполнения приведенной программы?
#include <stdio.h>#define N 7int main(){		int i, j, k, buf;	char arr[N] = "Lection";	for (i=0; i<N; i++)		for (j=0; j<N-1; j++)		{			if (arr[j] > arr[j+1])			{				buf = arr[j];				arr[j] = arr[j+1];				arr[j+1] = buf;			}		};	for (k=0; k<N; k++)		printf("%c ", arr[k]);	return 0;		}
Используя таблицу кодов ASCII, определите, что будет выведено на экран в результате выполнения приведенной программы?
#include <stdio.h>#define N 7int main(){		int i, j, k, buf;	char arr[N] = "Lection";	for (i=0; i<N; i++)		for (j=0; j<N-1; j++)		{			if (arr[j] < arr[j+1])			{				buf = arr[j];				arr[j] = arr[j+1];				arr[j+1] = buf;			}		};	for (k=0; k<N; k++)		printf("%c ", arr[k]);	return 0;		}