0% found this document useful (0 votes)
89 views59 pages

Aio Mcs11 Tee

The document provides a sample exam paper for the subject "Problem Solving and Programming" with 5 questions. Question 1 has 4 subparts (a-d) worth 10 marks each, requiring algorithms, programs, and explanations related to array processing, file handling, string processing using pointers, and date calculations. Questions 2-5 have 2 subparts each worth a total of 10 marks, involving concepts like arrays, strings, functions, pointers, structures, files and matrices. Programs and explanations are required on topics like string processing, recursion, sorting, palindrome checking, matrix multiplication etc.

Uploaded by

shivangupta890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views59 pages

Aio Mcs11 Tee

The document provides a sample exam paper for the subject "Problem Solving and Programming" with 5 questions. Question 1 has 4 subparts (a-d) worth 10 marks each, requiring algorithms, programs, and explanations related to array processing, file handling, string processing using pointers, and date calculations. Questions 2-5 have 2 subparts each worth a total of 10 marks, involving concepts like arrays, strings, functions, pointers, structures, files and matrices. Programs and explanations are required on topics like string processing, recursion, sorting, palindrome checking, matrix multiplication etc.

Uploaded by

shivangupta890
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

No.

of Printed Pages : 3 mc s o n(s) I


-

MCA (Revised) / BCA (Revised)


Term-End Examination
December, 2016

P
MCS-011(S) : PROBLEM SOLVING AND

AP
PROGRAMMING

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)
Note : Question no. 1 is compulsory.E Attempt any
AC
three questions from the rest.
SP

1. (a) Design a flow chart and write an algorithm


to calculate the sum of all the digits of a
4-digit number. 10
(b) Write a C program to find the largest and
U

the smallest numbers in a given single


dimensional array of "n" numerical values. 10
O

(c) Write a C program to compute the age of a


N

person by taking the current date and the


date_of birth as inputs. 10
IG

(d) Write macro definitions for the following : 10


(i) To find the AREA of a circle (pi x r2
wherpi=3.14)
(ii) To find the PERIMETER of a
rectangle (2 length + 2 breadth)
MCS-011(S) 1 P.T.O.
(iii) To find the AREA of a rectangle
(length x breadth)

(iv) To find the PERIMETER of a square


(4 x side)
(v) To find the AREA of a square

P
(side x side)

AP
2. (a) What is the use of malloc ( ) function ?
Illustrate it with the help of a program
segment. 4
E
AC
(b) Write any four string functions and explain
their usage with example program
segments. 8
SP

(c) Write a C program to read formatted data


(Act_No,- CName, Balance) from a file and
U

print the information of all the customers


whose balance is equal to and more than
O

1,000. 8
N

3. (a) In C programming, what is the use of


IG

switch-case statement ? What are the rules


associated with it ? Give the complete
syntax and illustrate it with an example
program segment. 10

(b) Write a function in C to sort an array of


integers in ascending order. 10
MCS-01 1 (S) 2
4. (a) Using pointers, write a C program to test
whether the given string is a palindrome or
not. 10

(b) Define recursion. Write a C program to


find the factorial of a given number using
recursion. 10

P
AP
5. (a) Summarize the purpose of the format
strings "%f, %s, %d, %c", which are
commonly used with the printf and scanf
functions with the help of an example for
each. E 10
AC
(b) When can we find the product of
2 matrices ? Also, write a program in C to
SP

find the product of 2 matrices (A, B) and


store the result in matrix C. 10
U
O
N
IG

MCS-011(S) 3 500
No. of Printed Pages : 3 mcs-0 111

MCA (Revised) / BCA (Revised)


Term-End Examination
June, 2016
1 2 106
MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question no. 1 is compulsory.
three questions from the rest.
Attempt any
AC
1. (a) Explain how you will analyse the efficiency
SP

of an algorithm. 10
(b) Design a flow chart and write an algorithm
to calculate the factorial of a given number
U

using recursion. 10
O

(c) Explain the concept of pointer to an array.


Using this write an interactive program in
N

"C" to find out the string length of a given


string, as input. 10
IG

(d) Write a program in "C", using structures,


to calculate the Gross income and Net
income if the Attendance, Basic pay, Grade
pay, Deductions and Allowances are given
as input. 10
MCS-011 1 P.T.O.
2. (a) Write a program to read the full-name from
the keyboard and display its corresponding
short name. 10
Ex : I/P : ANIL KUMAR GULATI
0/P : A K GULATI

(b) Write a program to display the string

P
"UNIX" in the following format : 10

AP
U
UN
UNI
UNIX
UNIX
UNI E
AC
UN
U
SP

3. (a) What is the use of "continue" statement


and explain it with the help of an example ? 5
U
O

(b) Explain any four string functions with an


example for each. 10
N
IG

(c) How will you write a function with no


arguments and with return value ? Also,
write an example function — definition for
this.

MCS-011 2
. (a) Write a program to swap two values of
variables, using pointers. 10
(b) Write a program, using structures to read
and display data for 10 students. 10
Hint : Assumptions can be made wherever
necessary.

P
5. (a) Write a macro to display the string

AP
"COBOL" in the following format : 10
C
CO
COB
COBO E
AC
COBOL
COBOL
COBO
COB
SP

CO
C
U

(b) Write a program to multiply two matrices


of size M x N and N x P respectively. 10
O
N
IG

MCS-011 3 12,000
No. of Printed Pages : 2 mcs- on
MCA (Revised) / BCA (Revised)
Term-End Examination
December, 2016

P
MCS-011 : PROBLEM SOLVING AND
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question no. 1 is compulsory. Attempt any
AC
three questions from the rest.

1. (a) Give the structure of a C program. Develop


SP

an algorithm, a flow chart and a program to


add "n" numbers and find their average. 10
(b) Write a C program to illustrate how the
U

marks of 10 students are read in an array


O

and then used to find the maximum marks


obtained by a student in the class. 10
N

(c) Using pointers, write a C program to find


IG

out the position and address of the first


occurrence of any character given as input
in a string. 10
(d) Write a program, using files, to copy the
contents of one file to another with a
different file name. 10
MCS-011 1 P.T.O.
2. (a) Write a program to initialize 3 names in an
array of strings and display them. 5

(b) What is Call By Value ? Give an example. 5

(c) Explain function prototypes with an


example for each. 10

P
AP
3. (a) Write a program to print the first 10 even
numbers using "goto" statement. 10

(b) Write a program to read two strings and

using arrays. E
append the second string to the first string,
10
AC
4. (a) Write a program to swap the values using
the Pass by Value and Pass by Reference
SP

methods, separately. 10

(b) Write a program to test whether the given


string is a palindrome or not. 10
U

5. (a) What is a macro ? Write a macro to


O

demonstrate #define, #if, #else preprocessor


N

commands. 10
IG

(b) Write a program using fread( ) and fwrite( )


to create a file of records and then read and
print the same file. 10

MCS-011 2 15,000
No. of Printed Pages : 3
1 X5 4
I mc s-c• 11
MCA (Revised) / BCA (Revised)
Term-End Examination
December, 2015

MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question number .1 is compulsory. Answer any
three questions from the rest.
AC
1. (a) Draw a flowchart and write a program in
SP

`C' to implement binary search in a given


list of numbers. 10

(b) Explain the concept of dynamic memory


U

allocation with an example. 10


O

(c) Write a program in 'C' to find all


N

Armstrong numbers in the range of 0 and


999. 10
IG

Hint : An Armstrong number is an integer


such that the sum of the cube of its digits is
equal to the number itself, e.g. 153 is an
Armstrong number.

MCS-01 1 1 P.T.O.
(d) Explain the use of the following data types
with an example for each : 10
(i) enumerated data type
(ii) type def

2. (a) Without using the `strcpy' function write a

P
program to copy the contents of string 2 to
string 1, and find the length of the copied

AP
string using pointers. 10

(b) Explain the relational operators in 'C' with


an example for each.
E 5
AC
(c) What is type conversion ? What are the
different ways of type conversion ? Explain
SP

with an example for each. 5

3. (a) Explain the use of the following statements


U

with an example for each : 10


(i) Goto
O

(ii) Break
N

(iii) Exit.
IG

(iv) Continue

(b) Design an algorithm and draw a


corresponding flowchart to convert a
decimal number into an octal number
equivalent. 10

MCS-011 2
4. (a) Write a program in 'C' to display the
following output : 10
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
3 3 3 3 3
2 2 2

P
1

AP
(b) Explain the following with examples : 4x2 1 =10
2
(i) Unary operators in 'C'
(ii)
E
Multidimensional Array
AC
(iii) Syntax and Semantic errors
(iv) Size operator
SP

5. (a) Write a program in 'C' to copy the content


from one file to another file. 10
(b) What is pointer-to-pointer ? Explain the
U

need of pointer-to-pointer with an example.


O

Also show how the address of variable in


this case is calculated and determined. 10
N
IG

MCS-01 1 3 1 9,000
No. of Printed Pages : 4 I MCS-011
MCA (Revised) I BCA (Revised)
Term-End Examination
June, 2015
02493

P
mcs-011: PROBLEM SOLVING AND

AP
PROGRAMMING

Time : 3 hours Maximum Marks : 100


(Weightage 75%)

E
Note : Question number 1 is compulsory. Answer any
AC
three questions from the rest.
SP

1. (a) Explain the different storage classes in 'C'


programming language. 5

(b) What is the difference between "while-do"


U

and "do-while" loop ? 5


O

(c) Design a flowchart and then write a


program in 'C' to convert a given complete
N

string to upper case. 10


IG

(d) What do you mean by "array of pointers" ?


Write a program in 'C' to calculate the sum
of the corresponding elements of two
arrays of integers of same size. 10

MC S-011 P.T.O.
(e) List and explain the precedence of
Arithmetic, Logical and Relational
operators in 'C'. 10

2. (a) What is the difference between '&' an d '&&'

P
in 'C' ? Explain with an example. 5

AP
(b) Write a loop that calculates the sum of n
elements of the following series :
1 + 4 + 7 + 10 + 13 ....

E
Use the loop during programming in the
AC
following two different ways : 10
(i) Using while loop
SP

(ii) Using do-while loop

(c) What do you mean by scope of a variable ?


Differentiate between global and local
U

variables giving an example of each. 5


O
N

3. (a) Write a program in 'C', using structures to


IG

generate a report for n students which


displays the Roll No., Class, Subjects,
Marks, Tc•tal, Grade, etc. Assumptions can
be made wherever necessary. 10

MCS-011 2
(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 : 10
1
1 2 1

P
1 2 3 2 1
1 2 1

AP
1

4. (a) Explain the meaning and usage of each of


the following function prototypes : 5x2=10
(i) getch( )
E
AC
(ii) strcmp())
(iii) getchar())
SP

(iv) gets( )
(v) puts( )
(b) Write a program to multiply 2 matrices of
size 3 x 3. 10
U

5. (a) A 'C' program contains the following


O

declaration :
N

int arr [3] [2] = {{3, 1}, { 4, 1}, {3, 2));


IG

What is the meaning of the following : 1x5=5


(i) * (arr + 1)
(ii) * (* (arr) + 2) +1
(iii) * (* (arr) + 1)
(iv) arr
(v) (* (arr) + 1) + 1

MCS-011 3 P.T.O.
(b) Write a recursive program in 'C' to check
whether a given string is a palindrome or
not. 10

(c) Explain the syntax of switch case


statement in 'C' language. Also compare
the performance of switch case with if else

P
statement. 5

AP
E
AC
SP
U
O
N
IG

MCS-011 4 12,000
No. of Printed Pages : 2 MCS-011

MCA (Revised) / BCA (Revised)


Term-End Examination
07 464 December, 2014

P
MCS-011 : PROBLEM SOLVING AND
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question number 1 is compulsory. Answer any
three questions from the rest.
AC
1. (a) Design an algorithm and draw a
SP

corresponding flow chart and write a


C program to divide two numbers. 10
(b) What are the rules for naming variables in
C? 5
U

(c) Write a program to search in an already


O

created file "xyz.dat" which contains


students' data and update it.
N

Hint : Use file handling concept. 10


IG

(d) Write a program to calculate the first


smallest divisor of a number using break
statement. 5
(e) Write a program in C to swap the values of
two variables using pointers concept. 10

MCS-011 1 P.T.O.
2. (a) Write a program that initialises 3 names in
an array of strings and displays them. 5
(b) What is call by value ? Give example. 5
(c) Explain recursion program with a suitable
example. 10

3. (a) Write a program to print first 10 even

P
numbers using goto statement.

AP
(b) Explain Function Prototypes with an
example for each. 10
(c) Write a program to perform the
comparison of two strings (use string
function).
E 5
AC
4. (a) Write a program in C to sort list of n
integers, using any of the sorting
algorithms. 10
SP

(b) Write a program to test whether the given


string is a palindrome or not. 10

5. (a) Write a macro to demonstrate #define, #if,


U

#else preprocessor commands. 10


O

(b) Write a C program using fread() and


fwrite() to create a file of records and then
N

read and print the same file. 10


IG

MCS-011 2 14,000
No. of Printed Pages : 2 MCS-011

MCA (Revised)/BCA (Revised)


a
Term-End Examination
June, 2014

MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)
Note : Question Number 1 is compulsory. Answer any three
questions from the rest.
E
AC
1. (a) Write an algorithm and draw 10
corresponding flowchart to calculate the
factorial of a given number.
SP

(b) Using recursion, generate 'n' terms of 10


fibonacci series (n > 0).
(c) Using file handling, create a file, insert some 10
U

characters and count them.


O

(d) Using pointers concept, reverse a given 10


string.
N

2.
IG

(a) Write a program to find the string length 10


without using strlen 0 function.
(b) Write a program using C to calculate the 10
Net salary if the basic, TA, DA, allowances
and deductions are given, using structures
concept.

MCS-011 1 P.T.O.
3. (a) What is the use of continue statement ? 5
Explain with an example.
(b) Explain any four string functions with 10
example for each.
(c) How will you write a function with no 5
arguments and with return value ? Give an
example.

4. (a) Write a program to swap two values, using 10


cell-by-value method.

P
(b) Write a program in C to multiply two 10

AP
matrices A and B.

5. (a) Write a macro to display the string COBOL 10


in the following pattern.
C
CO
E
AC
COB
COBO
COBOL
(b) Define a macro to find maximum among of 10
SP

3 given numbers using # ifdef, # else.


U
O
N
IG

MCS-011 2
No. of Printed Pages : 3

MCA (Revised)
N Term-End Examination
C
December, 2012

MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weigh take 75% )

Note : Question number 1 is compulsory. Attempt any three


questions from the rest. E
AC
1. (a) Draw a flowchart and then develop an 10
interactive 'C' program which finds whether
a given integer number is prime or not.
SP

Make the use of a function subprogram.


(b) Differentiate between various storage 5
classes in 'C'.
U

(c) Write down a recursive function in 'C' to 5


calculate the factorial of a given number.
O

(d) Explain the concept of pointer to an array. 10


N

Write a program in 'C' to copy the contents


of an array to another array using pointers.
IG

(e) Write a 'C' program that will enter a line of 10


text, store it in an array and then display
backwards. The length of the line should
be undefined (being terminated by ENTER
key), but less than 80 characters.

MCS-011 1 P.T.O.
2. (a) Explain null pointer assignment. Also give 4
an example of use of null pointer.
(b) Write a macro for the following : 2x3=6
(i) to find square of a given number.
(ii) to find smallest of 3 given number.
(c) Write a program in 'C' to enter two 4 x 4 10
matrices and to display the product of these

P
matrices. Explain and give suitable

AP
documentation.

3. (a) Write a program and flowchart to display 8


the following :
A E
AC
BAB
CBA BC
BAB
SP

A
(b) Give the syntax of getch( ) and gets( ). Give 4
examples also.
U

(c) Explain the action of do-while statement. 3


With an example.
O

(d) What is the difference between a call by 5


N

value and call by reference? Explain with


examples.
IG

4. (a) Write a C program to create a file and copy 8


the contents of another given file into this
newly created file.
(b) What is # ifdef ? Give an example to explain 4
use of # ifdef.

MCS-011 2
(c) Differentiate between a structure and a 8
union. Write a structure for a student and
write a 'C' program to display the marks of
the student for five subjects and also
calculate the percentage of marks obtained.

5. (a) Give the syntax and examples of usage of 4

P
scarf() and printf( ).

AP
(b) Give 5 distinctive features of 'C' which states 6
it to be a structured programming. What
are the differences between a low level, a

E
middle level and a high level language. Give
examples.
AC
(c) Write a program to display the following 5
patterns :
1 2 3 4 5
SP

2 3 4 5
3 4 5
4 5
U

5
(d) What is array of pointers to string? Declare
O

5
an array of pointers to string having names
N

of your five friends.


IG

MCS-011 3
No. of Printed Pages : 3 MCS-011
MCA (Revised)

Term-End Examination
June, 2013

MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

Note : Question number 1 is compulsory. Attempt any three


questions from the rest.
E
AC
1. (a) Explain type cast and size of operator in C 6
language with example.
SP

(b) Write an algorithm to check whether the 5


given number is prime or not.
U

(c) What is the difference between High level 6


language and low level language ? Why C
O

is referred as middle level language ?


N

(d) How many bytes are assigned to store for 3


IG

following :

(i) Double

(ii) Unsigned char

(iii) Unsigned integer

MCS-011 1 P.T.O.
(e) Write a program segment to generate the ' 6
following pattern using "for" and
"while loop"

*
**
***

P
****

AP
Explain the concept of stepwise refinement 4
technique.
Give the C expression for the following 6
algebraic expression :
E
AC
ab4c2 — d
(i) m—n
SP

(ii) ab — [(e + f)9 /c]


U

(h) What is a logical error ? Give an example 4


of logical error in C.
O
N

2. (a) What is a structure ? How structures are 10


IG

passed as function arguments ? Explain


with an example.
(b) What is an array ? How arrays are declared 10
and initialized ? Write a C program to add
two matrices of 3 x 3 using arrays.

MCS-011 2
3. (a) Write a program to find out square and cube 6
of given number using macros.
(b) What is # define preprocessor in C. How it 4
is implemented and used in C ?
(c) What is a string ? Write a function in C to 10
convert lower case letters to upper case
letters in a given string without using

P
strupp ?

AP
4. (a) What are address and indirection operators 10
in C ? How strings are declared through
pointers ? Write a program that test a string
for a palindrome using pointer notation.
E
(b) Give the types of file supported in C. 10
AC
Explain formulated Input/Output functions
as well as string Input/Output functions.
SP

5. (a) Explain the use of following functions in 10


C:
(i) Calloc function
(ii) realloc function
U

(iii) fseek ( )
O

(iv) f tell ( )
(v) str cpy ( )
N

(b) Differentiate Sequential and Random Access 4


IG

files.
(c) Explain briefly null pointer assignment. 6
Write a program in C to illustrate this
concept.

MCS-011 3
No. of Printed Pages : 3 MCS-011

MCA (Revised)

Term-End Examination
June, 2012
fl
MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question number 1 is compulsory.
Attempt any three questions from the rest.
AC
1. (a) It is said that 'C' is a middle level language. 10
SP

Mention those features of 'C' which enables


this description. Give a short note on the
'compilation process in 'C'.
U

(b) Develop a flowchart and then write a 10


O

program in 'C' to sort strings passed to the


program through command line arguments.
N

Also display the sorted strings.


IG

(c) Define 'pointers' in C. How is a Pointer 10


variable declared ? Give examples and
explain. Enumerate the utility of Pointer
variables, with an example.

MCS-011 1 P.T.O.
(d) Differentiate between : 21/2x2=5
(i) Function and sub routine
(ii) Structure and Union with examples
of each.
(e) Give the precedence chart for the operator
in 'C'.

P
(a) Differentiate between an execution error 4

AP
and a syntax error. Give examples of
execution and syntax errors.
(b) Write and explain the action of 'WHILE' 8
E
statement. Develop a program to compute
AC
the average of every 3rd integer lying
between 1 and 100.
(c) Write a program in 'C' to copy the contents 8
SP

of one file to another file.


3. (a) Write a program in 'C' to compute the 5
series :
U

(x) + (x + n) + (x + n2) + (x + n3) +


O

for a total of m terms.


N

Where m, n and x are to be accepted by the


IG

user.
(b) Differentiate between goto statement, break 4
and continue.
(c) What is an assignment operator ? Give 3
example of its usage.

MCS-011 2
(d) What is a pointer to an array? Differentiate 8
it from an array of pointers. Write a
program using pointer to array to calculate
the sum of n given numbers.

4. (a) Implement Binary search in 'C' language. 8


(b) With every use of a memory allocation 4

P
function, what function must be used to

AP
release allocated memory which is no longer
used ? Give syntax also.
(c) Write a recursive function in 'C' to count 8

E
the number of nodes in a singly linked list.
AC
5. (a) How are arrays processed in 'C' ? Illustrate 6
with the help of 2-D arrays as examples.
SP

(b) Give syntax of gets ( ) and getch ( ) ? 6


Also give examples of usage of scanf ( ) and
printf O.
U

(c) A program in 'C' language contains the 8


following declaration :
O

Static int x[8] = {1,2,3,4,5,6,7,8};


N

What is the meaning of :


IG

(i) x?
(x + 2) ?
(iii) *x?
(iv) *(x + 2) ? Explain the results.

MCS-011 3
No. of Printed Pages : 3 m cs-0111
MCA (Revised)

Term-End Examination
December, 2011
0-•
O
MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

Note :
E
Question number 1 is compulsory. Answer any three
qu. estions from the rest.
AC
1. (a) What are different basic data types in C ? 10
SP

Explain the need of different numeric data


types with example of each.

(b) Given the sizes of three different sides, write


U

a C program to find whether a triangle can


be formed or not.
O
N

(c) What are the logical operators in C ? 5


Explain how they can be used for
IG

constructing the logical expressions ?

(d) What is an array ? Write a C program using 5


array to find largest and smallest number
from a list of 100 given numbers.


MCS - 011 1 P.T.O.

(e) Write a C program using switch to 5


determine, whether the root of a quadratic
equation is real or not.
(f) Differentiate between call by value and call 10
by reference using example program.

P
2. (a) Write a function subs(s, n) in C, which 5
prints the first n-characters of the string s

AP
provided n is less than the length of the
string.

(b) Write a program in C to display the string 5
E
"ARRAY" in the following format :
AC
A
AR
SP

ARR
ARRA
ARRAY
U

(c) What is union ? How it is different from 10


O

structure ? Explain. How a union is


declared in C ? Also write a program in C
N

to show use of union.


IG

3. (a) Explain the differences between static and


auto variables, with example of each.
(b) Write a C program using pointer to reverse 10
a given string.

MCS-011 2
(c) Explain the syntax of do-while statement.
Also differentiate do-while from while
statement.

4. (s) What is recursion ? Write a C program 10


using recursion to print the Fibonacci series
upto a given number.

P
(b) Write a C program using array to find the 10

AP
average price of apples and oranges, in ten
cities in the country.

5.
E
(a) Write a C program to store string "This is 10
AC
my file" in a file.

(b) What is pointer to pointer ? Explain need 10


SP

of pointer to pointer with an example. Also


show how address of variable in this case is
calculated/ determined ?
U
O
N
IG

MCS-011 3
No. of Printed Pages : 3 MCS-011

MCA (Revised)
Term-End Examination
June, 2011

P
MCS-011 : PROBLEM SOLVING AND

AP
PROGRAMMING

Time : 3 hours Maximum Marks : 100


(Weightage 75%)

Note : E
Question number 1 is compulsory. Answer any three
AC
questions from the rest.
SP

1. (a) What is an algorithm ? Explain basic 5


features of an algorithm.
(b) Write a C program to check whether a 10
given string is a palindrome or not.
U

(c) Consider the following program segment in 6


O

programming language C :
N

sum = 0;
IG

for(i=1; i <10; i++)


sum + = i;
Write an equivalent program segment using
(i) do - while
(ii) while

MCS-011 1 P.T.O.
(d) What is a syntax - error ? Give an example
of syntax error in a C - program.

(e) Explain different arithmetical and logical 10


operators available in C, with the help of
examples.

P
(f) Explain the use of malloc function in 5

AP
C programming.

2.
E
(a) What is an array ? Write a C program to 10
add two matrices of 3 x 3 using arrays.
AC
(b) What is the scope of a variable ? Explain 10
difference between global and local variable
SP

with example program.


U

3. (a) What is a string ? Write a function in C for 10


O

string concatenation. Without the use of


inbuilt string function.
N

(b) What is a macro ? Explain how a macro is 10


IG

defined in C. Also explain major differences


between a macro and a function. Explain a
situation when macro should be prefered
over function with an example.

MCS-011 2
4. (a) What is a file in C programming ? Explain 10
the use of fopen function in file handling.
Explain different mode in which a file can
be opened.
(b) What is a pointer ? Write a C program 10
using pointer to print the name and price

P
of the items sold in a retail shop on a specific
date.

AP
5. (a) What is a structure ? Explain how a 10

E
structure is declared in C. Write a program
in C using structure to store records of
AC
students in a class of 20 students.
(b) Write a C program to demonstrate the use 5
SP

of switch - case statement.


(c) What is recursion ? Write a recursive 5
C program to find the factorial of a given
U

number.
O
N
IG

MCS-011 3
IG
N
O
U
SP
AC
E
AP
P
IG
N
O
U
SP
AC
E
AP
P
IG
N
O
U
SP
AC
E
AP
P
No. of Printed Pages : 3 mcS-on I

MCA (Revised)

O Term-End Examination
O June, 2010
O
MCS-011 : PROBLEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

Note : Question Number 1 is compulsory. Attempt any three

E
questions from the rest.

AC
1. (a) Write a program in C to search a record in 10

SP
an existing file and to update it.
Explain the concept of array of pointers. 10
Using pointers write a program to test
U whether the given string is a palindrome or
not.
O
Differentiate between
N

Various storage classes 6


IG

Structure and union 4


(d) Why C is called a middle level language ? 10
Give a flowchart to explain the program
execution process. Explain each step in
detail.


MCS-011 1 P.T.O.

2. (a) Write a program to search an element in a 8


given list of elements using linear search.
Write a recursive program to calculate the 8
factorial of a given number.
Give an example to explain null pointer 4
assignment.

3. (a) Write a program in C to find the 5

P
multiplication of 2 matrices of size (3 x 3).

AP
(b) Write a macro for the following : 4x2=8
to find largest number among 3 given
numbers.

E
to find cube of a given number.
(c) Write a program in C, using structures to 7

AC
generate a report for students which
displays Roll No. and Name of student, total
marks obtained by the student. Assumptions

SP
can be made wherever necessary.

4. (a) Write a program and flowchart to display 8
U the following pattern :
H
O
He
N

HeL
HeLL
IG

HeLLO
HeLL
HeL
He
H

MCS-011 2

Write a macro to demonstrate : 6
#define, #if, #else
preprocessor commands.

Write a program in 'C' to find 6
12 +32+ 52+ 72 +92+ +N2

P
5. (a) Write a program to append the contents of 7

AP
second file to the contents of first file.
Explain the difference between a top-down 5
approach and a bottom-up approach in

E
programming.

AC
What do you understand by a decision- 8
control statement ? Give an example of
each.

SP
U
O
N
IG
MCS-011 I

MCA (Revised)
Term-End Examination
7 . December, 2009

MCS-011 : PROBLEM SOLVING AND

P
N PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
(Weightage 75%)

E
Note : Question Number 1 is compulsory. Answer any three
question from the rest.
AC
1. (a) Develop an algorithm, and write a program 10
SP

to print the Fibonacci series upto a given


number using recursion.
What do you understand by function 10
prototype ? Write a program in 'C' to
U

calculate the GCD of three numbers using


O

the function prototype.


List and explain any 5 reserved words of 10
N

'C' language.
IG

Differentiate between call by value and call 5


by reference methods of parameters passing
to a function giving an example of each.
What will be the output of following 'C' 5
programme ?

MCS-011 1 P.T.O.
main 0

int i = 1, j = 1;
for (;;)

P
if (i > 5)

AP
break;
else
j + = 1;
printf ("In %d", j)
E
AC
i + = j;
}
SP

What do you mean by scope of a variable ? 5


U

Differentiate between Global and Local


O

variables giving an example of each.


Explain the syntax of switch case statement 5
N

in 'C' language. Also compare the


IG

performance of switch case with if else


statement.
(c) Draw a flowchart and write a program in 10
'C' to convert a decimal number to its octal
equivalent.

MCS-011 2
(a) What are the precautions that must be taken 10
care to use macros in 'C' ? Define a macro
to find the factorial of a given number n ?
(b) Write a program in 'C' to find whether a 10
given number is Amstrong number or not.

P
(a) Write program in 'C' for the multiplication 10

AP
of two square matrices.
(b) What is pointer variable ? How is a pointer 10
variable declared ? How is the address of a

E
pointer variable determined ? How pointer
can be used to pass an entire array to a
AC
function in C ? Explain with the help of an
example.
SP

5. (a) Explain fprintf ( ) and fscanf ( )statements


with an example of each. 10
U

(b) Write a program in 'C' :


10
To reverse a string
O

To copy strl to str2 without the use of


N

stropy function.
IG

-o0o-

MCS-011 3
MCA (Revised)

!o Term-End Examination
br-)
\o ]une, 2009
6\
MCS-011 : PROBTEM SOLVING AND

