logo

Crowdly

Browser

Add to Chrome

met1501s25-a.sg

Looking for met1501s25-a.sg test answers and solutions? Browse our comprehensive collection of verified answers for met1501s25-a.sg at distance3.sg.digipen.edu.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Determine the exact text printed to the standard output stream by the following code fragment:

for (int i = 0; "representation"[i]; ++i) {

fputc("representation"[i] - 'a' + 'A', stdout);

}

0%
0%
0%
0%
0%
0%
View this question

Write the exact text printed to the standard output stream by the following code fragment:

enum { MAX_STR_LEN = 256 };

void foo(char array1[], char const array2[]) {

int i = 0;

while (array1[i] = array2[i]) ++i;

}

char str[MAX_STR_LEN] = "FourScore", str2[MAX_STR_LEN];

foo(str2, str);

fputs(str2, stdout);

View this question

Write the exact text printed to the standard output stream by the following code fragment:

int foo(char const array[]) {

int i = 0;

while (array[i++]) ;

return i-1;

}

char str[] = "FourScoreAndSeven";

printf("%i", foo(str));

View this question

Consider the execution of the following code fragment:

enum { MAX_LEN = 256 };

char str[MAX_LEN];

fputs("Enter a sentence: ", stdout);

scanf("%s", str);

fputs(str, stdout);

If the user enters the text today is a good day [followed by the keyboard button] in response to the program's prompt, write the exact text printed to the standard output stream by the code fragment's final statement.

View this question

Consider the execution of the following code fragment:

enum { MAX_LEN = 256 };

char str[MAX_LEN];

fputs("Enter a sentence: ", stdout);

fgets(str, MAX_LEN, stdin);

fputs(str, stdout);

If the user enters the text today is a good day [followed by the keyboard button] in response to the program's prompt, write the exact text printed to the standard output stream by the code fragment's final statement.

View this question

Write the exact text printed to the standard output stream by the following code fragment:

enum { MAX_STR_LEN = 256 };

void foo(char array1[], char const array2[]) {

int i = 0, j = 0;

while (array1[i++]);

--i;

while (array1[i++] = array2[j++]);

}

char str[MAX_STR_LEN] = "FourScore", str2[MAX_STR_LEN] = "AndSeven";

foo(str, str2);

fputs(str, stdout);

View this question

Consider the execution of the following code fragment:

int foo(char const array[]) {

int i, val;

for (i = val = 0; array[i]; ++i) {

val = (array[i] == ' ') ? val+1 : val;

}

return val;

}

fputs("Enter a sentence: ", stdout);

char str[256];

fgets(str, 256, stdin);

printf("%i", foo(str));

If the user enters the text today is a good day [followed by the keyboard button] in response to the program's prompt, write the exact text printed to the standard output stream by the code fragment's final statement.

View this question

Write the exact text printed to the standard output stream by the following code fragment:

char foo(int digit) {

return "0123456789ABCDEF"[digit];

}

char str[16] = {0};

int x = 54321, i = 0;

while (x) {

str[i++] = foo(x%16);

x /= 16;

}

str[i] = '\0';

for(--i; i >= 0; --i) {

fputc(str[i], stdout);

}

View this question

Consider the following code fragment:

char name[] = {'E','l','m','o'};

fputs(name, stdout);

Now write the additional initializer that must be added to ensure the text printed to standard output stream is Elmo. Note that you must only write the initializer and nothing else!!!

View this question

Write  if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.

int bar(int x) {

return x % 3;

}

printf("%d", bar(bar(bar(19))));

View this question

Want instant access to all verified answers on distance3.sg.digipen.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome