In this blog, we provide the fully solved BCA Part-I Previous Year Question Paper (2016) for the subject Principles of Programming Language through C (PPL through C) conducted by the University of Rajasthan (RU). Every answer is written in simple, easy-to-understand, and exam-oriented language so that students can learn how to write effective answers in the university examination.
Subject: Principles of Programming Language through C (Paper-134)
B.C.A. (Part-I) Examination, 2016
Faculty of Science
Three-Year Scheme (10+2+3 Pattern)
Paper-134
Principles of Programming Language (Through C)
Time Allowed: Three Hours
Maximum Marks: 100
Question Paper Pattern
Part-I (Very Short Answer): Consists of 10 questions carrying 2 marks each. The maximum answer length is approximately 40 words.
Part-II (Short Answer): Consists of 5 questions carrying 4 marks each. The maximum answer length is approximately 80 words.
Part-III (Long Answer): Consists of 5 questions carrying 12 marks each with internal choice.
PART – I
- Define pseudo code.
- What do you understand by machine-level language?
- Write the syntax of the
switchstatement. - What is a header file?
- Define an array.
- Write the syntax and purpose of
strcat(). - Why do we use
malloc()? Also write its syntax. - Differentiate between local variables and global variables.
- Differentiate between a structure and a union.
- Write the syntax and purpose of
fprintf().
PART – II
- Draw a flowchart to find the largest among three numbers.
- Explain the different logical operators in C with suitable examples.
- Explain the
whileloop anddo-whileloop with examples. - Write a C program to calculate the factorial of a number using recursion.
- Write any one C function for each of the following:
- Opening a file
- Closing a file
- Reading data from a file
- Writing data to a file
PART – III
- Write a detailed note on the evaluation of programming languages.ORWrite a pseudo code to generate the following series:
- 0, 1, 1, 2, 3, 5, ... n
- 1, 4, 9, 16, 25, ... n
- Discuss the various decision-making statements in C with suitable examples.ORExplain the different data types available in C.
- What do you understand by iterative statements? Explain the different types of loops supported in C along with the use of
breakandcontinuestatements.ORWhat are arrays? Write a C program to calculate the sum of 10 numbers using an array. - Why do we need user-defined functions? Explain how functions are created in C with suitable examples.ORWhat are pointer variables? Write a C program to demonstrate the use of the indirection operator (
*) for accessing values through a pointer. - Discuss the formatted and unformatted input/output functions in C.ORWrite a short note on File Handling in C.
Solution – Part I
Let's solve each question one by one in an easy, exam-oriented manner.
Solution – Part I
Question 1. Define Pseudo Code.
Answer:
A Pseudo Code is an informal way of describing the steps of an algorithm using simple English statements. It resembles a programming language but does not follow the strict syntax rules of any specific language. Pseudo code helps programmers understand the logic of a program before writing the actual source code.
Question 2. What do you understand by Machine-Level Language?
Answer:
Machine-level language is the lowest-level programming language that consists of binary digits (0 and 1). It is directly understood and executed by the computer's processor without requiring any translator such as a compiler or interpreter.
Although machine language executes very quickly, it is difficult for humans to read, write, debug, and maintain because every instruction is represented in binary form.
Question 3. Write the Syntax of the switch Statement.
Answer:
The switch statement is a multi-way decision-making statement used to execute one block of code from several alternatives based on the value of an expression.
switch(expression)
{
case constant1:
statements;
break;
case constant2:
statements;
break;
...
default:
statements;
}break statement is used to terminate the current case. If no case matches, the default block is executed.Question 4. What is a Header File?
Answer:
A header file is a file that contains function declarations, macro definitions, constants, and other reusable programming components. Header files allow programmers to use predefined library functions without rewriting their definitions.
In C programming, header files are included in a program using the #include preprocessor directive.
#include <stdio.h>
#include <stdlib.h>stdio.h, stdlib.h, string.h, and math.h.Question 5. Define an Array.
Answer:
An array is a collection of elements of the same data type stored in contiguous memory locations. Each element is accessed using an index, where indexing begins from 0 in C programming.
int marks[5];The above declaration creates an integer array capable of storing five elements.
Question 6. Write the Syntax and Purpose of strcat().
Answer:
The strcat() function is used to concatenate (join) one string to the end of another string.
Syntax:
strcat(destination_string, source_string);The function appends the source string to the destination string and returns the address of the destination string.
#include <string.h>Question 7. Why do we use malloc()? Also write its syntax.
Answer:
The malloc() (Memory Allocation) function is used to allocate memory dynamically during program execution. It reserves a specified amount of memory from the heap and returns the address of the first allocated memory block. The allocated memory remains available until it is explicitly released using the free() function.
Syntax:
pointer=(data_type *)malloc(number_of_elements*sizeof(data_type));Example:
int *ptr;
ptr=(int *)malloc(5*sizeof(int));#include <stdlib.h>Question 8. Differentiate between Local Variables and Global Variables.
Answer:
| Local Variable | Global Variable |
|---|---|
| Declared inside a function or block. | Declared outside all functions. |
| Accessible only within the function or block where it is declared. | Accessible from all functions in the program unless restricted. |
| Created when the function is called and destroyed when the function ends. | Exists throughout the execution of the program. |
| Has limited scope. | Has global scope. |
| Stored in stack memory. | Stored in the data segment of memory. |
Question 9. Differentiate between a Structure and a Union.
Answer:
| Structure | Union |
|---|---|
| Each member has its own separate memory location. | All members share the same memory location. |
| All members can store values simultaneously. | Only one member can hold a valid value at a time. |
| The size of a structure is approximately the sum of the sizes of all its members. | The size of a union is equal to the size of its largest data member. |
| Requires more memory. | Requires less memory. |
| Suitable when all data members need to be used together. | Suitable when only one data member is used at a time. |
Question 10. Write the Syntax and Purpose of fprintf().
Answer:
The fprintf() function is used to write formatted data to a file. It works similarly to the printf() function, but instead of displaying the output on the screen, it writes the formatted output to the specified file.
Syntax:
fprintf(file_pointer,"format_string",variables);Example:
FILE *fp;
fp=fopen("student.txt","w");
fprintf(fp,"Roll No = %d",101);
fclose(fp);#include <stdio.h>Solution – Part II
In this section, each question carries 4 marks. The answers are explained in a clear and concise manner, making them suitable for university examinations as well as revision purposes.
Question 1. Draw a Flowchart to Find the Largest Among Three Numbers.
Answer:
The following flowchart illustrates the logical steps required to determine the largest number among three given numbers.
.webp)
Question 2. Explain the Different Logical Operators in C with Suitable Examples.
Answer:
Logical operators are used to combine two or more conditions and evaluate whether the overall expression is true or false. They are commonly used in decision-making statements such as if, if-else, while, and for loops.
| Operator | Name | Description |
|---|---|---|
&& | Logical AND | Returns true only when both conditions are true. |
|| | Logical OR | Returns true if at least one condition is true. |
! | Logical NOT | Reverses the logical result of a condition. |
Example Program
#include <stdio.h>
int main()
{
int a = 10, b = 20;
if(a < b && b > 0)
printf("AND Operator is True\n");
if(a > b || b > 0)
printf("OR Operator is True\n");
if(!(a > b))
printf("NOT Operator is True\n");
return 0;
}Question 3. Explain the while Loop and do-while Loop with Examples.
Answer:
Both while and do-while are looping statements used to execute a block of code repeatedly until a specified condition becomes false. The main difference lies in the point at which the condition is evaluated.
| while Loop | do-while Loop |
|---|---|
| The condition is checked before executing the loop body. | The condition is checked after executing the loop body. |
| The loop may execute zero times if the condition is false initially. | The loop executes at least once, even if the condition is false. |
| Also known as an entry-controlled loop. | Also known as an exit-controlled loop. |
Syntax of while Loop
while(condition)
{
// Statements
}Syntax of do-while Loop
do
{
// Statements
}
while(condition);do-while loop always executes its body at least once because the condition is evaluated after the loop body.Question 4. Write a C Program to Calculate the Factorial of a Number Using Recursion.
Answer:
A recursive function is a function that calls itself until a terminating condition is satisfied. The following program calculates the factorial of a given number using recursion.
#include <stdio.h>
int factorial(int n)
{
if(n == 0 || n == 1)
return 1;
return n * factorial(n - 1);
}
int main()
{
int num;
printf("Enter a Number : ");
scanf("%d", &num);
printf("Factorial = %d", factorial(num));
return 0;
}Question 5. Write Any One C Function for Each of the Following:
Answer:
C provides several built-in functions for performing file operations such as opening, closing, reading, and writing files. Some commonly used functions are listed below.
| Operation | Function | Description |
|---|---|---|
| Open a File | fopen() | Opens an existing file or creates a new file and returns a file pointer. |
| Close a File | fclose() | Closes an opened file and releases the associated resources. |
| Read from a File | fscanf() | Reads formatted data from a file. |
| Write to a File | fprintf() | Writes formatted data to a file. |
Example
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("student.txt", "w");
fprintf(fp, "Welcome to Suraku Academy");
fclose(fp);
return 0;
}fclose() after completing file operations. This ensures that all buffered data is written to the file and system resources are released properly.Solution – Part III
Question 1. Write a Detailed Note on the Evaluation of Programming Languages.
Answer:
A programming language is evaluated by analyzing different characteristics that determine its usefulness, efficiency, reliability, and ease of programming. A good programming language should be simple to understand, easy to maintain, efficient to execute, and capable of solving a wide variety of problems. These evaluation criteria help programmers select the most suitable language for a particular application.
The major criteria used for evaluating a programming language are explained below.
- Readability
- Writability
- Reliability
- Cost
- Portability
- Efficiency
- Maintainability
1. Readability
Readability refers to how easily a program can be read and understood by programmers. A language with good readability allows developers to understand the program quickly, making debugging, testing, and maintenance much easier.
The readability of a programming language depends on several factors, including meaningful keywords, simple syntax, consistency, and well-defined language constructs.
2. Writability
Writability is the ease with which programmers can develop programs using a programming language. A language with good writability allows programmers to express solutions clearly using fewer statements, thereby improving development speed and reducing programming effort.
Features such as simple syntax, powerful data structures, reusable functions, and modular programming improve the writability of a programming language.
3. Reliability
Reliability refers to the ability of a programming language to produce correct, consistent, and dependable results under different operating conditions. A reliable programming language helps developers create programs that perform accurately with minimal errors.
Reliability depends on factors such as strong type checking, effective exception handling, proper memory management, and overall language design. A highly reliable language reduces unexpected program failures and improves software quality.
4. Cost
Cost is another important criterion used to evaluate a programming language. It represents the overall expense involved in developing, testing, executing, maintaining, and upgrading software throughout its life cycle.
The total cost of a programming language includes programmer training, software development, debugging, maintenance, execution time, hardware requirements, and long-term support. A language that reduces development time and maintenance effort is generally considered more cost-effective.
5. Portability
Portability is the ability of a program to run on different hardware platforms and operating systems with little or no modification. A portable programming language allows the same source code to be compiled and executed on multiple systems.
Portable languages reduce development effort because the same application can be reused across different environments instead of writing separate programs for each platform.
6. Efficiency
Efficiency measures how effectively a programming language utilizes system resources such as processor time and memory. An efficient language produces programs that execute quickly while consuming minimum memory and computational resources.
Execution speed, optimized memory usage, and efficient compilation are some of the important factors that determine the efficiency of a programming language.
7. Maintainability
Maintainability is the ease with which an existing program can be modified, corrected, enhanced, or updated after its development. Software often requires maintenance to fix errors, improve performance, or add new features.
A programming language with clear syntax, modular programming support, meaningful identifiers, and proper documentation makes software maintenance much easier and less time-consuming.
Summary of Programming Language Evaluation Criteria
| Evaluation Criterion | Description |
|---|---|
| Readability | Ease of reading and understanding a program. |
| Writability | Ease of writing programs using the language. |
| Reliability | Ability to produce accurate and dependable results. |
| Cost | Total expense involved in software development and maintenance. |
| Portability | Ability to run programs on different platforms. |
| Efficiency | Effective utilization of processor time and memory. |
| Maintainability | Ease of modifying and updating existing software. |
OR
Write a Pseudo Code to Generate the Following Series:
- 0, 1, 1, 2, 3, 5, ... n
- 1, 4, 9, 16, 25, ... n
Answer: The solutions for both series are given below using simple pseudo code.
(a) Pseudo Code to Generate the Fibonacci Series
The Fibonacci series is a sequence in which each number is obtained by adding the two preceding numbers. The series begins with 0 and 1.
BEGIN
INPUT n
SET first = 0
SET second = 1
PRINT first, second
FOR i = 3 TO n
SET next = first + second
PRINT next
SET first = second
SET second = next
END FOR
END0, 1, 1, 2, 3, 5, 8, 13, ...(b) Pseudo Code to Generate the Series 1, 4, 9, 16, 25, ... n
This series represents the square of natural numbers. Each term is obtained by multiplying the number by itself.
BEGIN
INPUT n
FOR i = 1 TO n
PRINT i × i
END FOR
END1, 4, 9, 16, 25, 36, 49, ...Question 2. Discuss the Various Decision-Making Statements in C with Suitable Examples.
Answer:
Decision-making statements enable a program to execute different blocks of code based on whether a specified condition evaluates to true or false. They play a vital role in controlling the flow of program execution and are widely used in C programming.
The commonly used decision-making statements in C are listed below.
| Statement | Description |
|---|---|
| if | Executes a block of code only when the specified condition is true. |
| if...else | Chooses between two alternative blocks depending on the condition. |
| Nested if | Uses one if statement inside another if statement for multiple conditions. |
| else-if Ladder | Checks multiple conditions one after another until a matching condition is found. |
| switch | Selects one block of code from multiple alternatives based on the value of an expression. |
1. if Statement
The if statement executes a block of code only when the specified condition is true.
if(condition)
{
// Statements
}2. if...else Statement
The if...else statement is used when one block should execute if the condition is true and another block should execute if the condition is false.
if(condition)
{
// Statements
}
else
{
// Statements
}3. Nested if Statement
A nested if statement contains one if statement inside another. It is useful when multiple conditions need to be checked in sequence.
if(condition1)
{
if(condition2)
{
// Statements
}
}4. else-if Ladder
The else-if ladder is used to test several conditions one after another. As soon as one condition becomes true, the corresponding block is executed and the remaining conditions are skipped.
if(condition1)
{
// Statements
}
else if(condition2)
{
// Statements
}
else
{
// Statements
}5. switch Statement
The switch statement provides an efficient way to select one block of code from several alternatives based on the value of an expression.
switch(expression)
{
case value1:
// Statements
break;
case value2:
// Statements
break;
default:
// Statements
}switch statement is generally preferred over multiple if...else statements when checking the value of a single variable against several constant values.OR
Explain the Different Data Types Available in C.
Answer:
A data type specifies the type of data that a variable can store in a C program. It also determines the amount of memory allocated to the variable and the range of values it can hold. Selecting an appropriate data type helps in efficient memory utilization and accurate program execution.
The major data types available in C are explained below.
| Data Type | Example | Description |
|---|---|---|
| int | int a = 10; | Used to store integer values without decimal points. |
| float | float x = 12.5; | Used to store single-precision decimal (floating-point) values. |
| double | double y = 25.56789; | Used to store double-precision floating-point values with higher accuracy. |
| char | char ch = 'A'; | Used to store a single character. |
| void | void display(); | Represents the absence of a value or return type. |
Classification of Data Types in C
Data types in C can be broadly classified into the following categories.
| Category | Examples |
|---|---|
| Basic (Primary) Data Types | int, char, float, double, void |
| Derived Data Types | Arrays, Pointers, Functions |
| User-Defined Data Types | struct, union, enum, typedef |
Question 3. What Do You Understand by Iterative Statements? Explain the Different Types of Loops Supported in C Along with the Use of break and continue Statements.
Answer:
Iterative statements, also known as looping statements, are used to execute a block of code repeatedly until a specified condition becomes false. Loops help eliminate repetitive coding and make programs more efficient, readable, and easier to maintain.
C programming supports three types of loops:
whileLoopdo...whileLoopforLoop
1. while Loop
The while loop checks the condition before executing the loop body. Therefore, it is known as an entry-controlled loop.
while(condition)
{
// Statements
}2. do...while Loop
The do...while loop executes the statements first and checks the condition afterward. As a result, the loop body executes at least once regardless of whether the condition is true or false.
do
{
// Statements
}
while(condition);3. for Loop
The for loop is commonly used when the number of iterations is known in advance. It combines initialization, condition checking, and increment/decrement into a single statement.
for(initialization;condition;increment)
{
// Statements
}- while ? Entry-controlled loop.
- do...while ? Exit-controlled loop.
- for ? Best suited when the number of iterations is predetermined.
Use of the break Statement
The break statement is used to terminate a loop or a switch statement immediately. Once a break statement is encountered, the control exits the loop or switch block and continues with the next statement following it.
for(int i = 1; i <= 10; i++)
{
if(i == 5)
break;
printf("%d ", i);
}1 2 3 4Use of the continue Statement
The continue statement is used to skip the remaining statements of the current iteration and immediately move to the next iteration of the loop. Unlike the break statement, it does not terminate the loop.
for(int i = 1; i <= 5; i++)
{
if(i == 3)
continue;
printf("%d ", i);
}1 2 4 5breakimmediately terminates the loop.continueskips the current iteration and proceeds to the next iteration.- Both statements are commonly used with
for,while, anddo...whileloops.
OR
What are Arrays? Write a C Program to Calculate the Sum of 10 Numbers Using an Array.
Answer:
An array is a collection of elements of the same data type stored in contiguous memory locations. Each element is identified by an index, with indexing starting from 0 in C programming.
Arrays make it easy to store and process multiple values using a single variable name. They are widely used for handling collections of similar data efficiently.
Syntax
data_type array_name[size];Example
int marks[10];The above declaration creates an integer array capable of storing 10 integer values.
C Program to Calculate the Sum of 10 Numbers Using an Array
#include <stdio.h>
int main()
{
int arr[10];
int i, sum=0;
printf("Enter 10 Numbers:\n");
for(i = 0;i < 10;i++)
{
scanf("%d",&arr[i]);
sum=sum+arr[i];
}
printf("Sum : %d",sum);
return 0;
}for loop. During the same loop, each element is added to the variable sum. Finally, the total sum of all ten numbers is displayed.Question 4. Why Do We Need User-Defined Functions? Explain How Functions Are Created in C with Suitable Examples.
Answer:
A user-defined function is a function created by the programmer to perform a specific task. Instead of writing the same code repeatedly, the required statements are placed inside a function and can be called whenever needed. This makes programs modular, reusable, easier to understand, and easier to maintain.
User-defined functions improve code readability, reduce duplication, simplify debugging, and make large programs easier to manage.
- Promote code reusability.
- Reduce program complexity.
- Improve readability and maintainability.
- Simplify testing and debugging.
- Support modular programming.
Steps to Create a User-Defined Function in C
Creating a user-defined function in C involves three important steps:
- Function Declaration (Function Prototype)
- Function Definition
- Function Call
1. Function Declaration
A function declaration informs the compiler about the function's name, return type, and parameters before it is used in the program.
return_type function_name(parameter_list);Example:
int add(int, int);2. Function Definition
A function definition contains the actual statements that perform the required task.
int add(int a,int b)
{
return a+b;
}3. Function Call
A function call transfers program control to the function so that it can execute the required operations and, if applicable, return a result to the calling function.
result = add(10,20);Example Program
#include <stdio.h>
int add(int, int);
int main()
{
int sum;
sum = add(10, 20);
printf("Sum = %d", sum);
return 0;
}
int add(int a,int b)
{
return a+b;
}add() that accepts two integer values, calculates their sum, and returns the result to the main() function.OR
What are Pointer Variables? Write a C Program to Demonstrate the Use of the Indirection Operator (*) for Accessing Values Through a Pointer.
Answer:
A pointer variable is a special type of variable that stores the memory address of another variable instead of storing the actual value. Pointers are widely used for dynamic memory allocation, passing arguments to functions, efficient array processing, and implementing complex data structures such as linked lists, stacks, queues, and trees.
The indirection operator (*), also known as the dereference operator, is used to access the value stored at the memory address contained in a pointer.
Syntax of Pointer Declaration
data_type *pointer_name;Example:
int *ptr;C Program to Demonstrate the Use of the Indirection Operator
#include <stdio.h>
int main()
{
int num=100;
int *ptr;
ptr=#
printf("Value of num = %d\n", num);
printf("Address of num = %p\n", &num);
printf("Value stored in ptr = %p\n", ptr);
printf("Value using *ptr = %d\n", *ptr);
return 0;
}ptr stores the address of the variable num. Using the dereference operator (*ptr), the program accesses the value stored at that memory location without directly referring to the variable name.- The
&(address-of) operator returns the memory address of a variable. - The
*(dereference) operator accesses the value stored at the memory address held by a pointer. - A pointer stores an address, whereas the dereference operator retrieves the value stored at that address.
Question 5. Discuss the Formatted and Unformatted Input/Output Functions in C.
Answer:
Input and output operations in C are broadly classified into formatted input/output and unformatted input/output. These functions enable communication between the user and the program by accepting input and displaying output.
Formatted Input/Output Functions
Formatted input/output functions allow data to be entered or displayed in a specific format using format specifiers such as %d, %f, %c, and %s. These functions are commonly used when working with different data types in C.
| Function | Description |
|---|---|
printf() | Displays formatted output on the screen. |
scanf() | Reads formatted input from the keyboard. |
fprintf() | Writes formatted output to a file. |
fscanf() | Reads formatted input from a file. |
sprintf() | Stores formatted output in a string. |
sscanf() | Reads formatted data from a string. |
Example
#include <stdio.h>
int main()
{
int age;
printf("Enter Your Age: ");
scanf("%d", &age);
printf("Age = %d", age);
return 0;
}Unformatted Input/Output Functions
Unformatted input/output functions read or display data without using format specifiers. These functions are generally used for handling single characters or strings and are simpler than formatted input/output functions.
| Function | Description |
|---|---|
getchar() | Reads a single character from the keyboard. |
putchar() | Displays a single character on the screen. |
gets() | Reads an entire string from the keyboard. (Deprecated in modern C) |
puts() | Displays a string on the screen. |
Example
#include <stdio.h>
int main()
{
char ch;
printf("Enter a Character: ");
ch = getchar();
printf("You Entered: ");
putchar(ch);
return 0;
}gets() function is deprecated because it does not perform boundary checking and may cause buffer overflow. In modern C programming, fgets() is recommended as a safer alternative.- Formatted Functions:
printf(),scanf(),fprintf(),fscanf(),sprintf(), andsscanf(). - Unformatted Functions:
getchar(),putchar(),gets(), andputs(). - Formatted functions use format specifiers, whereas unformatted functions do not.
OR
Write a Short Note on File Handling in C.
Answer:
File handling in C is the process of storing, retrieving, and managing data in files on secondary storage devices such as hard disks or SSDs. It allows data to be saved permanently so that it remains available even after the program terminates.
C provides a set of standard library functions to perform various file operations such as creating, opening, reading, writing, appending, and closing files. These functions are declared in the <stdio.h> header file.
Basic Steps in File Handling
- Create or open a file using
fopen(). - Perform the required read or write operations.
- Close the file using
fclose().
#include <stdio.h>Common File Opening Modes in C
Different file opening modes are available in C depending on the operation to be performed. The mode specified in the fopen() function determines whether a file will be created, read, written, or updated.
| Mode | Description |
|---|---|
"r" | Opens an existing file for reading. The file must already exist. |
"w" | Opens a file for writing. If the file already exists, its contents are overwritten. If it does not exist, a new file is created. |
"a" | Opens a file in append mode. New data is added at the end of the file without removing the existing contents. |
"r+" | Opens an existing file for both reading and writing. |
"w+" | Opens a file for both reading and writing. If the file exists, its contents are overwritten; otherwise, a new file is created. |
"a+" | Opens a file for both reading and appending. New data is always written at the end of the file. |
Common File Handling Functions
The following standard library functions are frequently used while performing file operations in C.
| Function | Description |
|---|---|
fopen() | Opens an existing file or creates a new file. |
fclose() | Closes an opened file. |
fprintf() | Writes formatted data to a file. |
fscanf() | Reads formatted data from a file. |
fgetc() | Reads a single character from a file. |
fputc() | Writes a single character to a file. |
fgets() | Reads a string from a file. |
fputs() | Writes a string to a file. |
Example Program
The following program demonstrates how to create a file, write data into it, and then close the file.
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("student.txt", "w");
if(fp == NULL)
{
printf("Unable to Open File");
return 1;
}
fprintf(fp, "Welcome to Suraku Academy");
fclose(fp);
printf("Data Written Successfully.");
return 0;
}student.txt in write mode using fopen(). The fprintf() function writes data into the file, and finally fclose() closes the file and releases the associated system resources.fopen() successfully opens the file before performing any file operation. If it returns NULL, it indicates that the file could not be opened.- Use
fopen()to open or create a file. - Use
fprintf(),fscanf(),fgetc(),fputc(),fgets(), andfputs()to perform file operations. - Always close the file using
fclose()after completing all operations. - Check whether the returned file pointer is
NULLbefore reading from or writing to a file.
Conclusion
This article presented the fully solved BCA Part-I (2016) Previous Year Question Paper for the subject Principles of Programming Language through C. Each question has been explained in simple, exam-oriented language with appropriate examples, tables, and C programs to help students understand the concepts more effectively.
Practicing previous year question papers is one of the most effective ways to understand the examination pattern, identify important topics, and improve answer-writing skills. Regular practice also builds confidence and helps students perform better in university examinations.
Continue solving previous year question papers and practicing C programming regularly. Consistent practice will strengthen your programming concepts and improve your performance in university exams, competitive examinations, and technical interviews.
