Roll No……….
Total No. of Questions: 13
J-3405 [S-1261]
Paper ID
[A0502]
MCA
(Sem.-1st (S05) (O)
PROGRAMMING IN C (MCA-102)
Time: 3 Hrs. Max.
Marks: 75
Instruction to Candidates:
1. Section-A is Compulsory.
2. Attempt any Nine questions from Section-B.
SECTION-A
Q1. (a) Given the following code fragment, what
will be the value of num[3][5]?
Num[1][3]=6; num [1][4]=7;
num[1][5]=4;
Num[3][5]=(num[1][3]+num[1][5])*num[1][4];
Num[3][5]=(num[1][3]+num[3][5]*num[1][4];
(b) What is wrong with the statements: scanf (“%d”, i) ; and
putchar (‘/n’);?
(c)
Evaluate the expression (i-2* (j+k) i) for i=10, j=2. and k=3.
(d)
Are the variable names orgc and argv reserved and can only be used with the
main () function?
(e)
Write the correct conditional expression for the following code fragment:
Max=z;
If!
(x+y>z)
Max= x+y;
(f)
Are the statements *value[2]; and (*value++) ++; equivalent?
(g)
What is wrong with the following code fragment?
Char code[]= “This is a secret message…”;
Main
( )
{
Int
checksum= 0;
While
(*code)
{
Checksum + = *code;
++code;
}
}
(h)
What is the difference between MyStruct[2]. Value and MyStruct value[4]?
(i)
Explain the definition: (* what_is_this( ))( ).
(j)
Give your comment on the statement: Code that subscripts a pointer outside the
defined boundaries of the array may compile, but logically be in error.
(k)
What does fopen( ) function return if there is a no problem opening the file?
(l)
When do we use fseek( ) function?
(m)
What is the difference between line feed and carriage return?
(n)
Give an example that uses sizeof operator.
(o)
Which is better amongst the binary search or linear search, and why?
SECTION-B
Q2. Write an algorithm to
swap the value of two integers. How is it different from the corresponding
program?
Q3. List & explain any five rules for forming
variable names.
Q4 Amit sells bunches of
flowers at a flower shop. One day Amit’s boss tells him that at any time during
the day he (Amit’s boss) will need to know: (a) What is the average value of
bunches sold. (b) What was the value of the least expensive bunch sold? Draw a
flow chart to determine the same.
Q5. Write a program that
accepts a number from 1 through 7, prints the corresponding day of the week in
words using case.
Q6. Write a program to flip the 2nd
bit of the 32 bit number.
Q7. Write a program using
pointers to accept first name, middle name & last name of a student display
its initials? For example Ravi Kumar Jain should be printed as Jain R.K?
Q8. What is the self-referential structure? Can a
union be self-referenced?
Q9. What is the difference
between constant pointer and pointer to
a constant. Give examples.
Q10. Write the program for displaying the most
frequent word in a file.
Q11. What is dynamic memory allocation? Explain by
an example.
Q12. Write a C program to print the program itself.
Q13. Write a program implementing selection sort.
0 comments:
Post a Comment
North India Campus