Can someone explain this to me Multiple choice For each of t

Can someone explain this to me?
Multiple choice For each of the multiple choice questions below, clearly indicate underlining the one choice you think best answers the question. What will the short code sequence below print? int i; char al(20]; char s2(20]; strepy(si, \"xo\"); strepy(s2, \"xx\"); for (i =0; i 1) s^2 [0] = \'0\'} print f (\"% s\ \", s1); xo xoxx xoox xoxxxxxxx xoxxxxxox

Solution

Here we will first see what all variable and array are present to hold te values

int i ; variable to loop through

char s1[20] //first char array to store values and size is 20

char s2[20]  //second char array to store values and size is 20

strcpy(s1,\"xo\");

strcpy(s2,\"xx\");

//strcpy functions copies the data into destination so here s1 will have xo and s2 will have xx.

and function strcat used below is the function where the destintion parameter will have the concatenated value of destination and source string.

the loop defined will concatenate s2 value to s1 and when i>1 it will assign o to s2[0]. Now we will see iterations and value modification through a table.

I

S1

S2

strcat[s1,s2,]

i>1

S2[0]=o

S1

S2

0

xo

xx

xoxx

F

Xoxx

xx

1

xoxx

xx

xoxxxx

F

xoxxxx

xx

2

xoxxxx

xx

xoxxxxxx

T

ox

xoxxxxxx

ox

3

xoxxxxxx

ox

xoxxxxxxox

T

ox

xoxxxxxxox

ox

I

S1

S2

strcat[s1,s2,]

i>1

S2[0]=o

S1

S2

0

xo

xx

xoxx

F

Xoxx

xx

1

xoxx

xx

xoxxxx

F

xoxxxx

xx

2

xoxxxx

xx

xoxxxxxx

T

ox

xoxxxxxx

ox

3

xoxxxxxx

ox

xoxxxxxxox

T

ox

xoxxxxxxox

ox

Can someone explain this to me? Multiple choice For each of the multiple choice questions below, clearly indicate underlining the one choice you think best answ
Can someone explain this to me? Multiple choice For each of the multiple choice questions below, clearly indicate underlining the one choice you think best answ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site