0% found this document useful (0 votes)
1 views14 pages

ppsgtupaper

The document outlines the examination structure for the Programming for Problem Solving course at Gujarat Technological University, including subject codes, dates, and total marks. It contains a series of questions covering algorithms, C programming concepts, data structures, file handling, and memory management. Each question is designed to assess students' understanding of programming fundamentals and practical coding skills.

Uploaded by

dxabhi.9138
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views14 pages

ppsgtupaper

The document outlines the examination structure for the Programming for Problem Solving course at Gujarat Technological University, including subject codes, dates, and total marks. It contains a series of questions covering algorithms, C programming concepts, data structures, file handling, and memory management. Each question is designed to assess students' understanding of programming fundamentals and practical coding skills.

Uploaded by

dxabhi.9138
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Enrolment No.

/Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–I & II EXAMINATION – WINTER 2024
Subject Code:BE01000121 Date:13-01-2025
Subject Name:Programming for Problem Solving
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Marks
Q.1 (a) Write an algorithm to check whether the entered number is Even or Odd. 03
(b) Describe various symbols used for preparing flow chart. 04
(c) Explain different type of operators used in c language with their precedence and 07
associativity.

Q.2 (a) Differentiate: Exit controlled Loop and Entry controlled Loop 03
(b) Explain: 04
a) break statement
b) continue statement
(c) Write a C program to find factorial of a number. 07
OR
(c) Construct a C program to swap the values of two integers with use of only two 07
variables.
Q.3 (a) Demonstrate the use of conditional operator statement with an example. 03
(b) Explain the structure of switch case statement. 04
(c) Write a program to print the triangle shown below. 07
1
10
101
1010
10101
OR
Q.3 (a) Write a program to check whether entered character is vowel or not? 03
(b) Explain getch(), getchar(), gets(), puts() . 04
(c) Write a program to add all the elements of an array. 07

Q.4 (a) What is structure? Explain with example how to declare a structure and how to 03
initialize it.
(b) Explain following string manipulation function. 04
strcat( ), strcpy( ) ,strcmp( ) and strlen( )

1
(c) Define a Structures which contains details of a Cricketer: 07
• Name of Player:
• Team name:
• Total run scored:
• Batting average:

OR
Q.4 (a) Debug the following codes and show the output for this: 03
For ( i=0 ; i<=50 ; i++ );
{
printf( “\n %d” , i )
}
*consider header files and declaration of variable is done.
(b) Summarize the methods for initialization of One-Dimensional array. 04
(c) Construct a C program to add 3X3 matrix. 07

Q.5 (a) Differentiate between structure and union. 03


(b) Explain fopen() and its mode with example. 04
(c) Briefly explain any two file handling functions with an example. 07

OR
Q.5 (a) Write True / False against following statements: 03
1) Pointer is a variable which holds address of location where value of other
variable is stored.
2) Pointer holds the address in form of float or integer.
3) The address of a variable can be stored in two or more pointers.

(b) Write a C program to copy content of one file to other with the help of file 04
handling functions.
(c) Develope a program in C to check the entered number is prime or not by creating 07
a user-defined function named check_prime().

*************************

2
Enrolment No./Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–I & II EXAMINATION – WINTER 2024
Subject Code:3110003 Date:07-01-2025
Subject Name:Programming for Problem Solving
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 (a) What is Software? List various types of Software. 03


(b) Define following terms: 04
1. Compiler
2. Runtime Error
3. Dynamic Memory Allocation
4. Recursion
(c) Write an algorithm and draw the flowchart to calculate sum of digits of a 07
given number N.

Q.2 (a) Explain the basic structure of a C program with an example. 03


(b) Evaluate given C programming Expressions : 04
1. Ans = 10 + 4 * 3 / 2;
2. Ans = while(1);
3. Ans = 3 * 2 > 3 + 1;
4. Ans = (2 + 4) > 3 && 2 < 4;
(c) Write a C program to print the following pattern as output: 07
A
BC
DEF
GHIJ
OR
(c) Write a C program that takes three coefficients (a, b and c) of a quadratic 07
equation ; (a.x2 + b.x + c) as input and compute all possible roots and print
them with appropriate messages.

Q.3 (a) Differentiate while loop and do..while loop with example. 03
(b) What is type conversion? Explain two types of conversion with examples. 04
(c) Write a C program which takes marks (between 0 to 100) of a student for 07
N subjects. It should print grade of a student based on Percentage of
Student's marks .
"A" for >=85%,
"B" between >=70% and <85%,
"C" between >=50% and <70%,
"PASS" between >=35% and <50%,
"FAIL", if any one subject marks are <35.

1
OR
Q.3 (a) What is function? How Call by value and Call by reference passes the 03
argument in function.
(b) What are the steps in writing a recursive function in a program? 04
(c) Write a program in C to calculate the power of any number using recursion. 07

Q.4 (a) What is string ? How to declare string in C? 03


(b) Explain significance of following string functions with example. 04
1. strcat()
2. strlen()
3. strcpy()
4. strcmp()
(c) Write a C program ,that reads a statement from user and prints the 07
frequency of each of the distinct character from a-z.
OR
Q.4 (a) Compare Array, Structure and Union. 03
(b) Define Union. Describe how to declare, initialize and access members of 04
Union with a programming example.
(c) Write a C program which takes two NxN matrices and performs matrix 07
multiplication.

Q.5 (a) What is a pointer? What are the advantages of using pointer? 03
(b) Explain need of Dynamic Memory allocation. Compare malloc(), calloc() 04
and realloc() functions.
(c) Write a C program to find the sum and mean of all elements in an array 07
using pointer.
OR
Q.5 (a) What is File Pointer? What is significance of File Pointer? 03
(b) Explain signification of following functions in file operations. 04
1. fseek()
2. ftell()
3. open()
4. fread()
(c) Write a C program to read ID and marks of n number of students from user 07
and store them in a file.

****************

2
Enrolment No./Seat No_______________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–I & II (NEW) EXAMINATION – SUMMER 2024
Subject Code:3110003 Date:12-07-2024
Subject Name:Programming for Problem Solving
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
MARKS
Q.1 (a) Draw neat Block Diagram illustrating the Anatomy of a Computer System. 03
(b) Illustrate an Algorithm to check whether the given year is leap year or not. 04

(c) Define Flow chart, List the rules for designing a Flow chart and Rephrase the 07
merits and demerits of flow chart.

Q.2 (a) List the rules to assign a name to an Identifier (Variable) 03


(b) Illustrate the basic structure of a C Programs and highlight usual sections of 04
main function.
(c) Construct a C program which receives number of days as input and converts 07
them in to Year, Months and Days,
OR
(c) Construct a C program to swap the values of two integers with use of only 07
two variables.

Q.3 (a) Contrast the Entry Control loop and Exit Control loop. 03
(b) Construct a C program to find the largest number amongst three integers 04
entered.
(c) Construct a C program to check if entered integer is a prime number or note. 07
OR
Q.3 (a) Debug the following codes and show the output for this: 03
For ( i=0 ; i<=50 ; i++ );
{
printf( “\n %d” , i )
}

*consider header files and declaration of variable is done.


(b) Explain nested if-else statement with suitable example. 04
(c) Construct a C program to print following pattern 07
1
23
456
7 8 9 10
11 12 13 14 15…..

1
Q.4 (a) List the types of Array. 03
(b) Summarize the methods for initialization of One-Dimensional array. 04
(c) Construct a C program to multiply 3X3 matrix. 07
OR
Q.4 (a) List the application of gets getchar and puts functions. 03
(b) Summarize the method for Declaration, initialization and Printing on screen 04
of a String.
(c) Define a Structures which contains details of a Cricketer: 07
• Name of Player:
• Team name:
• Total run scored:
• Batting average:

Q.5 (a) Write True / False against following statements: 03


1) Pointer is a variable which holds address of location where value of
other variable is stored.
2) Pointer holds the address in form of float or integer.
3) The address of a variable can be stored in two or more pointers.
(b) List the categories of User Defined Functions and Discuss any one of these. 04
(c) Construct a C program which used a user define function that receives an 07
integer and returns square and cube of it and prints in main function.
OR
Q.5 (a) What are the arithmetic operators that are permitted on pointers? 03
(b) Show the use of Malloc, Calloc, Free and Realloc in context of Dynamic 04
memory allocation.
(c) List and discuss file handling functions used in C. 07

*************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–I (NEW) EXAMINATION – WINTER 2023
Subject Code:3110003 Date:17-01-2024
Subject Name:Programming for Problem Solving
Time:02:30 PM TO 05:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Marks
Q.1 (a) Write an algorithm to check whether the entered number is Even or Odd. 03
(b) Draw the flowchart to find the factorial of a number given by user. 04
(c) Briefly explain different components of Computer system. 07

Q.2 (a) Give the output of following C code. 03


int main(){
printf(“%d”, 15<2);
printf(“%d”, 15&&2);
printf(“%d”, 7%10);
return 0;
}
(b) Demonstrate the use of bitwise operators with an example. 04
(c) Explain C tokens in detail. 07
OR
(c) Briefly explain different storage classes used in C with appropriate example. 07

Q.3 (a) Demonstrate the use of ternary operator with an example. 03


(b) Give the output of following C codes. 04
1. int main(){ 2. int main(){
int i=10; int i=10;
while(i<10){ do{
printf(“%d”, i); printf(“%d”, i);
i++; i++;
} }while(i<10);
return 0; return 0;
} }
(c) Write a C program to print following pattern using loop. 07
5
44
333
2222
11111
OR
Q.3 (a) Differentiate between break and continue. 03
(b) Demonstrate the use of forward jump and backward jump with an example. 04
(c) Explain else if ladder with an example. 07

1
Q.4 (a) Give the significance of puts(), getchar(), getch(). 03
(b) Differentiate between call by value and call by reference. 04
(c) Write a C program to check whether two strings are same or not. 07
OR
Q.4 (a) Give the output of following C code. 03
int main(){
int val=20, *p;
p = &val;
printf(“%d %d %d”, val, *p, sizeof(p));
return 0;
}
(b) Demonstrate the use of recursion with an example. 04
(c) Write a C program to find sum of digits for a given number using the concept 07
of User Defined Function (UDF). (Hint: For number 3278, sum of digits is
3+2+7+8 = 20)

Q.5 (a) Differentiate between structure and union. 03


(b) Briefly explain any two file handling functions with an example. 04
(c) Write a C program to find maximum and minimum from an array of 10 07
elements.
OR
Q.5 (a) Give the output of following C code. 03
int main(){
int arr[3][2]={1,2,3,4,5,6};
printf(“%d %d %d”, arr[0][1], arr[1][0], arr[2][1]);
return 0;
}
(b) Briefly explain memory management functions. 04
(c) Write a C program to copy one file to other. 07

**********

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–I & II(NEW) EXAMINATION – SUMMER 2023
Subject Code:3110003 Date:03-08-2023
Subject Name:Programming for Problem Solving
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
Marks
Q.1 (a) Design block diagram of computer and explain functionalities of various 03
components of computer.
(b) Write an algorithm to find maximum number for three given number. 04

(c) Write a C program to compute Fahrenheit from centigrade (f=1.8*c +32). 07

Q.2 (a) Differentiate: Exit controlled Loop and Entry controlled Loop 03
(b) Explain: 04
a) switch-case statement
b) continue statement
(c) Write a C program to find factorial of a number using recursion. 07
OR
(c) Write a C program to generate first n number of Fibonacci series using 07
recursion.( 0 1 1 2 3 5 8…)

Q.3 (a) Explain else… if ladder with an example. 03


(b) List out all operators and explain any two in details. 04
(c) Write a function in the C program to return 1 if number is prime 07
otherwise return 0.
OR
Q.3 (a) Explain Type casting in C with example. 03
(b) Explain the structure of for loop with proper example. 04
(c) What is function? Differentiate: Call by value and Call by reference. 07

Q.4 (a) Explain following terms: 03


a) break statement
b) getch() function
c) getchar() function

(b) Write a C program to print following patterns : 04


*
**
***
****
(c) Write a C program to copy one string to other without using string 07
handling function.

1
OR
Q.4 (a) List any three header file with its usage. 03
(b) Write a program to print following patterns : 04
1
22
333
4444
(c) Define a structure type struct personal that would contain person name, 07
date of joining and salary using this structure to read this information of
5 people and print the same on screen.

Q.5 (a) What is dynamic memory allocation? Show the use of malloc() and 03
calloc() function with their syntax.
(b) What is structure? How it is different from union? Explain nested 04
structure with example.
(c) Write a C program to check whether a number is prime or not. 07
OR
Q.5 (a) Explain following string handling functions: I. strcat() II. strcmp() III. 03
strlen
(b) What is Pointer in C and how it initializes? State its advantages. 04

(c) Write a C program to check whether a three digits number is palindrome 07


or not.

*******************************

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–I & II(NEW) EXAMINATION – WINTER 2022
Subject Code:3110003 Date:07-03-2023
Subject Name:Programming for Problem Solving
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.
Marks
Q.1 (a) List out and briefly explain basic building blocks of Computer system. 03
(b) Describe various symbols used for preparing flow chart. 04
(c) List and explain different data types available in C. 07

Q.2 (a) Demonstrate the working of bitwise shift and sizeof operator with an 03
example.
(b) Differentiate while and do..while loop. 04
(c) Write a C program to check whether the entered character is alphabet, 07
digit, space or any special character.
OR
(c) Write a C program to print following pattern: 07
1
22
333
4444

Q.3 (a) Find out error(s), if any in the following code and correct it: 03
int main() {
if(10%2==0){
break;
}
}
(b) Examine following code and give output of it. 04
void main(){
int a=0;
while (a<10) {
a++;
if (a%3==1) {
continue;
}
printf (" %d", a);
}}
(c) Write a C program to find factorial of a given number. 07
OR
Q.3 (a) Find out error(s), if any in the following code and correct it: 03
int main() {
printf(“%f %d”, 7.0%5.0, 5 || -2);
}
(b) Examine following code and give output of it. 04
void main(){
int i=1;
1
for (i=10; i>=1 ; --i) {
printf (“ %d”, i);
i--;
}
}
(c) Write a C program to make sum of digits of a given number. (if input is 07
145, output should be 10)

Q.4 (a) Difference between call by value and call by reference. 03


(b) Explain the concept of recursion with an example. 04
(c) Write a C program to make sum of array elements. 07
OR
Q.4 (a) Briefly explain storage class auto and extern. 03
(b) Explain switch statement with an example. 04
(c) Write a C program to sort an array in ascending order. 07

Q.5 (a) Give the significance of getc(), getw(), fscanf(). 03


(b) Compare structure and union. 04
(c) Describe categories of User defined function. 07
OR
Q.5 (a) List down and briefly explain methods for dynamic memory allocation. 03
(b) Write a C program to copy content of one file to other with the help of file 04
handling functions.
(c) Explain any four string handling functions with an example. 07

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE- SEMESTER–I & II(NEW)EXAMINATION – SUMMER 2022
Subject Code:3110003 Date:06-08-2022
Subject Name:Programming for Problem Solving
Time:10:30 AM TO 01:00 PM Total Marks:70
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Simple and non-programmable scientific calculators are allowed.

Q.1 Mark
(a) Answer the following questions 03
1. Define: Compiler
2. Justify, 2 and ‘2’ both are not same in C language.
3. What is the role of sizeof operator in C language?
(b) Answer the following questions 04
1. Ternary operator can be nested. (True/False)
2. What do you mean by enumerated data type in C language?
3. What is the difference between char *p and char p[]?
4. What do you mean by function prototype?
(b) Answer the following questions 07
1. Define Algorithm.
2. What do you mean by recursion?
3. What do you mean by program and program control?
4. What is a pointer?
5. What is the role of getc( ) and getw() file functions?
6. Programming needs logic building. Justify
7. Define Interpreter.

Q.2 (a) Write the outputs of the following expression: 03


i) 50 % 2 / 3 + 2
ii) 21 / (int) 2.5 + 3
iii) (1 > 2 ) || ( 2 < 3) && 5 < 1

(b) Write a program to print Fibonacci series.e.g.0, 1, 1, 2, 3, 5, 8, 13. 04

(c) Explain the working of various bit-wise operators with the example. 07
OR
(c) List out all various string functions and describe them with syntax and 07
example.

Q.3 (a) Explain ternary (?:) operator in detail with the example. 03
(b) Discuss the need of break and continue statements with example. 04

(c) Design a flowchart for checking whether a given number is palindrome or not. 07
OR
Q.3 (a) What is meant by array of pointers? Explain it with example. 03
(b) Write a program to print the triangle shown below. 04
A
AB
ABC
ABCD

(c) Draw block diagram of computer system and explain the functions of each 07
component in detail.

Q.4 (a) Explain type casting with example. 03


(b) Compare and contrast goto statement and switch statement with example. 04

(c) Write a recursive program to find factorial of a given number. 07


OR
Q.4 (a) Differentiate function and macro. 03
(b) Explain while loop and do-while loop with example. 04

(c) Explain one dimensional array, two dimensional array and multi-dimensional 07
array with their syntax and example.
OR
Q.5 (a) Differentiate call by value and call by reference. 03
(b) Explain structure within structure with example. 04

(c) Explain error handling in file system with example. 07

OR
Q.5 (a) Define Union in ‘C’ with example. 03
(b) Define dynamic memory allocation. Explain malloc() and calloc(). 04

(c) Explain the following File Handling functions: 1. fseek( ) 2. ftell( ) 3. fread( ) 07
4. fwrite( ) 5. fscanf( ) 6. fprintf( ) 7.rewind( )

***********

You might also like