P
PROGRAMMING

AP
Time : 3 hours Maximum Marks : 100
pVeightage75%)

Note : QuestionNumber1 is compulsory. Answerany three


questionfro* the rest.
E
AC
7., (u) Develop an algorithm, draw the 10
corresponding flow chart and write a
SP

program in'C' to print the sum of the digits


of a three digit number.
U

(b) Write a program that does not use the 10


inbuilt string function to perform the
O

following :
N

(i) To compare two strings


IG

(ii) To concatenatetwo strings

(.) Write 'C' programs to read a string and 10


check whether it is palindrome or not.

MCS-011 P.T,O.
(d) Write the output of the following program :

main( )

t
int x :2, y:3, 51,32 ;
S L- x + ( + + y ) ;

P
32: * *x*y+ +;

AP
printf ("%d%d%d%d\n",
51,52,x, y);

(e)
E
Differentiate between structure and union.
AC
2. (u) Summarize the purpose of the format strings 10
(like %s, %d, %c) that are corrunonly used
SP

within the printf function, with an example


for each.

(b) Write a Program in 'C' to print the following 1-0


U

output 'n' rows.


O

for example, if n:3, the following should


N

be output by the program :


IG

1
1 2 L
r 2 3 2 1
1 2 L
1

MCS-011
3. (u) Write a Program in 'C to copy one file to 10
another. The program should read the
filenames at command line.
(b) Explain the meaning and usage of each of
the following function prototypes : 5x2=10
(0 getch ( )

P
(i0 strcmp ( )

AP
(iii) getchar ( )
(i") gets ( )
(") puls ( )

E
AC
4. (u) 'C'
Write a Program in in which a 10
two-dimensional affay is represented as an
array of integer pointers to a set of single
SP

dimensional integer array.

(b) 'C' L0
Write a program to find the sum of the
given series :
U

S:L -2/21+3/3!-4/4t n/nl


O
N

J. (u) List and explain bitwise operatorsin 'C'. 1,0


IG

(b) Write a program to count the number of L0


characters,number of words and number
of lines in a given file.

-oOo-

MCS-011
IG
N
O
U
SP
AC
E
AP
P
MCA (Revised)
Term-End Examination
December,2(X)8

P
AP
' MCS-011: PROBLEM SOLVING AND
PROGRAMMING
Time : 3 hours MaximumMarks :100
|f)

E
(Weightage75%)
AC
nfoA : Questionnumberl is compulsory. Answerany three
!
.-{ questionsfrom the rest.
SP

1. (a) Design an algorithm, draw a corresponding 10


flow chart and write a program in'C', to
find the factorial of a given number using
recursion.
U

(b) Write a'C' program to find whether a given l0


O

five digits number is a palindrome.


(") Write a program in'C' to find all Armstrong 10
N

numbers in the range of 0 and 999.


IG

Hint: An Armstrong number is an integer


such that sum of the cubes of its digits is
equal to the number itself, e.g. : 153 is
Armstrong number.
(d) When can two matricesof order mxn and 10
p x q be multiptied ? Also write a program
in 'C' to multiply two such matrices.
2. (u) Write a program in 'C' to generate a 10
progress report for students which displays
the total marks, avetage,and grades. The
input for the system are marks secured in
five courses (Assignment and Term end

P
Examination). Pass (40%) in both the
components are compulsory. Grades may

AP
be given accordingly. Assumptions can be
made if necessaryand specify them.

(b) What is the difference between " &" and. 5

E
"&&' ? Explain with an example.
AC
(c) Write a loop that calculate sum of. the n 5
elements of the series:
SP

'1.
+7 +13 +'1,9+ 25 +
Write the loop in 3 different ways :

(i) using while loop


U

(ii) using do-while loop


O
N

3. (u) Write a macro to find out whether the given z


IG

character is lower case or not.

(b) Write a program in'C'to check whether 8


the given ye.aris leap or not. Also explain
the logic of the program.

(c) Write a function definition to find the s


smallest among the given three numbers.
4. (a) Without using the'strcpy'functiorL write a 10
program to copy contents of string 2 to
string 1, and find the length of the copied
string using pointers.
(b) Write the usage of the following data types, 10

P
with an example for each:

AP
(i) enumerated data type.
(ii) typedef.

E
J. (a) Design an algorithm and draw 10
AC
corresponding flow chart to convert a
decimal number to its Hexadecimal
equivalent.
SP

(b) Explain the following storageclassspecifiers 1.0


of a variable in terms of default value,
lifetime, scope purpose and limitations
U

(with an example)
(i) Auto
O

(it Register
N

-oOo
IG
IG
N
O
U
SP
AC
E
AP
P
'MCA (Revised)

Term-End Enamination
June. 2OO8

P
AP
MCS-011: PROBLEMSOLVINGAND
PBOGRAMMING

Time : 3 hours MaxlmumMorks: 7OO


E (Wetghtoge75Vo)
AC
Note :
SP

(il Questionnumber7.ls compulsory.

ii) Attenipt ony three questlonsfrom the r*t.


U

1. (a) Design an algorithm, draw a corresponding


flowchart and then write a program in C to
O

convert a given stdng to lower case. 10


N

(b) Wdte an algorithm and program in C to generate


IG

fibonacci series. Use recursion. 10


_
(c) Draw a flowchart and wfite a program in C to
calculatethe number of vowels in a given string. 10

MCS-o1
1 P.T.o.
(d) 'array of pointers' ? Write a
What do you mean by
program in C to calculate the difference of ihe
corresponding elements of tr,vo arrays of integers of
same size. 10

2. (a) Write the rsage of the following (with an example of

P
each):
(i) *define

AP
(i0 enurn

(b) Write a macro for the following :


(i)
E
to find the smallest number among 3 given
numbers.
AC
(ii) to find the factorial of a given number N.

(c) What are the differen-ies"-libtwden stmch.rre and


SP

union ? Give one illustrative example of usage o{ the


union.

3. (a) Write a program in C, using structuresto generatea


U

report for employees which displays the total salary,


O

designation, department, address etc. Assumptions


can be made wherever necessary.
N

(b) Write a program to read formatted data from the


IG

file.

(c) Give a brief note on nul.l pointer assignment. Write a


program in 'C'to illustratethis concept.

MCS-Or
1
4. (a) Write a program which reads a file and counts the
number of lines and words in the file, assumingthat
a line can contain at most 80 characters. g
(b) Give differences betvveen r 6
(i) Sequential and Random Access files
(ii)

P
Global varlable and Lncal r/adable
(c) Write a program and flowchart to display the

AP
followingpattem: 6
1
2 3
4 5 6 E
AC
7 8 9 1 0
11 12 13 14 15
SP

16 17 18 19 20 2l

5, (a) Write a program in C to find the differencebetween


two matricesof size (3 x 3). s
U

O Write a program in C to sort a given list of numbers


O

using bubble sort. Draw corresponding flowchart


also. 7
N

(c) Explain meaning of following prototypes and


mention return data type of each of-them : g
IG

(i) int ('0 (char-);


(ii) int .f (charJ;

{iii) double f (int a, int b, char c);


(lv)' unsignedf( );

M C S - O I1 3 14,OOO
IG
N
O
U
SP
AC
E
AP
P
Mc$011@

MCA (Revised)
Term-End Examination
June, 2OO8

P
AP
MCS-011@: PBOBLEMSOLVTNG
AND
PROGRAMMING
Time : 3 hours MaximumMarks: 700

E (Weightage75Vo)
AC
Note r Question number 7 is compulsory. Attempt ang
th"ee questionsfrom the rest-
SP

f. (a) Draw flowchart and then write a program in C to


find the largestelement in a 3 x 3 matrix. j.0
What do you understand by ,function prototype' ?
U

(b)
Write a program in 'C' to calculatethe cube of a
O

glven integer using the function prototype- 7O


(c) Write dov,rnan algorithm and wriie a program in ,C'
N

to sort a given list of numbers by bubble sort. 10


IG

(d) What are the r,rariousstorage classesin ,C' ? Give


examples of each. Also explain the requirement of
linking a compiled file. 10

M C S - 011@ P.T.O.
x be
2. (a) When can 2 matrices of order a x b and c d
product
multiplied ? Write a program in C to find the
of 2 such matrices'
(b) Wdte a program to create a file of records,read the
records and Print the same.
to
(c) Draw a flowchart and wdte a program using C

P
convert a decimal number to its hexadecimal
equivalent.

AP
3. (a) What are the precautions that must be taken care of
to use macros in C ? Define a macro to find the
product of n numbers

What do you understandby E


'Recursion' ? Write a
AC
(b)
program in C to illustrate a recursive function for
calculatingpower of a number'a' raised by another
'b',
number i.e., ab.
SP

in
(c) Write a program in'C'to sort a list of strings
alphabetical order, using an array of pointers'
10
U

+. (a) Design an algorithm, draw a correspondingflowchart


'C' io print the output in the
and write a program in
O

following format :
70
N

I
l 2
IG

7 2 3
| 2 3 4
7 2 3 4 5
r 2 3 4 5 6

M c s - 011o
(b) What do you understand by a decision control
statement ? Give an example in the form of a
progrdm in 'C' to illustratethe use of if-then-else'
'switch-case'
and in a menu-drivenprogram. 7
(c) Give an example to give use of enum in 'C'
language. J

P
5, (a) Differentiate between a 'structure' and a 'union'.

AP
Give the s/ntax of both. Illustrateeach with the help
of an example.
(b) Write a program in'C'to concatenate2 strings
'strl'
namely
function. E
and str2' without the use of strcat
AC
(c) Write a loop that calcr-rlates
the sum of the given
senes i
SP

1 + 3 + 5 + 7 + 9 + 1 1+ . . . . . .
Write the loop in three different ways ; 10
(i) while loop
U

(ii) do-while loop


(iii) for loop
O
N
IG

M c s - 011o 4,OOO
IG
N
O
U
SP
AC
E
AP
P

You might also like