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++

Intro to programming in c assignmentsince this is the last

Intro to Programming in C Assignment Since this is the last assignment, there will be no late submission. All programs must be electronically submitted by 5:00pm on Tuesday, December 2nd with NO EXCEPTIONS in order to re ...

The second portion instruction shown below which is the

The second portion (instruction shown below) which is the actual C++ program is needed by this Saturday. Write a C++ program that is menu-driven that allows for the following menu choices:Load an exam: Loading an exam sh ...

1 write a c program that includes a function called lobster

(1) Write a C program that includes a function called lobster() that accepts three arguments: a character and two integers. The character argument is the character to be printed by lobster(). The second argument is the n ...

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?

Writing a c code its a beginner level code design a class

Writing a C++ code, its a beginner level code. Design a class house that defines a house on a street. A house has a house number and an (x,y) location, where x and y are numbers between -10 and 10. the key member is plot ...

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

Assignmentinstructionsthis assignment is to implement your

Assignment Instructions This assignment is to implement your own mini-grocery store in C++. Suppose you have the following Food hierarchy: FOOD FRUIT APPLE BANANA GRAPE DAIRY MILK YOGURT CHEESE (your choice) (three items ...

Discussionkeyboard versus file input please respond to the

Discussion "Keyboard versus File Input" Please respond to the following: • Suppose you are designing a C++ application that needs to capture user input specifically via a keyboard or from a file. Determine the method tha ...

Create your own unique while-end repetition structure you

Create your own unique While-End repetition structure. You decide the theme. You should provide both the pseudocode and the flowchart of your example. Be sure to provide an overview of what your repetition structure is d ...

Assignmentthis assignment gives you the opportunity to

Assignment This assignment gives you the opportunity to practice array of pointers, linked lists and self referential structures. Write a program that initializes two parallel arrays as follows: char * String[] = { "Abbi ...

  • 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

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

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