What amount of memory is allocated for each of the given


1. float average, high_temp, low_temp;
high_temp = 55.6;
low_temp = 37.4;
average = high_temp + low_temp/2.0;

What is value of average?

2. What is printed on the screen?

int i = 0, x = 0;
for(i = 1; i < 10; i++) {
if(i % 2 == 1)
x = x+i;
else
x--;
break;
}
printf("\nx = %d", x);

3. What amount of memory is allocated for each of the following variable declarations:

i)char str[15]= {‘p',‘a',‘p',‘e','r'};
ii)float num = 8.0;
iii)int input[5];
iv)char op = 65;

4. What is printed on the screen?

#include

void main() {
float r = 10, h = 10, PI = 3.14;
float ans = (1/3)* PI * r * r * h;
printf("%f", ans);
}

5. What will be printed on the screen?

int main()
{
int x = 2;
if(x = 9)
printf("x = 9\n");
else
printf("x != 9\n");
}

6. What is printed on the screen:

#include
int main()
{
int num = 0;
num++;
if (num > 0)
{
num++;
if (num > 0)
num++ ;
else
num--;
}
if (num > 0)
num++;
else if (num > 1)
num--;
else
num--;

printf("%d",num);
}

7. Look at the following fragment of a working code:

int a[5] = {19, 59, 3, 41, 15};

int i = 0, j = 0;

for(j = 4; i < 5; i++, j--)
{
a[j] = a[i];
}

i = 0;
for( ; i< 5 ; )
{
printf("%d,", a[i]);
i++;
}

What output will be printed on the screen?

8. What will be printed on the screen?

int a=1, b=2, c=3;
if(a==1 && b>2 || c>b)
printf("True");
else
printf("False");
}

9. What will be the output of the program, if user enters 3 and 5 ?

int i,j,k,a,b;

printf("Enter two numbers:");
scanf("%d %d",&a, &b);

for(i=0;ifor(j=0;j{
for(k=0;kprintf("*");
printf("\n");
}

10. Based on the implementation below what is the GPA of a student whose marks are 65?
if(nMarks > 90)
fGPA = 4.00;
if(nMarks > 85)
fGPA = 3.66;
if(nMarks > 80)
fGPA = 3.33;
if(nMarks > 75)
fGPA = 3.00;
if(nMarks > 70)
fGPA = 2.66;
if(nMarks > 65)
fGPA = 2.33;
if(nMarks > 60)
fGPA = 2.00;
if(nMarks > 55)
fGPA = 1.66;
if(nMarks > 50)
fGPA = 1.33;
if(nMarks > 45)
fGPA = 1.00;
else
fGPA = 0.0;

11. Write a program to take two (2) integer values from the user. If the two numbers are exactly the reverse of each other, then display "Hola numbers", otherwise display "Non-Hola numbers". For example, 451 and 154 are Hola numbers, 451 and 555 are not Hola numbers.

12. Write a program that adds every third integer, beginning with 2 (i.e., calculate the sum of 2+5+8+11+...) for all values of that are less than 100.

13. Write a program to convert the binary into its equivalent decimal number. The binary will be entered by the user, and the program should display its equivalent decimal number on the screen.

Hint: Store the binary input into an array of 32 elements.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: What amount of memory is allocated for each of the given
Reference No:- TGS02354682

Now Priced at $35 (50% Discount)

Recommended (90%)

Rated (4.3/5)