2078

CSC115 · TU past paper

C Programming 2078 question paper

The complete TU 2078 exam paper for C Programming (CSC115), all 12 questions with solved model answers written to the mark scheme.

Tap a question to open its answer.

  1. 110 marksBreak and ContinueAnswer

    What do you mean by jump statement?Explain each jump statement with example.Write a program to check whether a number entered is prime or not.[1+5+4]

    A jump statement is a control statement that transfers the flow of program execution unconditionally from one part of the program to another. Jump statements interrupt the normal sequential or loop-based execution and cause the program t...

  2. 210 marksString Library FunctionsAnswer

    Explain any three string functions.Write a program to check if two matrices are identical or not.[3+7]

    (a) Three String Functions String functions are built-in functions available in the <string.h header file used to manipulate strings in C. --- Returns the number of characters in a string, excluding the null character \0. Syntax: int str...

  3. 310 marksStructure within structureAnswer

    Define structure.Explain nested structure with example.Create a structure named book with name, author, and publisher as its members.Write a program using this structure to read data of 50 books and display name of those books published by 'XXX' publisher.[1+2+2+5]

    --- A structure is a user-defined data type in C that allows grouping of variables of different data types under a single name. Each variable inside a structure is called a member or field. Syntax: --- A nested structure is a structure t...

  4. 45 marksStructure of a C programAnswer

    Explain structure of a C program with suitable example. [5]

    Every C program follows a standard, well-defined structure. Understanding this structure is essential before writing any C program. --- A C program is divided into the following sections: Section Description ------ 1. Documentation Comme...

  5. 55 marksVariablesAnswer

    What is variable? How is it different from constant? How do you write comments in C? [1+2+2]

    --- Definition (from notes): "Variable is a name that can be used to store values. Variables can take different values but one at a time. These values can be changed during the execution of the program. A data type is associated with eac...

  6. 65 marksFormatted I/OAnswer

    Explain formatted I/O functions in detail. [5]

    Formatted I/O functions are file input/output functions that allow reading and writing of formatted data (data with specific format specifiers like %d, %f, %s, etc.) to and from files. They work in text mode, meaning data is stored as ch...

  7. 75 marksUser defined functionsAnswer

    Write a program using your own function to find sum of two numbers. [5]

    A user-defined function is a function created by the programmer to perform a specific task. Here, we define a separate function sum() that takes two numbers as parameters, adds them, and returns the result to main(). --- --- --- Part Des...

  8. 85 marksDecision Making and BranchingAnswer

    Write a program to print largest among three number entered by the user. [5]

    The logic uses nested if-else statements to compare three numbers entered by the user and determine the largest one. --- --- Condition Result ------------------- a b and a c a is the largest a b but a <= c c is the largest a <= b and b c...

  9. 95 marksDynamic Memory AllocationAnswer

    Explain dynamic memory allocation with example. [5]

    The process of allocating memory at the time of execution (runtime) is called dynamic memory allocation. Unlike static memory allocation where the size is fixed at compile time, dynamic memory allocation allows a program to request and r...

  10. 105 marksInput Output Operations in FileAnswer

    Write a program that simply reads data from a file. [5]

    To read data from a file in C, the following steps are performed: 1. Declare a file pointer of type FILE 2. Open the file using fopen() in read mode "r" 3. Read data from the file using file input functions (e.g., fgetc(), fscanf(), fget...

  11. 115 marksGraphics FunctionAnswer

    Write a program to draw a line using graphics function. [5]

    In C graphics, the line(x1, y1, x2, y2) function is used to draw a line from the starting point (x1, y1) to the ending point (x2, y2). The coordinates are measured in pixels, with the origin (0, 0) at the top-left corner of the screen. B...

  12. 125 marksHistory of CAnswer

    Write short notes on: History of C, Bitwise operator. [5]

    --- C is a general-purpose, structured programming language. The following points outline its historical development: - 1960 - ALGOL (Algorithmic Language) was developed. It introduced the concept of structured programming and served as ...