IGNOU Question Paper Solutions/MCA/Semester 1/MCS-011 Problem Solving and Programming/june 2009

From Wikibooks, open books for an open world
Jump to: navigation, search
  • MCA (Revised)
  • Term-End Examination
  • JUNE 2009
  • MCS-011: PROBLEM SOLVING AND PROGRAMMING
  • Time: 3 hours
  • Maximum Marks : 100
  • Note: Question number 1 is compulsory. Answer any three questions from the rest.
  • 1.(a) Develop an algorithm, draw a corresponding flowchart and then write a program in ‘C’ to print the sum of the digits of a three digit number. [10 marks]
  • 1.(b) Write a program that does not use the inbuilt string function to perform the following:
   (i)To compare two strings
   (ii)To concatenate two strings..            [10 marks] 

  • 1.(c)Write ‘C’ programs to read a string and check whether it is palindrome or not..

[10 marks]

  • 1.(d)Write the output of the following program:

main() { Int x=2,y=3,S1,S2; S1=x+(++y); S2=++x+y++; Printf(“%d%d%d%d\n”,S1,S2,x,y); } [5 marks]

  • 1(e)Differentiate between structure and union. [5 marks]
  • 2.(a) Summarize the purpose of the format strings(like %s,%d,%c) that are commonly used within the print function ,with an example for each. [10 Marks]
  • 1(b)Write a Program in ‘C’ to print the following output ‘n’rows.For example ,if n=3,the following should be output by the program:
           1
        1 2 1
      1 2 3 2 1 
        1 2 1
          1                                      [10 Marks]
  • 3(a) .Write a Program in ‘C’ to copy one file to another. The program should read the another.The program should read the filenames at command line. [10 Marks]
  • 3(b) Explain the meaning and usage of each of the following function prototypes:

(i) getch() (ii) strcmp() (iii)getchr() (iv) gets() (v) puts() [5x2=10Marks]

  • 4.(a) Write a Program in ‘C’ in which a two-dimensional array is represented as an array of integer pointers to a set of single dimensional integer array. [10 Marks]
  • 4(b)Write a ‘C’ program to find the sum of the given series:

S=1-2/2!+3/3!-4/4!_ _ _n/n! [10 Marks]

  • 5.(a) List and explain bitwise operators in’C’. [10 Marks]
  • 5 (b) Write a program to count the number of characters,number of words and number of lines in a given file. [10 Marks]