MCS-011 Problem Solving and Programming Assignment Question (MCA New Course Sem-1)

  JHARKHAND BOARD You are here

MCS-011 Problem Solving and Programming

Course Code : MCA(1)011/Assign/09

Last Dates for Submission : 15th April, 2009 (For January Session) 15th October, 2009 (For July Session)

Max. Marks: 100    Weightage:25%

There are five questions in this assignment, which carries 80 marks. Rest 20 marks are for viva-voce.

Note : Attempt all Questions.

Q1. (a) Write a simple program to find out how many of the numbers from 1 to 10 is greater than 4.

(b). Write a program in C that prompts the user with the following lines:

a) Add two integers

c) Compare two integers for the larger

t) Test an integer for odd or even

q) Quit

(c). Write a function celsius() to convert degrees Fahrenheit to degrees Celsius.

Note: The conversion formula is °C = 5/9 * (°F - 32) (5×3=15 Marks)

---------------------------------

Get Free Answers - Click Here

----------------------------------

Q2. (a) Write a program to print this triangle:

               *
               ***
               *****
               *******
               *********
               ************

(b) Write a program to compute the average of the ten numbers 1, 4, 9, ..., 81, 100 (i.e., the average of the squares of the numbers from 1 to 10). (2 X 10 = 20 Marks)

--------------------------

Get Free Answers - Click Here

--------------------------

Q3. (a) Write a chequebook balancing program of an user’s account. It will use getline() to read a line, which will contain either the word “withdrawl” or “deposit”. The next line will contain the amount of the withdrawl or deposit. After reading each pair of lines, the program should compute and print the new balance. You can declare the variable to hold the running balance to be datatype float, and you can use the function atof() to convert an amount string read by getline() into a floating-point number. When the program reaches end-of-file, it should exit.

For example, given the input

1. deposit

2. 100

3. withdrawl

4. 12.34

5. withdrawl

6. 49.00

7. deposit

8. 7.01

the program should print something like

balance: 100.00

balance: 87.66

balance: 38.66

balance: 45.67

(15 Marks)

---------------------------------

Get Free Answers - Click Here

---------------------------------

Q4. Using Pointers,

a. Write a line-reversing function.

b. Write the character-counting function.

c. Write the string-concatenation program

d. Write the string-replacing function.

(4 X 5 =20 Marks)

--------------------------------

Get Free Answers - Click Here

--------------------------------

Q5. Write a program which has the following seven functions. The functions should be:

  • main() this calls the other 6 functions
  • fget_long() a function which returns a long data type from a file
  • fget_short() a function which returns a short integer variable from a file
  • fget_float() a function which returns a floating point variable from a file
  • fprt_long() a function which prints its single, long argument into a file
  • fprt_short() a function which prints its single, short argument into a file
  • fprt_float() a function which prints its single, floating point argument into a file.

You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.

(10 Marks)

---------------------------------

Get Free Answers - Click Here

---------------------------------

---------------------------------

Download Attached PDF