I am preparing for programing exams at uni, Could some one please help me with these problems?
1. Indicate why the following pseudo-code is likely to produce incorrect output.
Indicate what needs to be done to make it correct.
Code:algorithm summation integer count, sum begin for count <--1 to 10 do sum <-- sum + count endfor output 'Sum of numbers between 1 & 10 is ',sum end algorithm
2. What is the value of variable i and of variable j on line 6 below? Explain your answer.
Code:1 i=0;j=0; 2 while (i<10) 3 { 4 j=j+2; 5 } 6 // What is the value of variable i and variable j?
3. Explain why the fscanf function has an '&' in front of the variable names for integers, floats, etc. For example, fscanf(input,"%d",&age),and explain why the fscanf function does not have an '&' in front of the variable names for arrays. For example, fscanf(input,"%s",string_array).
4. Give a pseudo-code example to illustrate how a professional programmer would get a positive integer value from a user. Explain your design decisions.
5.Give the pseudo-code const and var declarations that could be used to hold information about a student. The information required is their name, address, student number, email address and telephone number.
6. Give separate fprintf statements that will display :
i) an integer variable height with a field width of 10
characters
ii) a character string stored in variable name
iii) a double floating point number with a field width of 8, and
3 decimal places that is in variable weight.
iv) a literal string "hello world.\nHow are you?"
v) an integer variable fred using a left-justified format
in a field width of 8 places.