[go: up one dir, main page]

0% found this document useful (0 votes)
36 views13 pages

PPS GTU Question Bank

Programming for Problem Solving - GTU Book

Uploaded by

FLEX FF
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)
36 views13 pages

PPS GTU Question Bank

Programming for Problem Solving - GTU Book

Uploaded by

FLEX FF
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/ 13

Government Engineering College, Rajkot

Department of Electronics and Communication Engineering


Programming for Problem Solving
(3110003)
Question bank – 2024-25
Document Date: 8th July, 2024
Module-1 INTRODUCTION
No Question Marks Year Book
Define: algorithm, flowchart, and compiler.
OR
Define algorithm and explain different symbols used in flowchart. (2) W-18
3
OR W-19
4
1 Define following terms: S-20
1) Application Software 2) System Software W-21
1
3) Algorithm 4) Flowchart. S-22
OR S-24
Define: Compiler, Algorithm, Interpreter
OR
Define Flow chart, List the rules for designing a Flow chart and Rephrase
the merits and demerits of flow chart.
Write flowchart or algorithm to find area of a triangle.
S-19
2 OR 3
S-20
Write a program to find area of triangle.
3 List out types of software with Examples. 3 W-19
Categorize the major components of computer system and give their
Function.
4 W-19
4 OR
7 S-22
Draw block diagram of computer system and explain the functions of each
component in detail. W-22
3
OR
S-23
List out and briefly explain basic building blocks of Computer system.
OR W-23
Design block diagram of computer and explain functionalities of various
S-24
components of computer.
OR
Briefly explain different components of Computer system.
OR
Draw neat Block Diagram illustrating the Anatomy of a Computer System.
5 What are command line arguments? Explain with suitable example. 7 S-19
Draw the flow chart to find the largest of the given three numbers –
A ,B and C.
3 W-21
6 OR
4 S-20
Write algorithm or flowchart for finding maximum out of three numbers
S-23
entered by user. (3)
S-24
7 What do you mean by program and program control? 1 S-22
8 Programming needs logic building. Justify 1 S-22
Design a flowchart for checking whether a given number is palindrome or
9 7 S-22
not.
Describe various symbols used for preparing flow chart.
10 4 W-22
Write an algorithm to check whether the entered number is Even or Odd.
11 3 W-23
Draw the flowchart to find the factorial of a number given by user.
12 4 W-23
Illustrate an Algorithm to check whether the given year is leap year or not.
13 4 S-24

Module-2 Fundamentals of C
No Question Marks Year Book
List all operators used in C and explain any three with example.
OR 7 W-18
List out the operators used in C language and explain any three with
Example. 4 W-19
OR 7
1 Explain different categories of operators available in C programming 7 S-20
OR W-21
Explain different type of operators used in c language with their 7 S-22
Precedence and associativity. S-23
AND
Describe precedence and associativity of operators with example
AND
Explain the working of various bit-wise operators with the
example.
OR
List out all operators and explain any two in details.
2 Describe local and global variable with example. 3 W-18
What do you mean by type conversion? Give example.
OR 3 W-18
3 Explain type conversion and type casting with example. 4 S-20
OR 3 S-22
Explain type casting with example (2) S-23
What are header files? Name at least 3 with its usage (2)
OR S-19
3
Show the important of stdio.h header file. W-19
5 4
OR S-20
List any three header file with its usage. S-23
6 What is formatted output? Using printf() statement explain it. 3 S-19
Distinguish the data types provided by C programming language.
OR 4 W-19
7
Explain four basic data types in C and provision to extend range for 4 S-20
appropriate data types. 7 W-22
OR
List and explain different data types available in C.
8 What do you mean by enumerated data type in C language? 1 S-22
Implement a C Program to convert temperature from Fahrenheit to
9 7 W-19
Celsius and vice versa.
OR S-23
Write a C program to compute Fahrenheit from centigrade (f=1.8*c
+32).
10 Explain different types of constants. 4 W-19
11 Justify, 2 and ‘2’ both are not same in C language 1 S-22
12 What is the role of sizeof operator in C language? 1 S-22
OR W-22
Demonstrate the working of bitwise shift and sizeof operator with an 3 W-23
example.
OR
Demonstrate the use of bitwise operators with an example.
Ternary operator can be nested. (True/False)
1
13 AND S-22
3
Explain ternary (?:) operator in detail with the example (2) W-23
Write the outputs of the following expression:
i) 50 % 2 / 3 + 2
14 3 S-22
ii) 21 / (int) 2.5 + 3
iii) (1 > 2 ) || ( 2 < 3) && 5 < 1
15 Find out error(s), if any in the following code 4 W-22
and correct it:
int main() {
printf(“%f %d”, 7.0%5.0, 5 || -2);
}
16 Write a C program to check whether a three digits number is 7 S-23
palindrome or not.
17 Give the output of following C code. 3 W-23
int main(){
printf(“%d”, 15<2);
printf(“%d”, 15&&2);
printf(“%d”, 7%10);
return 0;
}
18 Explain C tokens in detail. 7 W-23

19 List the rules to assign a name to an Identifier (Variable) 3 S-24

20 Illustrate the basic structure of a C Programs and highlight usual 4 S-24


sections of main function.
21 Construct a C program which receives number of days as input and 7 S-24
converts them in to Year, Months and Days
22 Construct a C program to swap the values of two integers with use 7 S-24
of only two variables.

Module-3 Control structure in C

No Question Marks Year Book


Draw all symbols used in flowchart and draw flowchart to find factorial
number.
1 OR 4 W-18
List all symbols used in flowchart and draw flowchart to find
Factorial number.
Explain while loop with example. 7 W-18
OR 3 S-19
2 Explain various looping control structures with suitable example. 4 S-20
OR W-18
Explain entry controlled and exit controlled loop with proper syntax. W-21
S-22
OR
W-22
Define general form of 1) do while loop 2) Nested if 3) goto. S-23
OR S-24
Compare and contrast while and do while loop with example. (2)
OR
Explain while loop and do-while loop with example.
OR
Differentiate: Exit controlled Loop and Entry controlled Loop (2)
W-18
3 7
Explain for loop with example. (2) W-19
OR 4 S-23
Explain the structure of for loop with proper example.
4 Explain break and continue statement with example. (3)
OR W-18
Explain 1) nested if-else statement 2) break statement. S-19
OR 4 W-19
Discuss use of break and continue statement in C with example.(2) 3 S-20
OR W-21
Explain nested if else ladder with suitable example. (2) S-22
OR S-23
Explain else… if ladder with an example. (2) W-23
OR S-24
Differentiate between break and continue.
Explain switch case statement with example to read number between 1 W-18
5 7
to 7 and print relatively day Sunday to Saturday. (2) S-20
OR 4 w-22
Explain switch statement with an example. S-23
OR
Explain:
a) switch-case statement
b) continue statement
6 Write a program to reverse a given number. 4 S-19
7 Compare and contrast goto statement and switch statement with
4 S-22
example
Write a program to find 1+1/2+1/3+1/4+. .. +1/n. 4 S-19
8
9 Write a program to check whether entered character is vowel or not? 4 S-19
10 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 7 S-19
example 153 = 1^3 + 5^3 + 3^3. So, 153 is Armstrong number.
Construct ‘C’ program to print the following pattern using loop
Statement. (3)
1
22
333
4444
55555
OR
Write a C program to print following pattern.
1 W-19
23 7 W-21
456
11 OR S-22
Write a C program to print following pattern.
1 W-22
22 S-23
333
AND W-23
Write a program to print the triangle shown below.
A
S-24
AB
ABC
ABCD
AND
Write a C program to print following patterns :
*
**
***
****

OR
Write a C program to print following pattern using loop.
5
44
333
2222
11111

OR
Construct a C program to print following pattern
1
23
456
7 8 9 10
11 12 13 14 15…..
Demonstrate a C program to input an integer number and check last
12 7 W-19
digit of number is even or odd.
13 Write a program to find sum of first N odd numbers. Ex. 7 W-19
14 1+3+5+7+… ...... +N
Develop an algorithm to print first N Fibonacci numbers
W-19
15 OR 4
S-22
Write a program to print Fibonacci series.e.g.0, 1, 1, 2, 3, 5, 8, 13.
16 Write a C program to find factorial of a given number. (2) 7 S-20
W-22
17 Write a C program to find 1+1/2!+1/3!+1/4!+. ... +1/n!. 7 S-20
Write an algorithm for finding odd and even number from given
18 3 W-21
two numbers.
Write a C program to check whether the entered character is
19 7 W-22
alphabet, digit, space or any special character.
Find out error(s), if any in the following code and correct it:
20 3 W-22
int main() {
if(10%2==0){
break;
}
}
Examine following code and give output of it.
21 4 W-22
void main(){
int a=0;
while (a<10) {
a++;
if (a%3==1) {
continue;
}
printf (" %d", a);
}}
Examine following code and give output of it.
22 void main(){ 4 W-22
int i=1;
for (i=10; i>=1 ; --i) {
printf (“ %d”, i);
i--;
}
}
Write a C program to make sum of digits of a given number. (if input is
23 145, output should be 10) 7 W-22
Demonstrate the use of forward jump and backward jump with an
24 example. 4 W-23
Give the output of following C codes.
25 1. int main(){ 4 W-23
int i=10;
while(i<10){
printf(“%d”, i);
i++;
}
return 0;
}
2. int main(){
int i=10;
do{
printf(“%d”, i);
i++;
}while(i<10);
return 0;
}
Debug the following codes and show the output for this:
26 For ( i=0 ; i<=50 ; i++ ); 3 S-24
{
printf( “\n %d” , i )
}
*consider header files and declaration of variable is done.

Module-4 Array & String


No Question Marks Year Book
1 Why null value is used in string? Justify your answer with example 4 W-18
2 What is string? Explain with example to find a character from string. 4 W-18
What is a string? Explain at least 4 built-in string functions with
example. (2) S-19
7
OR
3 Explain any four inbuilt string functions. S-20
4
OR
7
List out all various string functions and describe them with syntax and S-22
example. W-22
OR S-23
Explain following string handling functions: I. strcat() II. strcmp() III.
strlen
Describe array with example. (2)
OR
What is an array? Explain one dimensional and two dimensional array
3
declarations and initialization with suitable example. W-18
7
OR S-19
Explain one dimensional array, two dimensional array and multi-
3
dimensional array with their syntax and example. S-20
4
OR
3
Show 1D array declaration, initialization and iteration. S-20
AND W-21
3
Show 2D array declaration, initialization and iteration. S-22
7
OR S-24
Demonstrate declaration and initialization of two dimensional
array with suitable example.
OR
Summarize the methods for initialization of One-Dimensional
Array.
5 Why it is necessary to give the size of an array in array declaration? 3 S-19
6 Write a program to display transpose of given 3*3 matrix. 7 S-19
AND S-24
Construct a C program to multiply 3X3 matrix.
Write a C program to read 10 numbers from user and store them in
an array. Display Sum, Minimum and Average of the numbers. W-19
7 OR 7
Write a program to store 10 elements in array given by user and to S-20
find maximum out of those 10 elements. (2) W-23
Write a program to find a character from the string, string and
8 7 S-20
character to be searched both will be given by user.
Explain getch(), getchar(), gets(), puts() .
4
OR
3 W-21
Explain getch(), getchar(), gets(). (2)
9 4 W-19
AND
S-22
Explain following string manipulation function.
W-22
strcat( ), strcpy( ) ,strcmp( ) and strlen( ) S-23
AND W-23
Give the significance of puts(), getchar(), getch(). S-24
OR
List the application of gets getchar and puts functions.
AND
10
What is the role of getc( ) and getw() file functions?
OR
Give the significance of getc(), getw(), fscanf().
11 Write a program to check whether entered character is vowel or
3 W-21
not?
Write a program to find out the largest of an array. 7 W-21
12
13 Write a program in c for multiply two matrices A and B of dimensions
7 W-21
pXq and qXr respectively and store the result in third matrix C.
14 What is the difference between char *p and char p[]? 1 S-22
15 Write a C program to make sum of array elements. 7 W-22
16 Write a C program to sort an array in ascending order. 7 W-22
17 Write a C program to copy one string to other without using string 7 S-23
handling function.
18 Write a C program to check whether two strings are same or not. 7 W-23
19 Give the output of following C code. 3 W-23
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;
}
20 Summarize the method for Declaration, initialization and Printing on 4 S-24
screen of a String.

Module-5 Functions
No Question Marks Year Book
1 What is UDF? Describe advantages of UDF. 3 W-18
Classification of User defined function’s components (elements)
OR 4 W-18
2 Categorize User defined function’s components (elements). 4 W-19
OR 7 W-21
Describe different categories of user-defined functions. 7 W-22
OR
Describe categories of User defined function
Create a function to check number is prime or not. If number is prime
then function return value 1 otherwise return 0.
OR W-18
Build a function to check number is prime or not. If number is prime
then function return value 1 otherwise return 0. W-19
OR 7
3
Write a function in the program to return 1 if number passed is prime S-20
otherwise return 0. (2)
OR W-21(2)
Write a program to check whether entered number is prime or S-23
not with the help of user-defined function check-prime(). (2)
OR S-24
Write a C program to check whether a number is prime or not. (2)
4 Discuss parameter passing technique used in C with example. 4 W-18
5 Create a function to swap the values of two variables. 7 W-18
Write a program to calculate nCr using user defined function. nCr = n! /
6 7 S-19
(r! * (n-r)!)
7 In user defined function, what is actual argument and formal argument? 3 S-19
Explain the function definition, function prototype and function call
7
with relative example. W-19
8
OR 1
S-22
What do you mean by function prototype?
Explain call by value (pass by value) and call by reference (pass by W-19
Reference) with examples in brief. S-20
OR 7 S-22
9 What is user defined function? Explain pass by value and pass by 3 W-22
reference in functions with example. S-23
OR 4 W-23
Differentiate call by value and call by reference. (3)
OR
What is function? Differentiate: Call by value and Call by reference.
Develop a menu-based program to perform addition, multiplication,
10 7 W-21
subtraction and division using user-defined function.
11 Differentiate function and macro. 3 S-22
12 Write a C program to find sum of digits for a given number using the 7 W-23
concept of User Defined Function (UDF). (Hint: For number 3278, sum of
digits is 3+2+7+8 = 20)
13 List the categories of User Defined Functions and Discuss any one of 4 S-24
these.
14 Construct a C program which used a user define function that receives an 7 S-24
integer and returns square and cube of it and prints in main function.

Module-6 Recursion
No Question Marks Year Boo
k
Define recursion. List the advantages of recursion.
4 W-18
1 OR
4 W-19
List the advantages of recursion.
What is recursive function? Explain with suitable example. (2) S-19
7
2 OR S-22
1
What do you mean by recursion? W-22
OR 3
W-23
Demonstrate the use of recursion with an example.
What care must be taken while writing a program with recursive function?
OR 4 S-19
3
What do you mean by recursive function? What care must be taken 3 W-21
while writing a program with recursive function?
4 Explain problem solving using recursion with any example 4 S-20
5 Write a recursive program to find factorial of a given number. 7 S-22
OR S-23
Write a C program to find factorial of a number using recursion.
6 Write a C program to generate first n number of Fibonacci series using 7 S-23
recursion.( 0 1 1 2 3 5 8…)

Module-7 Pointers
No Question Marks Year Book
What is pointer? Explain with example to print the address of variable
using pointer.
3 W-18
OR
1 What is pointer? Explain with example to store and print the address of
3 S-20
variable using pointer
1 S-22
OR
What is a pointer?
What is pointer? Which arithmetic operations are not valid on pointers?
4 S-19
2 AND
S-19
What is pointer? Which arithmetic operations are valid on pointers?
Explain array of pointers with suitable example.
4 S-19
3 OR
3 S-22
What is meant by array of pointers? Explain it with example
What is pointer to pointer? Write suitable example to demonstrate the
concept.
4 S-19
4 AND
3 W-21
What is pointer? Explain how pointers are declared and
initialized. . S-23
OR
What is Pointer in C and how it initializes? State its advantages.
5 Give the output of following C code. 3 W-23
int main(){
int val=20, *p;
p = &val;
printf(“%d %d %d”, val, *p, sizeof(p));
return 0;
}
6 Write True / False against following statements: 3 S-24
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.
7 What are the arithmetic operators that are permitted on pointers? 3 S-24

Module-8 Structure
No Question Marks Year Book
Define a structure data type called time_struct containing three
member’s integer hours, minutes, second. Develop a program that
1 7 W-18
would assign values to individual member and display the time in
following format : HH:MM:SS
What is structure? How to access the elements of structure? How to
7 W-18
2 calculate size of structure? Explain with example.
Explain how structure variable is initialized with suitable example.
OR
4 S-19
Show structure declaration and initialization with proper syntax
3 S-20
OR
3 W-21
What is structure? Explain with example how to declare a structure
and how to initialize it.
4 Explain with suitable example structure variable and pointer to structure 4 S-19
variable.
Distinguish between Structure and Union.
W-19
5 OR 3
S-22
Define Union in ‘C’ with example. 4
OR W-22
Compare structure and union. (2)
OR S-23
What is structure? How it is different from union? Explain W-23
nestedstructure with example.
Define a structure “personal” that would contain person name, date of
6 joining and salary. Using this structure read information of 5 people and 7 S-20
print the same on screen. Also display sum of salary of all 5 people. S-23
OR
Define a structure type struct personal that would contain person name,
date of joining and salary using this structure to read this information of
5 people and print the same on screen.

Write a program in c using structure to enter rollno, marks of the three


7 7 W-21
subject for 3 student and find total obtained by each student
8 Explain structure within structure with example. 4 S-22
9 Define a Structures which contains details of a Cricketer: 7 S-24
• Name of Player:
• Team name:
• Total run scored:
• Batting average:

Module-9 Dynamic memory allocation


No Question Marks Year Book
What is dynamic memory allocation? Explain important functions
associated with it. (2)
OR S-19
7
Show the usage of malloc( ) and calloc( ) with syntax. (2)
1 OR S-20
4
Show the use of Malloc, Calloc, Free and Realloc in context of Dynamic W-21
4
memory allocation. S-22
3
OR W-22
Compare malloc() and calloc() functions for dynamic memory S-23
allocation. W-23
OR S-24
Define dynamic memory allocation. Explain malloc() and calloc().
OR
List down and briefly explain methods for dynamic memory allocation.
OR
Briefly explain memory management functions.
2 Briefly explain storage class auto and extern. 3 W-22
OR 7 W-23
Briefly explain different storage classes used in C with appropriate example.

Module-10 File Management


No Question Marks Year Book
Explain fopen() and its mode with example to write a string into file.
W-18
1 OR 4
W-21
Explain fopen() and its mode with example.
Describe file management. And List the various file management
W-19
functions.
OR 4 S-20
Explain various file management function in C. (2)
2 S-22
OR 7
Explain the following File Handling functions: 1. fseek( ) 2. ftell( ) 3. W-23
fread( ) 4. fwrite( ) 5. fscanf( ) 6. fprintf( ) 7.rewind( ).
S-24
OR
Briefly explain any two file handling functions with an example.
3 Write a program to illustrate the use of fputc ( ) and fputs( ) 4 W-19
4 Explain error handling in file system with example. 7 S-22
5 Write a C program to copy content of one file to other with the help of 4 W-22
file handling functions. 7 W-23
OR
Write a C program to copy one file to other.
Distribution:

Ch. Win18 Sum19 Win-19 Sum20 Win-21 Sum- Win-22 S-23 W-23 S-24 Total
22
Ch- 1
Ch- 2
Ch- 3
Ch- 4
Ch- 5
Ch- 6
Ch- 7
Ch- 8
Ch-9
Ch-10
Total

My Strategic Chart:

Chapter Study Material GTU Previous Priority Time Devoted for


(book/ Weight Exams Sequence Reading/Preparation
handouts/ age Marks of (hours)
Quick_Ref/ (%) wise chapter
Website) distributi
ons
Ch – 1 11
Ch – 2 9
Ch – 3 11
Ch – 4 13
Ch – 5 11
Ch – 6 9
Ch – 7 9
Ch – 8 9
Ch - 9 9
Ch-10 9
Total Number of Hours for complete preparation of final GTU Exam =

You might also like