Sunteți pe pagina 1din 8

Question Paper Analysis (Question wise)

Q. 1.
Problem Definition

20
04 (Comprehension)

In this question theory on problem definition will be asked. It is same as the discussion we used to
have in the class after reading the question for understanding the question. The complete
programming theory in Appendix A of this document. Relevant problem definition theory may be
referred from that.

Use of Standard Functions

03 (Knowledge)

In this question explanation on some library functions may be asked. You may be asked to explain
about three / six library functions. The Theory Notes booklet contains the necessary information
about these library functions at two places. In the Functions chapter in tabular format and right at
the end of the booklet in slightly more descriptive form. I have tried to include all those library
function which have been asked in the past and some more. I sincerely hope nothing is asked which
is out of this collection.

C-Control Structures for Iteration

03 (Comprehension)

In this question a Theory Note on iteration may be asked. (Explanation of any of the looping structure may be
asked. You can refer to the Theory Notes booklet for the same.) It is also possible that a program based on
iteration may be given and you will be asked to either give the output or find out number of iteration of the
body of the loop. We have done such questions in the class and you may find then in the Question Set.

Function and Parameters

04 (Comprehension)

In this question either Theory question on functions or program output question on functions may be asked.
Another favorite question of MU examiners is Compare Formal parameters and Actual parameters. Answer
of this question in tabular form is given in Appendix B of this document.

Strings

03 (Application)

In this question, a small program on strings may be asked. Program for Reversal, Palindrome, String
length, Concatenation etc. all of which we have done in the class.

Pointers

03 (Comprehension)

This is the only question in the paper on the topic of pointers. It cannot be a programming question.
Either an explanation of address(&) and dereferencing operator(*) will be asked or an output
question on pointers will be asked.

Q. 2.
Scalar Data types, Scope and Lifetime, type conversion

20
05 (Comprehension)

In this question, a note on storage classes can be asked. Even though it is there in Theory Notes booklet, for
ready reference you can refer to Appendix C of this document for the same. This question may contain theory
about different data types for which you can refer to the Theory Notes booklet.

Function and Parameters

05 (Application)

This question may carry a programming question on functions. We have done many such questions in the
class.

Structures

10 (Application)

This question may carry a programming question on structures. We have done many such questions in the
class. This question is the only programming question having 10 marks. If you do all the programming

questions in the Question Set from Structures (only 5 in number) I think you should be able to answer this
question.

Q. 3.
Developing Algorithms

20
06 (Application)

C-Control Structures for Iteration

06 (Application)

Introduction to recursive functions

08 (Application)

This question, i.e. Q No 3 is a completely programming question. One algorithm question, One program on
looping and one on recursive function. We have done all these concepts by taking numerous programming
examples. Please revise the same. The difference between recursion and iteration in tabular format is given in
Appendix D of this document.

Q. 4.
Developing Algorithms

20
06 (Application)

C-Control Structures for Iteration

06 (Application)

Arrays- Single and Multidimesional

08 (Application)

Just like above question, this Q No 4 is also a completely programming question. One algorithm
question, One program on conditional statements looping and one on arrays. We have done all these concepts
by taking numerous programming examples. Please revise the same.

Q. 5.
Expressions in C; Arithmetic and Boolean expressions

20
06 (Knowledge)

This question will contain some simple questions like Expression Evaluation, Operator precedence, identifier
acceptability etc

C-Control Structures for selection

06 (Application)

This question may contain some conditional statements program.

Arrays- Single and Multidimesional

08 (Application)

In this question, a program about array will be asked. If Q No 4 array question is about 1D array, then this may
be about 2D array or it may be the other way round.

Q. 6.
Control Structures for selection

20
06 (Comprehension)

In this question, theory notes on if-else ladder and switch-case, difference between if and if-else etc. may
be asked. It is also possible that this question may ask output of a program with conditional statements.

Introduction to recursive functions

06 (Application)

In this question, a program with recursive function will be asked.

Strings

05 (Application)

In this question a program with string operations will be asked.

Files

03 (Comprehension)

This is the only question on files. If the theory on files from the Theory Notes booklet is done properly, one
should be able to answer this question.

APPENDIX A

Programming Fundamentals
What is programming?
When we want a computer to perform a specific task, such as generating a marks sheet or a
salary slip, we have to create a sequence of instructions in a logical order that a computer
can understand and interpret. This sequence of instructions is called a program. The
process of writing programs is called programming.
The task of programming involves a lot of effort and careful planning. Without this, the
computer will produce erroneous results. The following steps should go into the planning of
program:

Defining and analyzing the problem

Developing the solution logically using an algorithm

Defining and analyzing the problem


Before writing a program, we have to define exactly what
1.

data we need to provide (input) and

2.

information we want the program to produce (the output).

Once we know these, we can figure out how to develop the solution.
Deciding on input
Suppose we want to write a program to work out the total and average of a students marks
in five subjects, we would need to mention the marks in the five subjects as input.
Deciding on output
Next, we have to think of the output the elements that should be displayed and those
that should not. In the marks example, since the task is to prepare a marks sheet, the
marks in all the five subjects, their total and average should be displayed on the screen.
Developing a solution logically
Once we have defined and analyzed the problem decided on the output and the input
we can go on to develop the solution.
The most important aspect of developing the solution is developing the logic to solve the
problem. This requires creating a set of step-by-step instructions and/or rules called an
algorithm. Each step performs a particular task. We can write these steps in plain English..
The algorithm for the example on finding total marks and average would look like this:

1.

Note down the students marks in different subjects.

2.

Find the total marks scored by the student.

3.

Compute the average marks.

4.

Assign grade.

5.

Display average percentage of marks and grade.

6.

End.

For any computer program to work well, it has to be written properly. Formulating an
effective algorithm will make writing an effective program easier. For an algorithm to be
effective, it has to have the following characteristics:
1.

Finiteness: An algorithm should terminate after a fixed number of steps.

2. Definiteness: Each step of the algorithm should be defined precisely. There should be
no ambiguity.
3. Effectiveness: All the operations in the algorithm should be basic and be performed
within the time limit.
4. Input: An algorithm should have certain inputs.
5. Output: An algorithm should yield one or more outputs that are the result of
operations performed on the given input.
The famous mathematician, D.E. Knuth, first expressed these characteristics.
Programming: The next step after developing an algorithm
Once we develop the algorithm, we need to convert it into a computer program using a
programming language (a language used to develop computer programs). A programming
language is entirely different from the language we speak or write. However, it also has a
fixed set of words and rules (syntax or grammar) that are used to write instructions for a
computer to follow.

APPENDIX B

Formal Parameters
Parameters appear in function definitions.
A parameter is a type.
A function is defined in terms of parameters.
When discussing the code inside the subroutine
definition, the variables in the subroutine's
parameter list are the parameters.

Actual Parameters (Arguments)


Arguments appear in procedure calls.
An argument is an expression.
The arguments are the values supplied to the
procedure when it is called.
The values of the parameters at runtime are the
arguments.

APPENDIX C

Storage Classes
C storage class specifiers determines the physical location in memory within the computer where
the variable declared in c would be actually stored.
Storage class specifiers also determines

The initial value of the variable, if an initial value is not assigned.


The life of a variable.
The scope of the variable.

Available c storage class specifiers in the c programming language are as follows:

auto Storage Class Specifier


The variables declared in c using auto storage class are initialized with an unpredictable initial
value often called as garbage value and can be accessed from anywhere within the block in
which the variable is declared. As soon as the program control exits from the block in which it is
defined, the variable is destroyed.
By default variable in c use the auto storage class.
Syntax
auto data_type variable_name;
For example,
#include<stdio.h>
main()
{
auto int i=1;
{
{
{
printf("\n%d",i);
}
printf("\n%d",i);
}
printf("\n%d",i);
}
return 0;
}

register Storage Class Specifier


The variables declared using register storage class specifier are treated similarly like that defined
by auto storage class specifier with the only difference is that the variables are stored within the
CPU registers providing faster access.
It is recommended to use register storage class for variables which are being used at many
places.
Syntax
register data_type variable_name;
For example,
#include<stdio.h>
main()
{
register int i;
for(i=1; i<=100; i++)
printf("\n%d",i);
return 0;
}

static Storage Class Specifier


The variables declared with static storage class specifier are initialized with zero initial value if
any initial value is not provided at the time of declaration and it can be accessed from anywhere
within the block in which it is defined.
However, the variables declared with static storage class are not destroyed even after program
control exits from the block. Thus, the value of the variable persists between different function
calls.
Syntax
static data_type variable_name;
For example,
#include<stdio.h>
increment()
{
static int i=1;
printf("%d\n",i);
i++;
}
main()
{
increment();

increment();
increment();
return 0;
}

Output
1
2
3

Extern Storage Class Specifier


The variable declared using extern storage class are stored in memory with by default zero initial
value and continue to stay within the memory until the programs execution is not terminated.
Moreover, variables declared as extern can be accessed by all functions in the program, thus
avoiding unnecessary passing of these variables as arguments during function call.
It should be noted that the variables declared outside any function definition are treated as
variables with extern storage class.
Syntax
extern data_type variable_name;
For example,
#include<stdio.h>
int i;
main()
{
printf("\ni=%d",i);
increment();
increment();
decrement();
decrement();
}
increment()
{
i++;
printf("\nOn increment, i=%d",i);
}
decrement()
{
i--;
printf("\nOn decrement, i=%d",i);
}

Output
i=0

On increment, i=1
On increment, i=2
On decrement, i=1
On decrement, i=0
APPENDIX D

Recursion vs. Iterations


Both recursion and iteration can be applied to a program depending upon the situation. Table
below explains the differences between recursion and iteration.
Table Recursion Vs. Iteration

Recursion
Recursion is the term given to the mechanism
of defining a set or procedure in terms of itself.
A conditional statement is required in the body
of the function for stopping the function
execution.
At some places, use of recursion generates
extra overhead. Hence, better to skip when
easy solution is available with iteration.
Recursion is expensive in terms of speed and
memory.
Factorial Example using recursion.

Iteration
The block of statement executed repeatedly
using loops.
The iteration control statement itself contains
statement for stopping the iteration. At every
execution, the condition is checked.
All problems can be solved with iteration.

Iteration does not create any overhead. All the


programming languages support iteration.
Factorial Example using iteration.

S-ar putea să vă placă și