Docsity

Computer Programming Exam Paper: CSE 201, Supplementary 2019, Assignments of Compilers

Toggle sidebar
bg1
1
N NATIONAL INSTITUTE OF TECHNOLOGY SRINAGAR
Department of Computer Science and Engineering
Major (Session: Supplementary 2019)
Course: Computer Programming Course Code: CSE 201 Semester: 2nd
Max. Marks: 60 Credits: 03 Time:3 hours
Course Outcomes (CO)
CO1 Provide exposure to problem solving through programming and understand
the syntax and semantics of ā€œCā€ language.
CO2 Use comparison and limitations of various programming constructs and
choose the right one for the task in hand.
CO3 Understand the basics of programming in ā€œCā€ including various numerical
techniques, data representation formats, functions, etc.
CO4 Understand the data types offered by ā€œCā€ language including the complex
ones like arrays, structures and pointers.
Q1. CO1
a. Computer Languages can be classified in how many types? 5
b. Draw a flowchart to check whether the number is prime or not. 5
c. Explain the character set of C language. 5
Q2. CO2
a. With the help of an example explain how many types of control statements are
supported by C. 5
b. Write an algorithm to print Fibonacci series. 5
c. Explain the categories of operators used in C 5
Q3. CO2
a. Write a C program to implement the following 8
1. Prompt the user ā€œEnter temperatureā€ and record the temperature.
2. Prompt the user ā€œWhat is the preferred unit of temperatureā€?
Type F for Fahrenheit and C for Celsius.
3. If the user say C then print the temperature as such.
4. If the user says F then convert the temperature to Celsius using the formula
C = (5/9)*(F-32)
5. After conversion print the temperature.
Test the program for the following values 68 °C, 150 °F, 212 °F, 0 °F, -22 °C
b. Explain the use of break and continue statements in loops with an example. 4
c. What is an array? Explain the declaration and initialization of two dimensional arrays with
example. 3
pf2

Partial preview of the text

Download Computer Programming Exam Paper: CSE 201, Supplementary 2019 and more Assignments Compilers in PDF only on Docsity!

N NATIONAL INSTITUTE OF TECHNOLOGY SRINAGAR

Department of Computer Science and Engineering

Major (Session: Supplementary 2019)

Course: Computer Programming Course Code: CSE 201 Semester: 2 nd

Max. Marks: 60 Credits : 03 Time: 3 hours

Course Outcomes (CO)

CO1 Provide exposure to problem solving through programming and understand

the syntax and semantics of ā€œCā€ language.

CO2 Use comparison and limitations of various programming constructs and

choose the right one for the task in hand.

CO3 Understand the basics of programming in ā€œCā€ including various numerical

techniques, data representation formats, functions, etc.

CO4 Understand the data types offered by ā€œCā€ language including the complex

ones like arrays, structures and pointers.

Q1. CO

a. Computer Languages can be classified in how many types? 5 b. Draw a flowchart to check whether the number is prime or not. 5 c. Explain the character set of C language. 5 Q2. CO a. With the help of an example explain how many types of control statements are supported by C. 5 b. Write an algorithm to print Fibonacci series. 5 c. Explain the categories of operators used in C 5 Q3. CO a. Write a C program to implement the following 8

  1. Prompt the user ā€œEnter temperatureā€ and record the temperature.
  2. Prompt the user ā€œWhat is the preferred unit of temperatureā€? Type F for Fahrenheit and C for Celsius.
  3. If the user say C then print the temperature as such.
  4. If the user says F then convert the temperature to Celsius using the formula _C = (5/9)(F-32)_*
  5. After conversion print the temperature. Test the program for the following values 68 °C, 150 °F, 212 °F, 0 °F, -22 °C b. Explain the use of break and continue statements in loops with an example. 4 c. What is an array? Explain the declaration and initialization of two dimensional arrays with example. 3

Q4. CO

a. What is the output of the each program.(Justify your answer) 6 main() main() { { int i=0,x=0; int i,x=0; while(i<20) for (i=1;i<10;i=i*2) { { if (i%5==0) x++;} { printf(ā€œ%dā€,x); x+=i; } } } printf(ā€œ%dā€,x); } b. Write a function to calculate sum, and product of three numbers using call by value and call by reference 5 c. Write a program to accept any 3 x 3 matrix and print the inverse of that matrix. 4 Q5. CO a. What is the difference between Structures and Unions? Create a structure 5 ā€œEmployeeā€ with date members as ā€˜Employee Name’, ā€˜Salary’, ā€˜Department Name’. Input the value of 2 such Employees. b. What do you mean by user defined and inbuilt functions? Give some examples 5 c. Write a program to accept a line of text ā€œMississippiā€. Display the number of occurrences of each character in the line. 5