Sei sulla pagina 1di 4

Department of ISE and CSE, BMSCE

Course - C Programming Code – 18CS1ESCCP

Sample Questions

UNIT 1
 Write algorithm and flowchart for:
i. Add two integers
ii. Area of a circle
iii. Calculate simple interest
iv. Area of triangle
 Simple C programs
1. Write a program to print your favorite mobile apps in the following format:
Example: My Favorite apps:
Spotify Instagram WhatsApp YouTube
2. Write a program to read and print a student’s height, age and section( ex:
Height=5.7,age=21 and section=K)
3. Write a program to print the ASCII value of a given character.
4. Write a program to convert degrees Fahrenheit into degrees Celsius.
5. Write an algorithm, flowchart and program to calculate area of circle.
UNIT 2
 Write C syntax & example for each:
i. simple if
ii. if else
iii. if else if
iv. switch
v. while
vi. do while
vii. for
 Programs on conditional branching statements, iterative/ looping statements, break and
continue statements.
1. Write a program to find largest of two numbers.
2. Write a program to find minimum of three numbers
i. Using simple if
ii. Using if else if and
iii. logical operators
iv. Using ternary operator.
3. Write a program to determine whether a person is eligible to vote or not.
4. Write a program to determine whether the given character is a vowel or a consonant.
5. Write a program to enter the marks of a student in four subjects, calculate the total,
aggregate, and display the grades obtained by the student.
6. Write a program to calculate the roots of a quadratic equation without using switch or
using switch statement.
7. Write a program to print first N natural numbers.
8. Write a program to print the numbers from 1 to 100 in reverse order.
9. Write an algorithm and program to print multiplication table of N, where N is entered
by the user.
Page 1|4
Department of ISE and CSE, BMSCE

10. Write a program to print odd numbers from 1 to N.


11. Write a program to print even numbers from 1 to N.
12. Write a program to calculate the factorial of a given number.
13. Write a program to read characters until a * is encountered, count the number of
uppercase, lowercase and numbers entered and print the same.
14. Write a program and flowchart to classify a given number as prime or composite.
15. Write a program to convert a decimal number to a binary number.
16. Write a program to calculate sum of squares of first n even numbers.
17. Write a program to check whether the given number is palindrome or not.
18. Write programs to print the following patterns using appropriate programming
constructs.
i. @@@
@@@
@@@
ii. *
**
***
iii. 1234
1234
1234
1234
iv. 1
12
123
1234
v. 1
22
333
4444
55555
vi. AAA
BBB
CCC
vii. A
ABC
ABCDE
ABCDEFG
viii. 0
12
345
6789
ix. 1
12
123
1234
12345

Page 2|4
Department of ISE and CSE, BMSCE

UNIT 3
 Write C syntax for initializing 1D and 2D arrays.
 Programs on 1D array operations:
 Insertion
 Deletion
 Linear search
 Binary search
 Programs on 2D array operations:
 Add two matrices
 Subtract two matrices
 Write C syntax for:
 Function prototype/Declaration
 Function call/ Invocation
 Function definition
Programs
1. Write a function to add 3 numbers.
2. Write a program to find average of three numbers using function sum().
3. Write an input function to read/get two numbers using pass by reference.
4. Write a program to sum the series 1/1!+4/2!+27/3!+....... Using functions
5. Write a program to find the area of a circle using four functions -input(), compute(), output(),
main( ).
6. Write a program to find the circumference of a circle using four functions
7. Write a program to find the area of a triangle using four functions.
8. Write a program to print the maximum of two user input numbers using four functions
9. Write a function to swap two numbers (pass by reference)
10. Write a function check a number is in a given range?
11. Write a program to find sum of n different numbers using functions.
12. Write a function to print a number in the reverse.
13. Write a program to average of n numbers using arrays
14. Write a function to find the GCD of two numbers.
15. Write a function to find the position of an element in an unsorted array
16. Write a C program to search an element in an array using linear search technique in 1D
array.
17. Write a C program to search an element in an array using Binary search technique.
18. Write a program to calculate the average of n numbers
19. Write a program to find the number of duplicate elements in an array.

Page 3|4
Department of ISE and CSE, BMSCE

UNIT 4
 Write C syntax for
 String initialization
 Structure initialization
 Nested Structure declaration
 Write C syntax and example for reading and printing strings
[Reading string: scanf( ), gets( ) and getchar( )
Printing strings: printf( ), puts( ) and putchar( )]
 Programs
1. Write a function to find length of string (Do not use strlen).
2. Write a function to concatenate two strings (Do not use strcat).
3. Write a program to convert the given string in lowercase to uppercase or vice versa.
4. Write a program to find the roots of quadratic equation. (Use struct complex)
5. Write a program to read and print the student details using structures.
6. Write a program to read and print the book details using nested structures.

UNIT 5
 Write C syntax for declaring and initializing pointers
 Operations on file
Programs
1. Write a program to perform arithmetic operations on two integers using pointers.
2. Write a program to convert given character in lower case to uppercase using pointers.
3. Write a program to read and write into a file.

Page 4|4

Potrebbero piacerti anche