Question

Question 4] All variables and headers properly defined for the C functional program. char st 80 1: unsigned *ptri-s .a) What is the size of the array s in bytes? .b) ptr1 has a hex-decimal value of 28FE60 referring to the first element of st 1 array. What is the decimal value? c) Following this functional software; a Ans size- b Ans-- for (i 0; sl i0:+i) printf( in %c: It %dVt,toupper(s[i] . (i.2), toupper( st i l . (i.2))); what character sequence is output, if s array is inputted with: florida; c. Ans---_ d) For part (c ) above, what is the corresponding ASCII code sequence? d. Ans e)Following this functional software for (ka 25; k>-20; -k) memory [k]·(( 10(k-5)-20)); printf (in memory [%d]-vt %d, k, memory [k]); What do memory locations 22 and 24 contain? e. memory[22)__ memory[24) -memoryl24]. What is the final value for loop variable k? final k value- Dear All: Again, it is my privilege to have been associated with you. All the best Best wishes and kind regards Subbarao Wunnava
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

a)generally a character will take 1-byte memory. The array of 80 elements will take 80 bytes continuously allocated memory

b)The decimal value of the given hexadecimal is 2686560

Here is the method to calculate the decimal value:

Hexadecimal Decimal 0 0 4 4 6 6 8 8 剩膨 10 12 13 14 15

now 28FE60:

Replace the alphabets with the given numbers in the table and multiply it with 16 power number position.

(2*165)+(8*164)+(15*163)+(14*162)+(6*161)+(0*160)=2686560 is the answer

c) The output character sequence will be "FJKLAZU"

The statement "toupper(s[i]-(i*2))" will be performed as follows:

In c, when we try to calculate the difference between a character and integer the compiler will automatically takes the ASCII value of the character(which is a number) and performs the subtraction operation.

Here when the string is "florida"

for i=0 s[i] is f and ASCII of character "f" is 102 & 102-(0*2)=> 102 and result will be converted to upper character because of toupper command and "F" will be the first output string

for i=1 => s[i] = l=> 108-(1*2)=106 => j => toupper(j)=> J

same follows till the character "a".

d)

F:      70      
J:      74      
K:      75      
L:      76      
A:      65      
Z:      90      
U:      85      

This will be the character sequence these are the corresponding ASCII values of the capital letters. After each character has converted to uppercase and we are trying to print the %d of that character the upper case letter ASCII will get printed

Here is the ASCII chart:

8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 888899999999990000000000111111111122222222 B

e)

 memory[25]=    (10*(25-5)-20)=> 10*20-20=>200-20=>180
 memory[24]=    (10*(24-5)-20)=> 10*19-20=>190-20=>170
 memory[23]=    160
 memory[22]=    150 
 memory[21]=    140
 memory[20]=    130 

The loop will be executed for 5 times for k=25,24,23,22,21,20 and after that k will become 19 and the loop condition k>=20 will fail and loop execution will not be further executed.

The final value of k is 19.

Add a comment
Know the answer?
Add Answer to:
Question 4] All variables and headers properly defined for the C functional program. char st 80...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c program void funcint x, int *y) { 1. Whof the Rings gical ASA All of...

    c program void funcint x, int *y) { 1. Whof the Rings gical ASA All of the above 1.0.2.4) What will be the out of the de int, pat) A) 10 12 (1.03.2) What will be the output of the following int , printf(d, a,b); A) & B) 17 11.12 D) 17.25 13. (L032) An array is a group of memory locations related by the fact that they all have my name and pe A) different different B) same, different...

  • this is c code. please answer all questions on a piece of paper and show work....

    this is c code. please answer all questions on a piece of paper and show work. i need to prepare as i have a midterm i will have to be completing on paper 1) Bit Operators: This C program compiles and runs. What is its output? 1) #include <stdio.h> 2) void main (void) 3) unsigned char x =60; 4) 5) 6) 7) 8 ) 9) 10) 11) 12) 13) unsigned char a = x < 1; unsigned char b unsigned...

  • Run the C program below and complete the table showing all the variables. Add printf function...

    Run the C program below and complete the table showing all the variables. Add printf function calls to obtain the addresses and values of all 13 variables. (Count the array (ca) as 3 variable/values and also include argc and argv in the table). The table must show the Address, Name, Datatype, Scope, and Value of each variable on the stack. (Hint: use the sizeof function to double check your addresses.) Explain how different the actual memory allocations are from what...

  • I need a basic program in C to modify my program with the following instructions: Create...

    I need a basic program in C to modify my program with the following instructions: Create a program in C that will: Add an option 4 to your menu for "Play Bingo" -read in a bingo call (e,g, B6, I17, G57, G65) -checks to see if the bingo call read in is valid (i.e., G65 is not valid) -marks all the boards that have the bingo call -checks to see if there is a winner, for our purposes winning means...

  • C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) L...

    C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...

  • Need this in C Code is given below e Dots l lah dit Problem 1. (30...

    Need this in C Code is given below e Dots l lah dit Problem 1. (30 points) Fre bendord.cto obtain the free in decimal representation For ATY. this problem we complete the code in i tive long inte ens (W written the following positive long term 123, 40, 56, 7, 8, 9, 90, 900 the frequencies of all the digits are: 0:4, 1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7: 1. 8: 1.9: 3 In this example, the free ency of...

  • I need help on this Systems review please! it's due by midnight monday. Question 1 Not...

    I need help on this Systems review please! it's due by midnight monday. Question 1 Not yet answered Points out of 1.00 Flag question Question text Using these declarations: int * numberPointers[3]; int * pointer; int number; Which of the following statements would generate a warning or error? Select one: a. number = pointer; b. *pointer = number; c. pointer = numberPointers; d. numberPointers[2] = &number; e. a., b., and d. f. a. and c. Question 2 Not yet answered...

  • Major Homework #2 Implement a C program major_hw2.c to solve the 15-puzzle problem using the A*...

    Major Homework #2 Implement a C program major_hw2.c to solve the 15-puzzle problem using the A* search algorithm. 1. Objectives • To gain more experience on using pointers and linked lists in C programs. • To learn how to solve problems using state space search and A* search algorithm. 2. Background A* search and 15-puzzle problem have been introduced in the class. For more information, please read the wiki page of 15-puzzle problem at https://en.wikipedia.org/wiki/15_puzzle, and the wiki page of...

  • Major Homework #2 Implement a C program major_hw2.c to solve the 15-puzzle problem using the A* s...

    Major Homework #2 Implement a C program major_hw2.c to solve the 15-puzzle problem using the A* search algorithm. Please include pictures that the code runs and shows the different states as it reaches goal state please. 1. Objectives • To gain more experience on using pointers and linked lists in C programs. • To learn how to solve problems using state space search and A* search algorithm. 2. Background A* search and 15-puzzle problem have been introduced in the class....

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT