Past exam questions for C Programming, organised chapter by chapter with solutions.
What is the basic structure of a C program? Explain each part.
What do you mean by Flowchart? Draw a flowchart to find the largest among three numbers entered by the user.
What do you mean by Flowchart? Draw a Flowchart to find the largest among three numbers entered by user.
What are conversion specifiers? Explain the basic structure of a C program.
What is an Identifier and keyword? Explain the rules for naming valid identifiers in C with examples. Write a C program to find the sum of digits of an 'n' digit number.
Find errors (if any) in the following program and rewrite it:
#define (studio,h) float main < > int m [ ] [ ] = {{ 1,2,3,4}}; for (i = 4, I>=0 ; i--) for (j=0, j <4; j++); m [i] [j] = a[i][j] + b[i][j]; return 0. 0; }
What is an Identifier and Keyword? Explain the rules for naming valid identifiers in C with examples. Write a program to convert a given string to lowercase without using any library functions.
What different data types are available in C, along with their respective ranges? Write a program to check whether a given integer is a palindrome or not.
Write short notes on: a. Escape Sequenceb. Null Pointer
How is a keyword different from a variable? Discuss basic data types with their ranges.
What different data types available in C along with their respective range? Write a program to check whether a given integer is palindrome or not.
How keyword is different from Variables? Discuss Basic data types with its ranges.
Explain any four input/output functions used in C language with suitable examples.
Explain any four input/output functions used in C language with suitable example.
What is an expression and operator? Discuss operator associativity in C. Write a program to find the factorial of a given integer using recursion.
What is operator associativity? Explain conditional and logical operators in brief.
List out different operators in C. Explain Logical and relational operator.
How is the break statement different from the continue statement? Explain with examples.
Write a program to generate the following pattern of integers:
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
How is the break statement different from the continue statement? Explain with a suitable example.
1 121 12321 1234321
When do we use a for loop and a while loop? Compare the while loop and do-while loop with suitable examples. Write a program to find the average, minimum, and maximum age in a class of 20 students.
Explain different control structures in C. Write a program in C to perform different arithmetic operations on two integers and display the result based on the choice made by the user using a switch statement.
Explain nested if-else ladder with a suitable example.
Explain the structure of a for loop. Write a program to reverse a number entered by the user.
What is an Identifier and keyword? Explain the rules for naming valid identifiers in C with example. Write a C program to find sum of digits of a 'n' digit number.
How break statement is different from continue statement. Explain with examples?
Write a program to generate the following pattern of Integers.
How break statement is different from continue statement? Explain with suitable example.
Write a program to generate the following pattern of integers.
When do we use for loop and while loop? Compare the while and do while loop with suitable example. Write a program to find average, minimum and maximum age in a class of 20 students.
Write a program to display the following pattern using the string "NEPAL".
N NE NEP NEPA NEPAL
Explain different control structures in C. Write a program in C to perform different arithmetic operations on two integers and display the result based on choice made by user using switch statement.
Explain nested if else ladder with suitable example.
Explain structure of for loop. Write a program to reverse a number entered by user.
What do you mean by a multi-dimensional array? Write program logic to add and display the sum of two m × n matrices.
Write a C program to check whether a given string is a palindrome or not.
What do you mean by a multi-dimensional array? Write a program to display the sum of two m × n matrices.
Why are array and pointer similar? Write a program to show the similarity between an array and a pointer.
Write a program to find the sum of diagonal elements of an n × n matrix.
Write a program to display the following pattern using the string "NEPAL": N NE NEP NEPA NEPAL
What is an array? How can an array be passed as a function argument? Write a program to arrange an array having 10 integer numbers in ascending order using a function.
What do you mean by multi-dimensional array? Write program logic to add and display the sum of two \(m \times n\) matrices.
Find errors (If any) in the following program and rewrite it.
Write a C program to check whether a given string is palindrome or not.
What is an Identifier and Keyword? Explain the rules for naming valid Identifiers in C with example. Write a program to convert a given string to lowercase without using any library functions.
What do you mean by multi-dimensional array? Write a program to display the sum of two \(m \times n\) matrices.
Write a program to find the sum of diagonal elements of \(n \times n\) matrix.
What is an array? How an array can be passed as function argument? Write a program to arrange an array having 10 integer numbers in ascending order using function.
Explain the role of functions in programming. How is a function declared, defined and called in C? Write a program to find the factorial of 'n' using a recursive function.
Write a program with a function that takes an array as an argument and returns its sum to the main function.
What is recursion? Write a program to find the factorial of a given integer using recursion.
Explain the role of function in programming. How function is declared, defined and called in C? Write a grogram to find factorial of 'n' using recursive function.
What is an expression and operator? Discuss operator associativity in C. Write a program to find factorial of a given integer using recursion.
Write short notes on: a. Macrosb. Null Pointer
How do you include a file in another file? Illustrate with an example.
Write short notes on: a. Macro vs Functionb. Break vs Continue
Write short notes on: a. Macrob. Opening and closing file
How do you include a file to another file? Illustrate with an example.
Write short notes on:
a) Macro
b) Opening and closing file
What is a pointer? Illustrate the use of a double pointer with a suitable example.
Write a program to find the smallest element of an array using a pointer.
What is DMA? Write a program to read N numbers and find the largest and smallest number using DMA.
What is a pointer? Explain the similarity between array and pointer in brief.
What is pointer? Illustrate the use of a double pointer with suitable example.
Write a program to find smallest element of an array using a pointer.
Why array and pointer is similar? Write a program to show the similarity between an array and pointer.
What is DMA? Write a program to read N numbers and find largest and smallest number using DMA.
What is pointer? Explain the similarity between array and pointer in brief.
How is structure different from union? Write a program to store and display basic information (roll, name, address, email, and phone) of students using a structure.
Write a program to store and display basic information (Roll, name, address, email, and phone) of students using a structure.
How is a nested structure defined and initialized? Explain with an example. Write a program, using structure, to input records of 10 students. Members include name, roll number, and marks obtained in Math, C Program, and English. Display the records of students who have passed in C Program.
Differentiate between structure and union. Write a program to read employee id, name, post and salary of 20 employees and display details of those employees whose post is "clerk".
How structure is different from union? Write a program to store and display basic information (roll, name, address, email, and phone) of students of using a structure.
Write a program to store and display basic information (Roll, name, address, email. and phone) of students of using a structure.
How nested Structure is defined and initialized? Explain with an example. Write a program, using structure, to input records of 10 students. Members include name, roll number, marks obtained in math, C program and English. Display the records of students who have passed in C Program.
Differentiate between structure and union? Write a program to read employ id, name, post and salary of 20 employee and display detail of those employee whose post is “clerk”.
Why is file handling used in programming? Explain different file opening modes.
Write a program to create a file "duplicate" that contains the exact copy of file "original".
List the advantages and disadvantages of global variables. Assume two data files "num1.txt" and "num2.txt" containing integers. Merge these two files into a third file named "file3.txt". The integers in "file3.txt" must be written in sorted order.
Why is a data file needed? Write a program to write N numbers to file "number.txt" and then read it and display only even numbers.
Why file is used in programming? Explain different file opening modes.
List the advantages and disadvantages of global variable. Assume the two data files "num1.txt" and "num2.txt" containing integers. Merge these two files to the third file named " file3.txt". Here, the integers of " file3.txt" must be written in sorted order.
Why data file is needed? Write a program to write N numbers in file “number.txt” and then read it and display only even numbers.