Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following statements. What is the output if the user enters the und

ID: 3688104 • Letter: C

Question

Consider the following statements. What is the output if the user enters the underlined string: 100 catsin1 2hats? int a, b; char str = [20]; scanf("%d%s%d", &a;, str, &b;); printf("a = %d, b = %d, str = %s ", a, b, str); Consider the following array declarations. char x[25], y[25], z[25); Add statements to: Read two strings from the user into x and y. Copy the one that comes first in lexicographical order into z. Print z to the standard output. What is the value of str1 after each statement: char str1(100); strcpy(str1, "The Force Awakens"); str 1[3] = ''; strcpy(str1 + 3, "I"); strcat(str1, "Again"); Consider the following string, write a statement to print the substring starting at never: char markTwainQ[200] = "I have never let my schooling interfere with my education";

Explanation / Answer

1. #include <stdio.h>

int main()
{
int a,b;
char str[20];
scanf("%d%s%d", &a, str, &b);
printf("a= %d, b= %d, str= %s",a,b,str);
}

INPUT: 100catsin1 2hats

OUTPUT:    a= 100, b= 2, str= catsin1

2) Program:

#include<stdio.h>
#include <string.h>
int main(){
int i,j;
char x[25],y[25],z[25];
printf("Enter x: ");
scanf("%s", x);
printf(" Enter y: ");
scanf("%s", y);
if(strcmp(x,y)<0) {
strcpy(z,x);
}
else if((strcmp(x,y)>0)) {
strcpy(z,y);
}
else(strcmp(x,y)==0) {
strcpy(z,x);
}
printf(" In lexicographical order the first string = %s ",z);
}

3) Output after each and every line