-
Upload a PDF containing all theory questions (if any) and answers in the docs/ folder
- You can create a doc and convert it to PDF online.
- Name pdf as
answer.pdf - Your first line of pdf should be
Name: Firstname-Lastname. Eg: Name: Nirajan-Thakuri
-
Write code in the corresponding
src/file for each programming task. -
Do not change file names — tests depend on them.
-
Commit and push your changes to GitHub.
Q1. What is the purpose of the main() function in a C program? Explain its significance.
Q2. Explain the difference between a variable declaration and a variable initialization in C.
Q3. Write a C program to prompt the user for their name and display a personalized greeting message.
Q4. What are the different data types available in C? Provide examples of each data type.
Q5. Explain the concept of type conversions in C. Provide examples of implicit and explicit type conversions.
Q6. Write a C program to calculate the area of a rectangle. Prompt the user to enter the length and width, and display the result.
Q7. What is the role of the scanf() function in C? Provide an example of its usage.
Q8. Write a C program to convert temperature from Celsius to Fahrenheit. Prompt the user for a temperature in Celsius and display the equivalent temperature in Fahrenheit. (Formula: fahrenheit = (celsius * 9 / 5) + 32)
Q9. Input a number representing days and print the equivalent number of weeks and days. (Example: 10 days = 1 week and 3 days)
Q10. Write a C program to swap the values of two variables using a temporary variable.
Q11. Write a C expression that performs the following operations in a single line: increment a variable by 1, multiply it by 3, and subtract 10.
Q12. Given three variables a, b, and c, write an expression that checks if a is greater than b and c is not equal to 0.
Q13. Write a C expression that evaluates whether a number is divisible by both 2 and 3 (without using the modulus operator).
Q14. Create an expression that swaps the values of two variables x and y without using a temporary variable.
Q15. Write an expression that checks if a number is both positive and even.
Q16. Given two variables x and y, write an expression that calculates the average of their values.
Q17. Create an expression that checks if a given character is an uppercase letter.
Q18. Write a C expression that calculates the sum of the squares of three different numbers.
Q19. Given three variables a, b, and c, write an expression that checks if a is equal to b and b is not equal to c.
Q20. Write an expression that checks if a number is a multiple of either 3 or 5.
Q21. Create an expression that swaps the values of three variables x, y, and z in a cyclic order (i.e., x becomes y, y becomes z, and z becomes x).
Q22. Write a C expression that calculates the square root of the sum of two numbers, rounded to the nearest integer.
Q23. Given a variable num, write an expression that checks if it is a power of 2.
Q24. Create an expression that checks if a given number is a perfect square.