Mca 103

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Name : ……………………………………………………………

htt
Roll No. : ………………………………………………………...
Invigilator's Signature : ……………………………………….
CS/MCA/SEM-1/MCA-103/2012-13
p:/
2012
COMPUTER PROGRAMMING WITH C
Time Allotted : 3 Hours Full Marks : 70
/q
The figures in the margin indicate full marks.
Candidates are required to give their answers in their own words
pap
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )
1. Choose the correct alternatives for the following :
er.

10 1 = 10

i) Output of the following code

#define N 2 + 3
wb

main()

{ int a;
ut .

a = N* N;

printf("%d",a);
a c.

a) 25 b) 13

c) 0 d) none of these.
in

1117 [ Turn over


CS/MCA/SEM-1/MCA-103/2012-13

ii) Output of the following code :


htt
main()

{ int a [] = { 0, 1, 2, 3, 4 };
p:/
int k, * p;

for(p = a, k = 0; p + k < = a + 4; p++, k++)


/q
printf("%d",* ( p + k ));
pap
}

a) 01234 b) 024

c) Compiler error d) none of these.


er.

iii) Output of the following code :

main()
wb

{ int a [2][3] = { 1, 2, 3,

4, 5, 6
ut .

};

printf("%d",* ( * (a + 1 ) + 2));
a c.

a) 6 b) 2

c) compiler error d) none of these.


in

1117 2
CS/MCA/SEM-1/MCA-103/2012-13

iv) Output of the following code :


htt
#include<string.h>
main()
{ int k = strcmp ("abc", "Abc");
p:/
printf("%d",k );
}
a) 0 b) 65
/q
c) – 65 d) none of these.
v) Output of the following code :
pap
main()
{ printf(5 + "Fascimile");
}
a) Fascimile b) Mile
er.

c) Compiler error d) None of these.

vi) Output of the following code :

main()
wb

{ char s1[]= "hello";

char s2[]= "hello";

if(s1= = s2)
ut .

printf("Equal");

else

printf("Unequal");
a c.

}
a) Equal b) Unequal

c) Compiler error d) none of these.


in

1117 3 [ Turn over


CS/MCA/SEM-1/MCA-103/2012-13

vii) Output of the following code :


htt
#include<string.h>

main()
p:/
{ char s[]= "hello";

printf("%d", *(s + strlen(s));

}
/q
a) 0 b) 5
pap
c) Compiler error d) none of these.

viii) Output of the following code :

#include<string.h>
er.

main()

{ char ch[5];
wb

int j;

for (j=0; j<5; j++ )

ch[j]=65;
ut .

ch[j]='\0';

printf("%s", ch);
a c.

a) AAAA b) AAAAA

c) Compiler error d) none of these.


in

1117 4
CS/MCA/SEM-1/MCA-103/2012-13

ix) Output of the following code :


htt
main()

{ int a = 5;
p:/
printf("%d",a-- );

}
/q
a) 4 b) 5

c) 0 d) none of these.
pap

x) Which of the following is a bitwise operator ?

a) / b) +

c) * d) &.
er.

GROUP – B
( Short Answer Type Questions )
Answer any three of the following. 3 5 = 15
wb

2. What are the basic data types used in C language ? What

are the user defined data types ? Explain briefly.

3. Compare the purpose of break statement with that of exit().


ut .

When do we use continue statement ? 3+2


a c.

4. Defferentiate between do-while and while startements with

suitable exmaple. Distinguish between i++ and ++i

statement. 3+2
in

1117 5 [ Turn over


CS/MCA/SEM-1/MCA-103/2012-13

5. Write a C program to find the LCM of two integer numbers.


htt
6. Write a C program to print

1
1 0 1
p:/
1 0 1 0 1
1 0 1 0 1 0 1

GROUP – C
( Long Answer Type Questions )
/q
Answer any three of the following. 3 15 = 45
7. Distinguish between Automatic and Static variables. Write
pap
two C programs that calculate factorial of a number using
recursion and iteration ? Write a function to sort the
characters of the string passed to it as argument. 2+5+8

8. Write a C function to reverse the digits of an integer.


er.

Write a complete C program for reading an employees file


containing

{ emp_number, name, salary, address }. Create an output


wb

file containing the names of those employees along with their


salary and address whose salary is > 30,000. 5 + 10

9. Write a C function to reverse a string. Write a program in C


which prints the smallest divisor of an integer, for example
ut .

smallest divisor of 77 is 7. 7+8

10. What are the different functions used for file handing ?

Write a C program to create a file contains a series of integer


a c.

numbers and then reads all numbers of this file and writes
all odd numbers to other file called odd and writes all even
numbers to a file called. 5 + 10
in

1117 6
CS/MCA/SEM-1/MCA-103/2012-13

11. Write short notes on any three of the following : 3 5


htt
a) Structure

b) Macro
p:/
c) Recursion

d) Pointer
/q
e) Storage classes in C.
pap
er.
wb
ut .
a c.
in

1117 7 [ Turn over

You might also like