Ask Question, Ask an Expert


Ask C/C++ Expert

Home >> C/C++

problem1)a) describe how you can print the following characters on the screen:

i) problem mark

ii) Horizontal tab

iii) Vertical tab

iv) Backslash

v) New line

vi) Backspace

b) Which of the following are valid integer constants? Give reasons for your answer.

i) 123456L

ii) 12.5

c) Which of the following are valid float constants? Give reasons for your answer.

i) 12345e-2

ii) -01234e-10

d) Which of the following are valid C identifiers? Give reasons for your answer.

i) one-two

ii) _ABC

iii) 3dimensional

problem2)a) What are the errors in the following C program?

1 # include
2 #define PI=3.14
3 int main()
4 {
5 float radius,area;
6 printf("Enter the radius\n"/*get radius*/);
7 scanf("%d",&radius);
8 area = PI*radius*radius;
9 printf("The Area is %f Km/hr.",Area);
10 return 0;
11 }

b) Arrange the operators in ascending order of priority:

i) +=,*,>>

ii) %,->,||

c) What is the type of the C expressions in the following fragment?
Int a, b;
char alpha, beta, gamma;
long x;

problem3)a) prepare the C expressions for each of the following expressions:

i) 1/(√x2+y2)

ii) (x-1)/(x2+2)+(2x-1)/(x2- 4x+7)

iii) e-(x-a/b)^2

You can make use of the functions from the maths library.


What do the following functions do? Justify your answer.

Int func1(floatx)

Int func2(intn)
{ int S = 0, i, m=0;
For (i = 0;i < n ;i++) {
return (S);


problem4)a) In the program fragment given below, what are the values of the expressions in line numbers 2, 4 and 5?

1 int x = 2, y = 2;
2 x ++ > y ? x + 1 : y + 1
3 x = 2, y = 2;
4 ++ x > x ? x:y;
5 ++ x*y --;

b) If you want to prepare a for() loop for printing the sum of all numbers from 1 to 100 which of the following for () loops will do the job? Give reasons for your answer.
For (sum=0,i=1; i <= 100; sum += i,++i)
For (sum=0,i=1,i <= 100; ++i, sum +=i)

c) prepare a function double trapezoid( double f(double x), int a, int b) which can be used to integrate using trapezoid rule any function that fits the prototype of the function. For ex, you should be able to find 0π/2 sin x dx by using a function call trapezoid(sin, 0,π/2).

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92603

Have any Question? 

Related Questions in C/C++

Discussion questonsplease respond to all of the following

Discussion Questons Please respond to all of the following prompts: • How are input and output accomplished in C++? • How do cin and cout relate to ostream and istream? Lab Activity 1. Write a C++ program per the require ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...


Program Write a C++ program that will: Ask the user for the name of an input file. Read in this name and open that text file for input. Ask the user which of two options they want to do: Read in student data Count lines ...

Computer scienceprogram-write a c program that willpresent

Computer Science Program- Write a C++ program that will: Present the user with a menu of choices: 1. Random number 2. String 3. Type Casting 4. Integer Math Then, in an if-else if structure (or switch) write the code for ...

Programming assignment-1 program specification1 your

Programming Assignment- 1. Program Specification 1. Your program must read 8-bit ASCII strings from standard input -- for instance, using the cin object in C++, or stdin in C. You must consume all input from standard inp ...

Object oriented programmingassignmentq1 assuming there are

Object Oriented Programming Assignment Q1: Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet. Q2: You can co ...

Cs492 programming assignment-the program must be written in

CS492 Programming Assignment- The program must be written in C or C++, and run on a linux machine. ALL source code you submit must be well documented (documentation is an indicator of understanding!) Programs that cannot ...

Descriptionnbspin this assignment you will write a c

Description:  In this assignment you will write a C++ program that finds the kth largest number among a set of N numbers. It will implement the solution using two different algorithms and measure the time elapsed during ...

Here are two examplesifcounter7continueifcounter7break1

Here are two examples: if(counter==7) continue; if(counter==7) break; 1. Write a for loop that counts only the odd numbers out of the first five numbers entered from the keyboard, but does not count (skips) the number 7. ...

Write an application that allows the user to enter two

Write an application that allows the user to enter two variables: number (real) and code (character). Calculate the value indicated by the table below: If code is Result A symbol the whole part of the number everything e ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate