Approved by AICTE, New Delhi, Recognized by the Govt. of Karnataka
Autonomous Institute affiliated to VTU, Belagavi, NAAC Accredited with ‘A’ Grade Ideal Homes Township, Rajarajeshwari Nagar, Bengaluru-98
Department of Computer Science and Engineering
Accredited by NBA 2022-2025
2024-25 Odd Semester
Question Bank
Semester: I Course Name & Code: Principles of Programming using C (BPOPS24103/203)
Module 1
1. Define Algorithm. Explain the three characteristic features in the description of an
algorithm. 2. Develop an algorithm and draw a flowchart to find the average of three numbers taken as input from the user. 3. Develop an algorithm and draw a flowchart to input two numbers and find the greatest number among them. 4. Explain the basic structure of C program with an example. 5. Describe the process of compiling and running a C program. 6. Explain character set of C Language giving example for each. 7. Define tokens in C. Write and explain the different types of tokens with examples. 8. Explain the primary data types used in C language. 9. Explain the formatted I/O functions of C language with syntax and example. 10. List the rules for naming a variable in C. Which of the following are invalid variable names and why? Minimum First.name n1+n2 &name rd double 3 _row n$ Row1 Sum total doubles Col_total row_total 11. List the operators used in C language. 12. Convert the following Mathematical Expressions in to C equivalent 𝑥+𝑦 a) Total = b) Result= s(s-a) (s-b) (s-c) 𝑧 −𝑏+ 𝑏2−4𝑎𝑐 1 c) Root = d) Z = 2𝑎 𝑥2−𝑦2 Prepared by C Programming Faculty, GAT 1|Page 13. Evaluate the following expression: a) Res = x*x+2*x+1/2*x*x+x+1 where x=3.5, assume Res to be float b) Res = (a>0) || (b>=0) && (a>=0) || (b<=0) where a=-1, b=-a c) 100 % 20 <=20 – 5 + 100 % 10 – 20 == 5>= 1 !=20 d) a+= b*= c-=5 where a=3, b=5, c=8 e) 3 * 8 / 4 % 4 * 5 f) int a=5; a+= a++ + ++a; g) int a = 5, b; b= --a + a; h) int a = 3, b; b = a++ + a++ + a++; 14. Explain comma operator and sizeof operator used in C language. 15. Write a C program to shift the given number by two bits to the left. 16. Write a C program to input 3 sides (a, b, c) of a triangle and find the area using the formula 𝑎+𝑏+𝑐 area= s (s-a) (s-b) (s-c) where s = 2 17. Write a C program to find the remainder without using modulus operator. 18. Write a C program to input a character and find its equivalent ASCII. 19. Write a C program to input 2 numbers, swap them using temporary variable. 20. Write a C program to input 2 numbers, swap them without using temporary variable. 21. Explain the character test functions used in C program with an example. 22. Write a C Program to convert the given temperature in Fahrenheit to Celsius. 23. Write a C program that reads a floating point number and then displays the right most digit of the integer part of the number. 24. Write a C program to input 2 numbers, find the smallest number using conditional operator. 25. Write a C program to input 3 numbers, sort them in ascending order using conditional operator. 26. Write a C program to input principal and time. If time is more than 8 years, assign rate of interest as 12%, else as 18%. Calculate simple interest and display. Use conditional operator for the purpose. 27. Write a C program to input marks, if marks is more than 80, assign grade as ‘A’ otherwise as ‘B’. Use conditional operator for the purpose. 28. Write a C program to input 2 floating point numbers, perform +, -, *, / on them. 29. Write a C program to input three values and print the following results. a) Sum of the values b) Average of three values c) Largest of the three d) Smallest of the three 30. Define type conversion. Explain implicit type conversion with example. 31. Write a C program to illustrate the concept of type casting with an example.
Advances in Computer Communication and Computational Sciences: Proceedings of IC4S 2018 Sanjiv K. Bhatia - The ebook is available for instant download, read anywhere