0% found this document useful (0 votes)
2 views

CSE-211 Computer Programming R1 EEE

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CSE-211 Computer Programming R1 EEE

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

R1

University of Creative Technology, Chittagong (UCTC)


Department of Electrical & Electronic Engineering
B. Sc. Engineering Examination, Spring (Final)-2024
3rd Semester
Course Title: Computer Programming
Course Code: CSE-211

Time: 120 minutes Total Marks: 40

Instructions for the students: Answer any four from the following questions. All the questions contain
equal marks. Assume reasonable data if any missing. Necessary charts may be supplied on request.
Only use of calculator is allowed for the purpose of calculation. Use of any electronic devices is strictly
prohibited in the exam hall.

1. a. #include <stdio.h> 2
int main()
{
int a[2][2] = { 10, 20, 30, 40 };
int *p;
p = &a[1][0];
return 0;
}
Find the value of *p, *(p+1),*p-1,*(p-2)
b. Write a program in C to separate odd and even integers into separate arrays and display 4
them.
c. Write a program in C to sort elements of an array in ascending and descending order. 4

2. a. What will be the output of the following C code? 2


#include<stdio.h>
int main() {
int n,i;
n=f(6);
printf("%d",n);
}
f(int x) {
if(x==2)
return 2;
else {
printf("+");
f(x-1);
}
}
b. Write a program in C to get the largest element of an array using the function. 4
c. Write a C program to find factorial of any number using recursion 4
3. a. Write a program in C to compute the sum of all elements in an array using pointers. 5

b. What will be the output from the following program? 5


#include<stdio.h>
int main() {
int a[] = { 2, 6, 10, 14, 18} ;
int *ptr1, **ptr2, *ptr3;
ptr1 = a;
ptr2 = &ptr1;
ptr3 = a+2;
printf(" %d \n", *(ptr1 + 1));
printf(" %d \n", *ptr1 + 1);
printf(" %d \n", *(*ptr2+ 2));
printf(" %d \n", **ptr2 + 2);
printf(" %d \n", *ptr3 + 2);
return 0;
}

4. a. Write a program to enter the marks of 5 students in English, Mathematics and Biology 5
using a structure named Result having elements student_name, ID, eng_marks,
math_marks and bio_marks and then display the average marks of each student.
b. Write a C program to store the employee information (ID, Name, Joining date, Salary) 5
using structure. Declare a nested structure to store the joining date which includes day,
month and year.

5. a. Following file contains name and ID of 5 students: 5

Student.txt
Himel 1001
Joy 1002
Shihab 1003
Riya 1004
Samiha 1005

Write a C program to perform write operation on the file Student.txt and store the
file contents mentioned above in it.
b. Write a C program that creates a new file by deleting all the vowels(a,e,i,o u) from 5
an existing file.

You might also like