[Analysis] STP Prev. Question analysis
📘 Chapter: Introduction to Problem Solving¶
📝 212 Term¶
Q1(c):
Define Algorithm and Flowchart? Assume there are 50 students in a class who appeared in their final examination. Their mark sheets have been given to you. The division column of the mark sheet contains the division (FIRST, SECOND, THIRD or FAIL) obtained by the student.
Write an algorithm and also draw the flowchart to calculate and print the total number of students who passed in FIRST division.
Marks: 2+2+2
📝 152 Term¶
Q1(a):
Write briefly about the following terms:
(i) Program (ii) Algorithm (iii) Flowchart (iv) Compiler
Marks: 4
Q1(b):
Write an algorithm to find largest number among three numbers. Also draw a flowchart for the written algorithm.
Marks: 2+2
📝 162 Term¶
Q1(a):
What is computer program? Discuss the steps to execute a ‘C’ program.
Marks: 1+3
📝 172 Term¶
Q1(a):
Define Programming Language. Why C is called structured programming language?
Marks: 1+1
Q1(c)(ii):
What is flow chart? Draw a flow chart to test ODD and EVEN number.
Marks: 2
📝 182 Term¶
Q1(a):
“C is a structured programming language” - Justify the statement.
Marks: 3
📘 Chapter: C Language Preliminaries¶
📝 212 Term¶
Q1(a):
“C is a structured programming language”-Justify the statement.
Marks: 3
Q1(b):
Differentiate between variable and constant. What are the rules that we should follow for a variable name?
Marks: 2+3
📝 152 Term¶
Q1(d):
Identify the syntax errors from the following program. After corrections what will be the output would you expect when you execute it?
#define PI 3.14
int main()
{
int radious;
float perimeter, area
radious = 5
perimeter = 2.0 * PI * radious;
area = PI * radious * radious;
printf("%f, %f", perimeter, area)
return 0;
}
Marks: 2+2
Q2(a):
What is data type? Explain different data types in C giving an example to each.
Marks: 1+5
Q2(c):
Briefly explain variable and constants in C.
Marks: 3
📝 162 Term¶
Q1(b):
What is identifier? Write down the rules for constructing ‘C’ identifier.
Marks: 1+3
Q1(c):
What is keyword? What is the purpose of the keyword void?
Marks: 1+1
📝 172 Term¶
Q1(b):
What is token in C programming? Write a simple program and identify what are the tokens are available there.
Marks: 1+2+2
Q1(c)(i):
What is keyword? Give some examples of C keyword.
Marks: 1
Q1(e):
Which of the followings are invalid variable names and why?
Minimum, First_name, n1n2n, _2name, num1ones, 3rd_row, n, float, Sum Total
Marks: 2
📝 182 Term¶
Q1(b):
Define keywords for C programming language.
Marks: 3
Q1(c):
Briefly describe the types of instruction in C.
Marks: 4
Q2(a):
What is a variable? Write the condition for naming a variable. What is the difference between declaring a variable and defining a variable?
Marks: 2+2+2
📘 Chapter: Input-Output¶
📝 212 Term¶
Q2(a):
What is the purpose of printf() and scanf() in C Program? Write the appropriate datatype format specifier for both printing and scanning purposes.
Marks: 2+4
📝 162 Term¶
Q1(d):
Briefly explain printf and scanf function. Write the format specifier available in ‘C’.
Marks: 4
📝 172 Term¶
Q1(d):
What is an include file? Why do you need to include STDIO.H when use printf(), puts(), or scanf()?
Marks: 1+2
📝 182 Term¶
Q1(d)(i–iv):
Find the output of following programs:
Marks: 4
(d) Find the output of following programs.
4
i.
ii.
#include <stdio.h>
main()
{
int i = 4, j = -1, k = 0, y, z;
y = i + 5 && j + 1 || k + 2;
z = i + 5 || j + 1 && k + 2;
printf("\ny = %d z = %d", y, z);
}
iii.
#include <stdio.h>
main()
{
float a = 3.5;
switch (a)
{
case 0.5:
printf("Art of C");
break;
case 1.5:
printf("Spirit of C");
break;
case 2.5:
printf("See C");
break;
case 3.5:
printf("Simply C");
}
}
iv.
#include <stdio.h>
main()
{
int x = 6, y = 3, z;
while (x >= 0)
{
if (x == y)
break;
else
printf("\n%d %d", x, y);
x--;
y++;
}
}
📘 Chapter: Pre-processor Commands¶
📝 172 Term¶
Q1(d):
What is an include file? Why do you need to include STDIO.H when use printf(), puts(), or scanf()?
Marks: 1+2
📘 Chapter: Operators and Expressions¶
📝 212 Term¶
Q2(b):
Differentiate between conditional operator in C and if-else statement in C. Write a C program to read the age of a person and determine whether he is eligible to cast his/her own vote by using conditional operator.
Marks: 2+4
Q2(c):
Which statement is efficient and why? x = x + 1; or x++
Marks: 2
📝 152 Term¶
Q2(b):
Differentiate between else-if ladder and switch statement.
Marks: 3
📝 162 Term¶
Q2(b):
What is operator? Discuss logical operator. What is the difference between = operator and the == operator?
Marks: 1+3+1
Q2(c)(i):
What will be the output of the statement printf("%c", 65);
Marks: 1
Q2(c)(ii):
Does 7%2 produce the same result as 4%3? Justify your answer.
Marks: 1
Q2(d):
Write a C program that prints the numbers divided by both 2 and 5 within the range 1 to 100.
Marks: 3
📝 172 Term¶
Q2(a):
What is operator? Briefly discuss logical operator with example. What is the difference between the = operator and the == operator?
Marks: 1+1+1
Q2(c)(iii):
What is the value of x from the following code and why?
Marks: 2
📘 Chapter: Control Statements¶
📝 212 Term¶
Q3(a):
Explain if-else structure using proper execution flow diagram.
Marks: 4
Q3(b):
What is looping statement? Differentiate between Entry controlled and Exit controlled loop.
Marks: 1+3
Q3(c):
Write a C program that prints the number divided by both 3 and 6 within the range 1 to 100.
Marks: 3
Q3(d):
Illustrate how break and continue statements affect the normal execution of a loop by suitable programming example.
Marks: 3
📝 152 Term¶
Q2(d):
Write a C program to check whether a given number is even or odd.
Marks: 2
Q3(a):
What is loop? Explain with example where for loop is suitable and where do-while loop is suitable.
Marks: 1+4
Q3(b):
What is the use of break and continue statement in C language?
Marks: 3
Q3(c):
Write a program to reverse the digits of a given integer number. For Example reverse of given number 3578 is 8753.
Marks: 4
Q3(d):
What is the output for the following C code:
value = 1;
switch (value)
{
Case 1: printf("Good");
Case 2: printf("Morning");
Case 3: printf("Cprogram");
}
Marks: 2
📝 162 Term¶
Q3(a):
Differentiate between branching and looping with appropriate example.
Marks: 6
Q3(b):
What is the use of break and continue statement in C language?
Marks: 2
Q3(c):
Classify loop control structure. Write the syntax and draw the block diagram of each of them.
Marks: 1+6
📝 172 Term¶
Q3(a):
Classify loop control structure and write the syntax of each of them.
Marks: 4
Q3(b):
If two loops are nested together, which one must finish first, the inner loop or the outer loop? Briefly explain.
Marks: 4
Q3(c):
Write down the general structure of switch-case statement with example.
Marks: 4
Q3(d):
What is the purpose of continue and break statement?
Marks: 2
📝 182 Term¶
Q3(a):
Why loops are used in structured programming?
Marks: 2
Q3(b):
What is the main difference between while and do-while loop? Show the flow chart of while loop and do-while loop.
Marks: 4
Q3(c):
Define break statement and continue statement with example.
Marks: 4
Q3(d):
Write a C program to print the following letter pattern of ‘n’ heights. For example, if n is inputted as 4, then the output would be:
Marks: 3
---¶
📘 Chapter: Storage Types¶
📝 182 Term¶
Q6(c):
Describe why the storage classes are used in C programming language.
Marks: 3
📘 Chapter: Functions¶
📝 212 Term¶
Q5(a):
Define function and function prototype. Explain arguments with return values category of function with a suitable example.
Marks: 2+2
Q5(c):
Write the following functions that:
(i) Request the user for two integers and outputs them and their sum.
(ii) Request the user for two integers and outputs their remainder after division.
(iii) Request the user for two floats and outputs their product.
Write a C (main) program to provide the above functions as options to the user using switch statement and performs the functions accordingly.
Marks: 6
📝 152 Term¶
Q6(a):
What is function? What are advantages of using function in a program?
Marks: 2+2
Q6(b):
Describe the approaches of passing arguments to a function with example.
Marks: 5
Q6(c):
What is recursion? Write a recursive function to calculate the factorial of a given integer number.
Marks: 2+3
📝 162 Term¶
Q6(a):
What is function and list out the advantages of function? Differentiate between user defined and built in function.
Marks: 1+2, 3+2
Q6(b):
Distinguish between ‘call by value’ and ‘call by reference’ techniques of arguments passing to functions.
Marks: 4
Q6(c):
Write a program to calculate the value of x to the power y (x^y) using
(i) Function, (ii) Recursive Function
Marks: 5
📝 172 Term¶
Q5(a):
What is function and list out the advantages of function? C offers two types of functions. What are they, and how are they different?
Marks: 2+4
Q5(b):
When passing arguments to a function, what's the difference between passing by value and passing by reference?
Marks: 4
Q5(c):
What is Recursion? Write a Program using recursion to determine the factorial of N numbers?
Marks: 2+4
📝 182 Term¶
Q6(a):
Why function prototyping is necessary? Distinguish between formal and actual parameter.
Marks: 2+2
Q6(b):
Why use return statement in C programming language?
Marks: 2
Q6(d):
What is recursion? Write a program to calculate sum of digits of a given n digit number using recursion.
Marks: 2+3
📘 Chapter: Arrays¶
📝 212 Term¶
Q4(a):
What are the limitations of array? Explain the declaration and initialization syntax of 1D and 2D array
Marks: 2+3
📝 152 Term¶
Q4(a):
What is an array? How is it declared?
Marks: 2+2
Q4(b):
Write a program to read the marks of 5 subjects for each of the 10 students of a class and display the average marks for each of the students.
Marks: 5
📝 162 Term¶
Q4(a):
What is an array? How does an array differ from an ordinary variable? Briefly explain.
Marks: 1+1+4
Q4(c):
Write a program to calculate summation of 10 integer’s number using array.
Marks: 3
📝 172 Term¶
Q4(c):
Suppose an array contains 10 integers. Write a C program to calculate the sum of these 10 integers.
Marks: 5
📝 182 Term¶
Q4(c):
What is an array? When should we use array? How it is declared? Explain with proper example.
Marks: 4
📘 Chapter: Strings¶
📝 212 Term¶
Q4(b):
What is a string? Explain the string handling library functions with an example of each.
Marks: 4
📝 152 Term¶
Q4(c):
Write a program for appending a string with another string. Do not use built-in functions.
Marks: 5
📝 162 Term¶
Q4(b):
What is a string? Discuss the use of any three (03) library functions of string manipulation.
Marks: 1+3
📝 172 Term¶
Q4(b):
What is a string? Briefly discuss the use of any three (03) library functions of string manipulation.
Marks: 2+3
📝 182 Term¶
Q7(a):
Write a C program to sort strings in dictionary order.
Marks: 4
📘 Chapter: Pointers¶
📝 212 Term¶
Q6(c):
What is pointer? Write the major benefits of using pointers in C programming.
Marks: 1+3
📝 152 Term¶
Q5(a):
What do you know about pointer? Define the asterisk (*) and ampersand (&) operator in terms of pointer.
What will be the output of the following program?
int main()
{
int a, b, *ptr;
a = 30;
ptr = &a;
b = *ptr;
printf("a : %d\n", a++);
printf("b : %d\n", b++);
printf("value : %d\n", *ptr);
return 0;
}
Marks: Not specified for each part (combined block)
📝 162 Term¶
Q5(c):
What is pointer? State the benefits of using pointer in a program.
Marks: 1+3
📝 172 Term¶
Q6(c):
What is a pointer? State the benefits of pointer. Show the memory representation of the following declarations:
Marks: 1+3
Q5(a):
What is pointer? How does it declared? State the benefits of pointer.
Marks: 2+2+2
Q5(b):
What will be the output of the following code segment?
int x=30; *y, *z;
y=&x; /* Assume address of x is 500 and integer is 4 byte size */
z=y;
*z++=*z++;
printf("x=%d, y=%d, z=%d\n", x, y, z);
Marks: 4
Q5(c):
With a simple C program, show how an array can be accessed using pointer.
Marks: 4
📘 Chapter: Structures¶
📝 212 Term¶
Q6(a):
How to declare and access structure variables? Explain with a suitable example.
Marks: 6
Q6(b):
What are the advantages of structure over array? How to declare the arrays within structures?
Marks: 2+2
📝 152 Term¶
Q5(b):
How does a structure differ from an array? Define a structure named BOUCSE02, which contains std_name, std_id, and std_cgpa.
Using this structure, write a program to read information of a student from keyboard and save in a file named student.txt.
Marks: 2+2+4
📝 162 Term¶
Q5(a):
What is structure? Explain the syntax of structure declaration with example.
Marks: 4
Q5(b):
How does a structure differ from an array? Define a structure named BOUCSE which contains std_name, std_id and std_cgpa.
Using this structure write a program to read this information for two students from the keyboard and prints the same on the screen.
Marks: 1+4, 2+4
📝 172 Term¶
Q6(a):
What is structure? How does a structure differ from an array? Write the syntax of structure declaration with example.
Marks: 1+1+4
Q6(b):
Define a structure type data named student which contains student_id, student_name, department and std_cgpa.
Using this structure write a program to read this information for two students from the keyboard prints the same on the screen.
Marks: 6
📝 182 Term¶
Q7(b):
Differentiate between structure and union in C.
Marks: 3
Q7(c):
Write a C program to add two distances (feet-inch system) entered by user, using structures.
Marks: 4
📘 Chapter: File Structures / File Handling¶
📝 212 Term¶
Q7(a):
What is file? State the purpose of using file.
Marks: 1+2
Q7(b):
Write the operation of the following file handling functions:
(i) fopen(); (ii) getc(); (iii) putc(); (iv) fseek(); (v) rewind.
Marks: 5
Q7(c):
Write a C program to read name and marks of n number of students from user and store them in a file named ‘student.txt’.
Marks: 6
📝 152 Term¶
Q7(a):
What is file mode? State the purpose of various file modes to open a file.
Marks: 1+2
Q7(b):
Write the purpose of the following file handling functions:
(i) fseek() (ii) getw() (iii) feof() (iv) fscanf() (v) rewind()
Marks: 5
Q7(c):
A file named ‘data.txt’ contains a series of integer numbers.
Write a C program to read these numbers and then write all the positive numbers to a file named ‘positive.txt’.
Marks: 6
📝 162 Term¶
Q7(a):
What is file mode? State the purpose of various file modes to open a file.
Marks: 1+2
Q7(b):
Illustrate various file handling operations in C.
Marks: 5
Q7(c):
A file named ‘data.txt’ contains a series of integer numbers.
Write a C program to read these numbers and then write all positive numbers to a file named ‘positive.txt’.
Marks: 5
📝 172 Term¶
Q7(a):
What is file? Write the purpose of the following file handling functions:
(i) fopen() (ii) getc() (iii) fscanf() (iv) fseek()
Marks: 1+4
Q7(b):
What is file mode? State the purpose of various file modes to open a file.
Marks: 1+4
Q7(c):
Write a C program to read name and marks of n number of student from user and store them in a file named ‘student.txt’.
Marks: 5
📝 182 Term¶
Q7(d):
What is a file? Explain the following file handling function in C-
fopen(), fread(), fwrite()
Marks: 3