0% found this document useful (0 votes)
7 views2 pages

C Programming Test Instructions and Questions

The document is a C programming test consisting of multiple sections including numerical questions on increment and decrement operators, output prediction questions, programming tasks using if-else statements, and theory questions on C concepts. It includes a total of 10 questions with a marking scheme that allocates points based on the section. The test aims to assess knowledge and application of C programming fundamentals.

Uploaded by

mayk7983
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

C Programming Test Instructions and Questions

The document is a C programming test consisting of multiple sections including numerical questions on increment and decrement operators, output prediction questions, programming tasks using if-else statements, and theory questions on C concepts. It includes a total of 10 questions with a marking scheme that allocates points based on the section. The test aims to assess knowledge and application of C programming fundamentals.

Uploaded by

mayk7983
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C Programming Test

Instructions: Answer all the questions. Show proper working wherever required.

Section A: Increment & Decrement Operators (2 Questions)

Q1. [Numerical] If a = 5, find the values of a after each step:


• Step 1 → b = a++
• Step 2 → c = ++a
Find the final values of a, b, and c.

Q2. [Numerical] Consider the code:


int a = 11, b = 22, c;
c = a + b + a++ + b++ + ++a + ++b;
Find the final values of a, b, and c.

Section B: C Output-Based Questions (2 Questions)

Q3. [Output Prediction] What will be the output?


#include
int main() {
int x = 2, y = 5;
printf("%d\n", x * y / x);
printf("%d", x + y - x);
return 0;
}

Q4. [Output Prediction] What will be the output?


#include
int main() {
int a = 3;
a *= 2 + 5;
printf("%d", a);
return 0;
}

Section C: Programs Based on If-Else (3 Questions)


Q5. [Programming] Write a C program to check whether a given number is divisible by 5
and 3 or not.

Q6. [Programming] Write a C program to find the largest of three numbers entered by the
user.

Q7. [Programming] Write a C program to calculate the grade of a student based on the
marks entered:
• Marks ≥ 90 → Grade A
• Marks ≥ 75 → Grade B
• Marks ≥ 50 → Grade C
• Otherwise → Grade F

Section D: Theory Questions (3 Questions)

Q8. [Short Answer] What is the difference between constants and variables in C? Give
one example of each.

Q9. [Short Answer] Explain the rules for naming variables in C and provide three examples
of valid variable names and two examples of invalid variable names.

Q10. [Short Answer] Explain the difference between the following operators in C:
• '=' (Assignment operator)
• '==' (Comparison operator)

Marking Scheme
Section Questions Marks per Q Total Marks

Increment/Decrement Q1 – Q2 2 4
Output Prediction Q3 – Q4 2 4
If-Else Programs Q5 – Q7 3 9
Theory Q8 – Q10 1 3
Total 10 - 20

You might also like