Introduction to Computer Programming — Major (End Semester) 2021 question paper
MMMUT Electrical Engineering previous year question paper for Introduction to Computer Programming (BCS - 101), semester 1, Major (End Semester) 2021. All 24 questions are listed below, each with a written answer on Nexsus.
Paper details
Subject: Introduction to Computer Programming (BCS - 101)
Branch: Electrical Engineering
Semester: 1
Exam: Major (End Semester) 2021
Questions: 24
Questions asked in Introduction to Computer Programming Major (End Semester) 2021
Q1(a). Write an algorithm to find angle between hour and minute hands of a clock at a given time. [2 marks]
Q1(b). Write a short note on precedence and associativity of operators. [2 marks]
Q1(c). Explain break and continue statements using proper syntax and suitable examples. [2 marks]
Q1(d). What is the difference between creating a constant using #define macro and const keyword? [2 marks]
Q1(e). Write a program in C to find largest of 3 positive integer numbers using conditional operators. [2 marks]
Q1(f). Write a C program using recursion to calculate factorial of a given number. [2 marks]
Q1(g). What would be the output of the following program segment? void main( ) { int *a, b = 30; a = &b; b = *a + 40; a = b % 5; printf("%d %d", *a, b); } [2 marks]
Q2(a). Explain the Internal Execution of a C Program. What are different types of error occurred during the execution of a program. [5 marks]
Q2(b). Draw a flowchart and write an algorithm to find out the largest among the three unequal positive numbers. [5 marks]
Q2(c). What is an Operating System (OS)? List the various types of Operating System along with its functions. [5 marks]
Q3(a). Explain switch statement. Write a program in C to do simple operations like addition, subtraction, multiplication, division etc. using a switch statement. [5 marks]
Q3(b). List the differences between while loop and do-while loop. Write a C program to find GCD of two integer numbers using ternary operator and for loop? [5 marks]
Q3(c). What is the output of following program? #include <stdio.h> void main() { char ch; int vcnt = 0, ccnt=0; for ( ch = getchar(); ch != '\n'; ch=getchar()){ if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' || ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U') vcnt++; else if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) ccnt++; } printf(" %d %d\n", vcnt, ccnt); } Rewrite the above… [5 marks]
Q4(a). Explain the declaration and initialization of two-dimensional array. Write a C program to enter n elements in an array and find the second largest number from the array. [5 marks]
Q4(b). Define recursion and its type. Write a C recursive function for multiplying two integers where a function call is passed with two integers m and n. [5 marks]
Q4(c). Give the scope and lifetime of the following variables with example. (i) External (ii) Static (iii) Automatic (iv) Register [5 marks]
Q5(a). What is a Pointer? Write a C program using pointers and function to compute the Sum, Mean and Standard deviation of all elements stored in an array of n real numbers. [5 marks]
Q5(b). What is dynamic memory allocation. Explain the use of realloc() function with a suitable example. [5 marks]
Q5(c). What is the need of a file system? Write a C program to read "mark.txt" file containing roll no, name, marks of three subjects, and calculate result in grade and store the same in a "result.txt" file. [5 marks]