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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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