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

INDIAN INSTITUTE OF INFORMATION

TECHNOLOGY MANIPUR
End Semester
Examinations, February-2023
B. Tech First Semester WANIPU
Course Name: Computer Programming Course Code: CS1011/CS101
Date: 17/02/2023 Time: 2.00 PM to 5.00 PM
Duration: 3 hours Max. Marks: 100 marks

Answer all the questions and marks are shown at the in square
right margin bracket
PART A [2x10-20]
Q1. (i) Define high-level programming language and low-level programming language.
i) Differentiate between array and structure.
(i) Define the dynamic memory allocation.
(iv) What will be the output of the following program codes?
#include<stdio.h>
int main()

int *ptr, a =10;


ptr &a;
*ptr+= 1;
printf("%d,%d/n", *ptr, a);
A. 10,10 B. 10,11 C. 11,10 D. 11,11
(v)Choose the output ofthe following program codes.
#include<stdio.h>
void foo(int"};
int main()

int i = 10, *p = &i;

foo(p++);
void foo(int *p)

printf("%d\n", *p);

A. 10 B. Some garbage value C. Compile time error D. Segmentation fault

(vi) Choose the output of the following program codes.


#include<stdio.h>
void main()

int k 5;
int *p &k
int *m= &p;
printf("%d%d%d\n", k, *p, **m);|

B.5 5 junk value C. 5 junk value D. Run time error


A.5 5 5

ITTEFRRS
INDIAN INSTITUTE OF INFORMATION TECHNOLoGY MANIPUR
End Semester Examinations, February-2023
B. Tech First Semester

(vii) Choose the output of the following program codes


#include<stdio.h>
void main()

inti =0;
intj = 0;

for(i 0;i < 5; it*)

for = 0:j < 4; j++)

if(i> 1)
continue;
printf("Hi \n");

A. Hi is printed 9 times B. Hi is printed 8 times C. Hi is printed 7 times D. Hi is printed 6 times


(vii) Choose the output of the following program codes
#include<stdio.h>
int x=11;
void main()

int x=10;
printf("%d", x);

A. Junk value B. Run time error C. 10 D. 11


(ix) Choose the output of the following program codes.
#include<stdio.h>
int main()

int i = 0, j = 0;

while (i< 5,j < 10)

I++

printf("%d, %d\n", i, j);

A.5, 5 B. 5, 10 C. 10, 10 D. Syntax error

(x) Differentiate between function call and called function


INDIAN INSTITUTE OF INFORMATION
TECHNOLOGY MANIPUR
End Semester Examinations,
February-2023 MANIPU
B. Tech First Semester

PART B

11.(a) What is pointer and pointer of a pointer? How to initialize pointers? Explain with examples.
(b) Explain the different types of control statements. [8+8=16]
12. (i) Write a progran for taking entries of hostel allotment for students with attributes (Studid, Hostel_id,
Room_no, Bed_no, Table_no, Chair_no). Program should take 5 or more entries. Display the results in
tabular format with heading as attribute names. [16
OR
(ii) Demonstrate with an example program how structure can be passed as argument and how and
structure can be returned by a function. [16]
13.()
(a) Write a program for addition of two matrices. Take input in the matrices from the user
in functions.
(6) Write a program for swapping of two numbers using function. Swapping should be done
There should not be any printing statement in the function. [8+8=16]
OR
(i) State the types of functions depending upon the categories of arguments and return statements
with an example. 16]

14.1)
(a) Differentiate between call by value and call by reference.
(b) Write a program to demonstrate the use of string functions. 18+816
OR
an array using two pointer. One pointer may demonstrate
(ii) program to access the values in
Write a
without changing the position and another by changing the positions.
[16]

15.(i) Write a program for printing the following patterns.


(b) ABCDE
(a) 1
121 FGHI
12321 JKL
MN
121
1
[16]
OR
of the series of the folowing. Use function wherever its possible.
(i) Write a program to find the sum
x/1!+x/3!+x$/5!+... +x(Zn-1/(2n-1)! |161

You might also like