What will be the output of the program

Assignment Help C/C++ Programming
Reference no: EM131559136

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 <stdio.h>

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<stdio.h>
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;i<a;i++)
for(j=0;j<b;j++)
{
for(k=0;k<b;k++)
printf("*");
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.

Reference no: EM131559136

Questions Cloud

Discuss the racial and gender distribution : Discuss the person (racial and gender distribution), place (geographic distribution), and time (health trends from one point in time to another).
Physician profiling and health care quality outcomes : Physician profiling is a collection of provider-specific and practice-level data used to analyze physician practice patterns, utilization of services.
Identify a group facilitator : Select a topic relevant to interprofessional leadership and the health care field on which to focus your group paper. Identify a group facilitator.
What is the probability that he or she was retired : RETIREMENT NEEDS In a survey of 2000 adults 50 yr and older of whom 60% were retired and 40% were preretired, the following question was asked.
What will be the output of the program : What amount of memory is allocated for each of the given variable declarations - What will be the output of the program, if user enters 3 and 5
Define quantitative research and provide two examples : In your own words, define quantitative research and provide two examples of quantitative designs with a brief explanation of each design.
Entire process of making an informed decision : We have gone through the entire process of making an informed decision. For you final paper you will need to apply all of the tools you have learned.
Evaluate miller choice of the title death of a salesman : Evaluate Miller's choice of the title Death of a Salesman. Do you agree or disagree with Miller's choice? Why or why not
Firms with more in foreign costs than in foreign revenues : Firms with more in foreign costs than in foreign revenues will be favorably affected by a stronger foreign currency. Is this statement right or wrong?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement c code for drawing filled triangles

Calculate the size of a rectangle that is just large enough to contain the triangle. The bx, by, bw, and bh fields of the triangle data structure should be initialized with the appropriate values.

  Report detailing any code smells present in the code

Report detailing any "code smells" present in the code and how you intend to refactor them out of the code and A refactored version of the system eliminating all identified code smells

  Linear program was developed to help

The client has stipulated that the money must be put into either a stock fund or a money market fund, and the annual return should be at least $14,000. Other conditions related to risk have also been specified, and the following linear program was..

  What exactly does the given function do

What exactly does this function do? In other words, what does it compute? How does the function do what it does? Provide examples. Propose a new name for the function that better documents its behavior.

  Complete the leadership in action case study

Complete the Leadership in Action case study for Lehman Brothers on page 276-277 in your textbook.

  Build a randomly generated simple substitution cipher

Design, implement and test classes in C++ Apply and implement ? overloaded? operators and functions Design and implement classes using inheritance

  Create an array of boat objects

Create Classes for each of the object types that need to be stored, as indicated above.

  Write a c program that uses functions to perform

Write a C program that uses functions to perform the following: i) Addition of Two Matrices ii) Multiplication of Two Matrices

  Change this code to read in strings from a text file

code takes in a string from a user, checks if the paranthesis are ballanced (as defined by my class) and also returns the variable from my line (also from my class). All like to change this code to read in strings from a text file (each line is a str..

  What are the sizes in memory of data types

What are the sizes in memory of other data types in C++? I mean, I know that a double is 8 bytes and an int is 4 bytes. What si the size of a Char and a String?

  Calculate and display the number of units of electricity

The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.

  Industry standards in configuration management and control

Information related to configuration management and preventative maintenance. Industry standards in configuration management and control. Training approaches to allow for adaptive maintenance and confidence.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd