Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

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;
a*alpha-beta;
x*a+b;

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.

b)

What do the following functions do? Justify your answer.

Int func1(floatx)

{
return((int)(x+1))
}
Int func2(intn)
{ int S = 0, i, m=0;
For (i = 0;i < n ;i++) {
m=m+2*i+1;
S=S+m;
}
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++

Programming in cbubba tubs bbq rub is a company that makes

Programming in C++ Bubba Tub's BBQ Rub is a company that makes different BBQ dry rubs and sauces. They make each product when it is ordered with the freshest ingredients and sell it by the unit. A unit is 2 ounces of pro ...

Assignmentwhen writing c programs include comments in your

Assignment When writing C++ programs include comments in your code, make the program readable by indenting, use meaningful variable and function names, and produce meaningful output. This assignment will be to write a bm ...

Write a c program that calculates and prints the average of

Write a C program that calculates and prints the average of two or more salaries entered by the user. The program should first prompt the user to enter the number of salaries to process (make sure: at least 2 salaries mu ...

Computer applications divisionassignment c programmingstl

COMPUTER APPLICATIONS DIVISION Assignment: C++ PROGRAMMING STL Vector For this assignment, you will be starting with an example program that demonstrates the use of a STL vector. In addition to this, you may need to look ...

Object-oriented programming assignmentintroduction -nbspa

Object-Oriented Programming Assignment Introduction -  "A logical matrix or (0, 1) matrix is a matrix with entries from the Boolean domain B = {0, 1}. Such a matrix can be used to represent a binary relation between a pa ...

A compiler that translates a high-level language into

A compiler that translates a high-level language into another high-level language is called a source-to-source translator. What advantages are there to using C as a target language for a compiler?

C-programmingcreate a c program that sorts a sequence of

C-Programming Create a C program that sorts a sequence of positive numbers using the bubble sort algorithm in an increasing or decreasing order based on the user's choice. The pseudo code for the bubble sort algorithm is ...

Assignmentpart acomplete the following questionswrite c

Assignment Part A Complete the following questions: Write C++ code to open a document with the name Hello.txt, place the message "Hello, World!" in the document, and exit the document. Re open the file you closed, and re ...

Computer sciencewhere do you think c and coding games in c

Computer Science Where do you think C++ and coding games in C++ is headed in the next five years? How about in the next 10 years? Do you think there are any significant improvements that need to be made to the code to en ...

Write a program to draw a symmetric shape of your own using

Write a program to draw a symmetric shape of your own using C++ user-defined functions and arrays. The program should draw a shape in its original and opposite forms (black and white and then white and black). Please con ...

  • 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

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen