0% found this document useful (0 votes)
59 views15 pages

‎Untitled

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)
59 views15 pages

‎Untitled

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/ 15

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( )

***********
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–1/2 EXAMINATION – WINTER 2021
Subject Code:3110003 Date:24/03/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.

Marks
Q.1 (a) Define following terms: 04
1) Application Software 2) System Software
3) Algorithm 4) Flowchart.
(b) Draw the flow chart to find the largest of the given three numbers – 03
A ,B and C

(c) Explain different type of operators used in c language with their 07


precedence and associativity.

Q.2 (a) Discuss use of break and continue statement in C with example. 03
(b) Compare and contrast while and do while loop with example. 04
(c) Write a C program to print following pattern. 07
1
2 2
3 3 3
OR
(c) Write a C program to print following pattern. 07
1
2 3
4 5 6

Q.3 (a) Write a program to check whether entered character is vowel or 03


not?
(b) Explain getch(), getchar(), gets(), puts() . 04
(c) Develop a menu-based program to perform addition, multiplication, 07
subtraction and division using user-defined function.
OR
Q.3 (a) Write an algorithm for finding odd and even number from given 03
two numbers.
(b) Write a program to check whether entered number is prime or 04
not with the help of user-defined function check-prime().
(c) Write a program to find out the largest of an array. 07

Q.4 (a) What is structure? Explain with example how to declare a structure 03
and how to initialize it.
(b) Explain following string manipulation function. 04
strcat( ), strcpy( ) ,strcmp( ) and strlen( )
(c) Write a program in c for multiply two matrices A and B of dimensions 07
pXq and qXr respectively and store the result in third matrix C.
OR
1
Q.4 (a) Demonstrate declaration and initialization of two dimensional 03
array with suitable example.
(b) Explain nested if else ladder with suitable example. 04
(c) Write a program in c using structure to enter rollno, marks of the three 07
subject for 3 student and find total obtained by each student

Q.5 (a) What do you mean by recursive function? What care must be taken 03
while writing a program with recursive function?
(b) Explain fopen() and its mode with example. 04
(c) Describe different categories of user-defined functions. 07
OR
Q.5 (a) What is pointer? Explain how pointers are declared and 03
initialized. .
(b) Compare malloc() and calloc() functions for dynamic memory 04
allocation.
(c) Develope a program in C to check the entered number is prime or not 07
by creating a user-defined function named check_prime().
********

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE – SEMESTER 1&2 EXAMINATION – SUMMER 2020
Subject Code: 3110003 Date:05/11/2020
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.

Marks
Q.1 (a) Explain different symbols used in flowchart. 03
(b) Write algorithm or flowchart for finding maximum out of three numbers 04
entered by user.
(c) Explain different categories of operators available in C programming. 07

Q.2 (a) Explain entry controlled and exit controlled loop with proper syntax. 03
(b) Explain 1) nested if-else statement 2) break statement. 04
(c) Write a program to store 10 elements in array given by user and to find 07
maximum out of those 10 elements.
OR
(c) Write a program to find a character from the string, string and character to 07
be searched both will be given by user.

Q.3 (a) Show 1D array declaration, initialization and iteration. 03


(b) Explain type conversion and type casting with example. 04
(c) Write a C program to read numbers 1 to 7 and print relatively day Sunday 07
to Saturday using switch statement.
OR
Q.3 (a) List any three header file with its usage. 03
(b) Explain four basic data types in C and provision to extend range for 04
appropriate data types.
(c) Write a C program to find factorial of a given number. 07

Q.4 (a) Write a program to find area of triangle. 03


(b) Explain problem solving using recursion with any example. 04
(c) What is user defined function? Explain pass by value and pass by 07
reference in functions with example.
OR
Q.4 (a) Show 2D array declaration, initialization and iteration. 03
(b) Explain any four inbuilt string functions. 04
(c) Write a function in the program to return 1 if number passed is prime 07
otherwise return 0.

Q.5 (a) Explain various file management function in C. 03


(b) Show structure declaration and initialization with proper syntax. 04
(c) Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n!. 07
1
OR
Q.5 (a) What is pointer? Explain with example to store and print the address of 03
variable using pointer
(b) Show the usage of malloc( ) and calloc( ) with syntax. 04
(c) Define a structure “personal” that would contain person name, date of 07
joining and salary. Using this structure read information of 5 people and
print the same on screen. Also display sum of salary of all 5 people.

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

2
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER– I & II (NEW) EXAMINATION – WINTER 2019
Subject Code: 3110003 Date: 07/01/2020
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.

MARKS

Q.1 (a) List out types of software with Examples. 03


(b) Distinguish the data types provided by C programming language. 04

(c) Implement a C Program to convert temperature from Fahrenheit to 07


Celsius and vice versa.

Q.2 (a) Define break and continue statement with example. 03


(b) Categorize the major components of computer system and give their 04
function.
(c) List all symbols used in flowchart and draw flowchart to find 07
factorial number.
OR
(c) Construct ‘C’ program to print the following pattern using loop 07
statement.
1
22
333
4444
55555
Q.3 (a) Explain different types of constants. 03
(b) Define algorithm and explain different symbols used in flowchart. 04

(c) Demonstrate a C program to input an integer number and check last 07


digit of number is even or odd.
OR
Q.3 (a) Explain getch(), getchar(), gets(). 03
(b) List out the operators used in C language and explain any three with 04
example
(c) Write a program to find sum of first N odd numbers. Ex. 07
1+3+5+7+………..+N
Q.4 (a) Show the important of stdio.h header file. 03
(b) Describe file management. And List the various file management 04
functions.
(c) Build a function to check number is prime or not. If number is prime 07
then function return value 1 otherwise return 0.
OR
Q.4 (a) Distinguish between Structure and Union. 03
(b) Develop an algorithm to print first N Fibonacci numbers. 04
(c) Write a C program to read 10 numbers from user and store them in 07
an array. Display Sum, Minimum and Average of the numbers
Q.5 (a) Write a program to illustrate the use of fputc ( ) and fputs( ) 03
(b) Categorize User defined function’s components (elements). 04
(c) Explain the function definition, function prototype and function call 07
with relative example.
OR
Q.5 (a) List the advantages of recursion. 03
(b) Explain for loop with example. 04
(c) Explain call by value (pass by value) and call by reference (pass by 07
reference) with examples in brief.

***********
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE - SEMESTER–I &II (NEW) EXAMINATION – SUMMER-2019
Subject Code: 3110003 Date: 10/06/2019
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.
Marks

Q.1 (a) Write flowchart or algorithm to find area of a triangle. 3


(b) Write a program to reverse a given number. 4
(c) Explain various looping control structures with suitable example. 7

Q.2 (a) What are header files? Name at least 3 with its usage. 3
(b) Write a program to find 1+1/2+1/3+1/4+....+1/n. 4
(c) What is a string? Explain at least 4 built-in string functions with example. 7
OR
(c) What is an array? Explain one dimensional and two dimensional array declarations
7
and initialization with suitable example.
Q.3 (a) What is formatted output? Using printf() statement explain it. 3
(b) Write a program to check whether entered character is vowel or not? 4
(c) Write a program to print all Armstrong numbers in a given range. Armstrong
number is equal to sum of cubes of its individual digits. For example 153 = 1^3 + 7
5^3 + 3^3. So, 153 is Armstrong number.
OR
Q.3 (a) Why it is necessary to give the size of an array in array declaration? 3
(b) Explain break and continue with suitable example. 4
(c) Write a program to display transpose of given 3*3 matrix. 7
Q.4 (a) What is pointer? Which arithmetic operations are not valid on pointers? 3
(b) Explain array of pointers with suitable example. 4
(c) Write a program to calculate nCr using user defined function. nCr = n! / (r! * (n-r)!) 7
OR
Q.4 (a) What is pointer? Which arithmetic operations are valid on pointers? 3
(b) What is pointer to pointer? Write suitable example to demonstrate the concept. 4
(c) What is recursive function? Explain with suitable example. 7
Q.5 (a) What care must be taken while writing a program with recursive function? 3
(b) Explain how structure variable is initialized with suitable example. 4
(c) What are command line arguments? Explain with suitable example. 7
OR
Q.5 (a) In user defined function, what is actual argument and formal argument? 3
(b) Explain with suitable example structure variable and pointer to structure variable. 4
(c) What is dynamic memory allocation? Explain important functions associated with
7
it.
*****************

1
Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY


BE –SEMESTER 1&2(NEW SYLLABUS)EXAMINATION- WINTER 2018

Subject Code:3110003 Date: 09-01-2019


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.

Q.1 (a) Define: algorithm, flowchart, compiler 03


(b) Why null value is used in string? Justify your answer with example 04
(c) List all operators used in C and explain any three with example. 07

Q.2 (a) What is UDF? Describe advantages of UDF. 03


(b) Draw all symbols used in flowchart and draw flowchart to find factorial 04
number.
(c) Explain while loop with example. 07
OR
(c) Explain for loop with example. 07
Q.3 (a) Describe local and global variable with example. 03
(b) Explain break and continue statement with example. 04
(c) Write a C program to input an integer number and check last digit of number 07
is even or odd.
OR
Q.3 (a) Define general form of 1) do while loop 2) Nested if 3) goto 03
(b) Describe precedence and associativity of operators with example. 04
(c) Explain switch case statement with example to read number between 1 to 7 07
and print relatively day Sunday to Saturday.
Q.4 (a) What is pointer? Explain with example to print the address of variable using 03
pointer.
(b) Explain fopen() and its mode with example to write a string into file 04
(c) Define a structure data type called time_struct containing three member’s 07
integer hours, minutes, second. Develop a program that would assign values to
individual member and display the time in following format : HH:MM:SS
OR
Q.4 (a) Describe array with example. 03
(b) What is string? Explain with example to find a character from string. 04
(c) What is structure? How to access the elements of structure? How to calculate 07
size of structure? Explain with example.
Q.5 (a) Define recursion. List the advantages of recursion. 03
(b) Classification of User defined function’s components (elements) 04
(c) Create a function to check number is prime or not. If number is prime then 07
function return value 1 otherwise return 0.
OR
Q.5 (a) What do you mean by type conversion? Give example. 03
(b) Discuss parameter passing technique used in C with example. 04
(c) Create a function to swap the values of two variables. 07

You might also like