0% found this document useful (0 votes)
24 views

PSTC QUESTION BANK ON MODULE -3_4_5

Uploaded by

roshnithambi399
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)
24 views

PSTC QUESTION BANK ON MODULE -3_4_5

Uploaded by

roshnithambi399
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/ 3

(AUTONOMOUS)

Affiliated to JNTUH, Approved by AICTE, Accredited by NAAC with A++ Grade, ISO 9001:2015 Certified
Kacharam, Shamshabad, Hyderabad – 501218, Telangana, India
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

PROBLEM SOLVING THROUGH C Question Bank

Q. No Unit-III (1 Marks) CO# BL#


1. How would you initialize a two-dimensional array and give an example CO3 L2
2. Write the code snippet to read and display a one-dimensional array of float values. CO3 L3
3. How are elements accessed in a one-dimensional array? CO3 L2
4. List out the advantages of using arrays in programming. CO3 L2
5. Identify and list different types of arrays. CO3 L2
6. Can an array hold different data types? Justify your answer. CO3 L3
7. What is the default value of elements in an integer array in C? CO3 L2
8. Determine the size of an array declared below
CO3 L2
Char a[]={‘v’,’a’,’r’,’d’,’h’,’a’,’m’,’a’,’n’};
9. Can the size of an array be changed once declared? Why or why not? CO3 L3
10. Write code snippet to find the sum of array elements. CO3 L3
11 How do strcpy() function is used in handling strings? Give an example for it. CO3 L3
12 Which function is used to find the length of the string? CO3 L2
13 Give the syntax of strncat() function and give an example for it. CO3 L3
14 What is the default value of uninitialized characters in a string array? CO3 L3
15 Which functions is used to read multiple strings? CO3 L2
16 What is a string in C language? CO3 L2
17 Which header file is required to use string handling functions? CO3 L2
18 Write the syntax of strcmp() function and describe the value returned by it. CO3 L3
19 What is the output of strlen("C Programming")? CO3 L2
20 What is the purpose of command-line arguments in C? CO3 L2

Q. No Unit-IV (1 Marks) CO# BL#


1. Explain the concept of recursive function? CO4 L2
2. Write the code fragment to calculate Fibonacci nth term using recursion CO4 L3
3. Write the syntax to declare, define and call a user defined function CO4 L2
4. List out the demerits of recursion CO4 L2
5. What is the purpose of the return statement in a function? CO4 L3
6. Give an example of a simple recursive function in C. CO4 L2
7. What is the difference between a function declaration and a function definition? CO4 L2
8. What will happen if a recursive function does not have a base case? CO4 L3
9. Write the syntax to define a user defined function in C language. CO4 L2
10. Can a function return multiple values in C? CO4 L3
11 Write the syntax to define the structure with the following information.
CO4 L3
Emp_id (integer), Emp_name (20 characters) and Salry (float).
12 List out any two differences between structure and union? CO4 L2
13 Can a union have members of different data types? CO4 L3
14 How do you determine the size of a structure? CO4 L3
15 Define a structure to describe the book information and display the members of the structure. CO4 L3
16 Write a code fragment to declare and use an array of structures. CO4 L3
17 What is the size of a union in C? CO4 L2
18 How does a structure differ from an array? CO4 L3
19 Can a structure in C contain other structures as members? CO4 L3
20 Explain the purpose of #define and #include. CO4 L3
Q. No Unit-V (1 Marks) CO# BL#
1. What does a null pointer in C represent? CO5 L2
2. What is the result of dereferencing an uninitialized pointer in C? CO5 L3
3. Identify the issue in the following code
int arr[5] = {1, 2, 3, 4, 5,6};
CO5 L3
char *p = arr + 5;
printf("%d", *p);
4. Can you have a pointer to a structure in C? How? CO5 L2
5. How do you access the value pointed to by a pointer? CO5 L3
6. What happens if you dereference a pointer that points to an invalid memory location? CO5 L3
7. What is the main concept of pointers in C language? CO5 L2
8. What is the difference between a pointer and an array in C? CO5 L2
9. What does the following code do?
char arr[] = “ganesh”; CO5 L3
char *ptr = arr;
10. How do you declare a pointer in C? CO5 L2
11 Explain fseek() function for random file access with an example CO5 L2
12 What is the role of the fclose() function in C? CO5 L2
13 How would you compare text files and binary files? CO5 L2
14 What does the EOF constant represent in file handling in C? CO5 L2
15 What will the fopen() function returns , If the file doesn't exist and opened in read (“r”) mode. CO5 L2
16 How do you check if a file has been opened successfully in C? CO5 L3
17 Write the syntax of fopen() function. CO5 L2
18 What are the functions used to perform random operation on a file. CO5 L2
19 How can you write a string to a file in C? CO5 L2
20 Identify various modes in which a file is opened in C language? CO5 L3

Q. No Unit-III, IV and V (5 Marks) CO# BL#


1. Write a C program to read an array of elements and find minimum and maximum element. CO3 L3
2. Discuss different ways to initialize an array and demonstrate how to access and modify array
CO3 L3
elements using both array indexing and pointer notation.
3. Demonstrate the use of command line arguments? Write a C program to display the sum of two
CO3 L3
numbers using command line arguments.
4. Write a C Program to read two matrices and perform the multiplication of matrices. CO3 L2
5. Write a C program to read an array of n integer values and display the count of even numbers and
CO3 L3
odd numbers.
6. Write a C Program to read two matrices and perform the addition of matrices. CO3 L2
7. Explain any five string handling functions with an example CO3 L2
8. Write a C program to perform string comparison. CO3 L3
9. Read two strings str1 and str2 and write the code to perform the following operations.
Find the length of the string str1 CO3 L3
Concatenate str2 with str1
10. Write a C program that accepts a string from the user and checks whether the string is a
CO3 L3
palindrome
11 Write a C program that calculates the power of a number using recursion. Explain how recursion
CO4 L3
is used in this case and discuss its impact on memory usage.
12 Write a C program to find the nth term of Fibonacci series using recursion CO4 L3
13 What is the difference between call by value and call by reference? Illustrate with example. CO4 L3
14 How does recursion work, and what are the potential risks and benefits of using recursive
CO4 L3
functions?
15 Write a C program to find the factorial of a number using recursive and non-recursive call. CO4 L3
16 Write a C program to define a structure STUDENT with following information.
Student Id (int), Student Name (30 characters) and Marks (float). CO4 L3
Create an array of structures of type Student to read and display n students’ information.
17 How would you differentiate between structure and union? Demonstrate with an example for
CO4 L2
each.
18 Write a C program that demonstrates the use of a union to store different types of data (e.g.,
CO4 L3
integer, float, and string).
19 Define a structure in C and explain how to declare and access its members. CO4 L2
20 Can a structure contain a pointer to itself in C? Explain how recursive structures work in C with
CO4 L3
an example
21 Explain the concept of pointer arithmetic in C CO5 L2
22 Explain the concept of pointers in C and demonstrate how pointers can be used to modify variable
CO5 L2
values.
23 Write a c program to swap two numbers using call by value and call by reference.
CO5 L3
24 What is a NULL pointer in C, and why is it important? Discuss how NULL pointers are used to
CO5 L2
indicate that a pointer is not pointing to any valid memory address
25 Explain when and why you would use a void pointer. Discuss its advantages and limitations, and
CO5 L2
how it can be used to point to any data type.
26 Write a C program to read and write data to a file using fopen(), fwrite(), and fread(). CO5 L3
27 Create a text File and perform the following operations.
• Write a paragraph of text into the file (until user type @)
CO5 L3
• Read and display the text from the file.

28 Write a C program that uses fseek() to skip a specified number of bytes from the current position
CO5 L3
in a file and display the data at the new position.
29 Illustrate with an example how to copy the contents of one text file into another. CO5 L3
30 Discuss the process of opening files in read and write modes and how the contents are copied
CO5 L3
efficiently using file handling functions.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy