There is a source code file called q1.c Answer the following questions: a. What is the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
There is a source code file called "q1.c" Answer the following questions: a. What is the size, in bits, of each element of array t? b. Write down the elements of array t in binary c. For each of the following variables in the mystery function describe briefly the purpose of each variable. Variable a b r d Purpose (in one short sentence) d. Describe in under 20 words what the mystery function does #include <stdio.h> #define M Ob10000000 #define L 5 int mystery(char *x, int y) { int a = 0, b = 0, r = 0, d = 0; while(b < y) { char c = x[b]: d=0; while(d<8) { if(!(c & M) && a) { if(a > r) r = a; a = 0; } while(!(c & M) && (d<8)){ <<<= 1; d++; } while((d<8) && (c & M)){ a++; c<<= 1; d++; } }; b++; } if(a > r) r = a; return r; } int main() { int main() { char t[L] = {51, -29, 63, -9, -1); int v = mystery(t, L); printf("%d\n", v); } There is a source code file called "q1.c" Answer the following questions: a. What is the size, in bits, of each element of array t? b. Write down the elements of array t in binary c. For each of the following variables in the mystery function describe briefly the purpose of each variable. Variable a b r d Purpose (in one short sentence) d. Describe in under 20 words what the mystery function does #include <stdio.h> #define M Ob10000000 #define L 5 int mystery(char *x, int y) { int a = 0, b = 0, r = 0, d = 0; while(b < y) { char c = x[b]: d=0; while(d<8) { if(!(c & M) && a) { if(a > r) r = a; a = 0; } while(!(c & M) && (d<8)){ <<<= 1; d++; } while((d<8) && (c & M)){ a++; c<<= 1; d++; } }; b++; } if(a > r) r = a; return r; } int main() { int main() { char t[L] = {51, -29, 63, -9, -1); int v = mystery(t, L); printf("%d\n", v); }
Expert Answer:
Answer rating: 100% (QA)
a tL 1 char 51 29 63 9 1 This indicates that the array is 5 bytes in size 8 bit ... View the full answer
Related Book For
Posted Date:
Students also viewed these computer network questions
-
Answer the following questions in one or two well-constructed sentences. a. What happens to the standard error of the mean if the sample size is increased? b. What happens to the distribution of the...
-
Answer the following questions with regard to infrastructure: a. What is infrastructure? b. What are the two methods that might be used to record infrastructure expense from year to year? How is the...
-
Answer the following questions with reference to Figure . a. The base case for a program is priced out at $22 million. The companys chief executive officer is required to obtain written permission...
-
What are decision support systems, and what role do they play in the business environment?
-
Explain how net present value is an appropriate tool for comparing investments.
-
Read the box "The Return to Education and the Gender Gap" in Section 8.3. Discuss the internal and external validity of the estimated effect of education on earnings.
-
When a system does work on its surroundings, its internal energy will (a) Decrease (b) Increase (c) Stay constant (d) Become more concentrated.
-
The director of continuing education at Bluebird University just approved the planning for a sales training seminar; her administrative assistant identified the various activities that must be done...
-
Megamart provides the following information on its two investment centers. Investment Center Sales Income Average Assets Electronics $ 45,000,000 $ 3,420,000 $ 18,000,000 Sporting goods 25,200,000...
-
A specific closed-loop control system is to be designed for an underdamped response to a step input. The specifications for the system are as follows: %OS 5% T <2s T, < 1.5 s a. (5 marks) Identify...
-
A financial analyst at Buckco Ltd. wants to compute the company's weighted average cost of capital (WACC) using the dividend discount model. The analyst has gathered the following data: - Before-tax...
-
How can the use of choice heuristics reduce post-purchase dissonance?
-
How might a firm use reinvention when repositioning a product?
-
Has the increased use of mobile devices impacted on the decision-making process? Develop a critical discussion.
-
What are the most important factors making up the micro-environment?
-
Apple was founded in 1976 by Steve Jobs, Steve Wozniak and Ronald Wayne. Wozniak was the electronics man: he designed and hand-built the first Apple computer, the Apple 1, which was first shown to...
-
What are the specific challenges that businesses face when they attempt to combine offline and online marketing methods?
-
The graph of the sequence whose general term is an = n - 1 is which of the following? [8.1] A. B. TITTT 3-2-1 23.45 2.3.4
-
Katrina Lukacs is the engagement partner of the audit of Champion Securities, an investment company. Most of Champion's assets and liabilities are financial and their valuation is critical to the...
-
How does stratification of the population reduce the required sample size? Give an example of substantive testing where stratification would be appropriate.
-
Self-interest, self-review, and familiarity threats all arise from an inappropriate closeness between the auditor and the client. Explain how that closeness is likely to manifest in each case and why...
-
Can you list six important benefits of this pattern?
-
Can you list five pitfalls of this pattern, if any?
-
Can you compare this stable pattern with the one that is designed by using a traditional method?
Study smarter with the SolutionInn App