0% found this document useful (0 votes)
28 views

Programming in C model paper

Programming in c model question paper imp 2024

Uploaded by

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

Programming in C model paper

Programming in c model question paper imp 2024

Uploaded by

suraj718549
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Course Code: R24

Anurag University

B Tech I Year I-Semester


Programming in C Model Paper
(Common to all)

Max Marks: 30

Section – A
 Answer all questions
(12 x 1 = 12 Marks)
1. Formulate the C – expression for the following arithmetic expression
+5 + 6x + 7
2. If the values of a, b and c are 120, 5 and 200 respectively, Find the value of the following C – expression
using precedence and associativity rules.
a + b * c /a

3. Find the output of the given code


#include <stdio.h>
void main()
{
float a = 1.5;
int b = (int)a;
printf("a = %f\n", a);
printf("b = %d\n", b);
}

4. Find the output of the given code


#include <stdio.h>
main()
{
int a = 9;
float x;
x = a / 2;
printf("%f", x);
}

5. If
a=10;
b=a;
c=a++;
then the value of b is ----------- and value of c is ------------
6. Determine the value of the following logical expression when x=10, y=15 and z=20.

x! = yll y = = z -------------------

7. An immediate exit from the loop can be achieved by a ------------ statement.

8. Body of the do..while statement is executed at least once. [True/False]

9. C Programming language is case sensitive [True/False]

10. Identify the correct statement with respect to the size of the data types in C?

a) char > int > float


b) char < int < float
c) int < char < float
d) int < chat > float

11. Identify the incorrect arithmetic expression from the following options

a) x += 10
b) x /= 10
c) x %= 10
d) x != 10

12. When the condition of the do-while loop is false, how many times will it execute the code?

a) 0
b) 1
c) Infinite
d) 10
Section—B
Answer any 6 questions
(3 x 6 =18 Marks)
13. Design a flowchart to check whether a given number is even or odd

14. Find the output of the below code


a) #include<stdio.h>
main()
{
int movie = 1;
switch (movie = (8 * movie))
{
default:
printf(" Traffic");break;
case 4:
printf(" Sultan"); break;
case 5:
printf(" Dangal"); break;
case 8:
printf(" Bahubali"); break;
}
}
b)
#include <stdio.h>
main()
{
int num1 = 5;
int num2 = 3;
int num3 = 2;
num1 = num2++;
num2 = --num3;
printf("%d %d %d", num1, num2, num3);
}

15. Evaluate the expression step-by-step according to C’s precedence and associativity rules.

result = a + b ∗ c/d − e && f | g ^ h;

Given the values:

a = 5, b = 3, c = 8, d = 4, e = 2, f = 1, g = 6, h = 3

16. The following operations are performed sequentially, What are the values of x, y, z, and w after each
operation?

int x = 10;
int y = ++x; // Operation 1
int z = x--; // Operation 2
int w = x++ + --y; // Operation 3

17. Fill the blank blocks given in the flow chart to determine whether given number is positive, negative or
equal to zero

18. Design a C-program for a loan eligibility criterion in a bank:


i) The applicant must be at least 25 years old.
ii) The applicant must not be older than 60 years old.
iii) The applicant must have a minimum monthly income of Rs. 40,000.
iv) The applicant must have been employed for at least 2 years.

19. Arrange the lines of code to print the perfect number (Perfect number is sum of factors of the number is
equal to the number itself)
#include <stdio.h>
void main() {
int number, sum = 0;
printf("Enter a number: ");
scanf("%d", &number);
}
for (int i = 0; i < 1; i++) {
if (sum == number) {
printf("%d is a perfect number.\n", number);
}
}
for (int i = 1; i <= number / 2; i++) {
if (number % i == 0) {
sum += i; }
}
else {
printf("%d is not a perfect number.\n", number);
20. Design a C program that reads the number of roses each person has — Ram, Rahim, and Robin. Then,
determine and print the name of the person who has the highest number of roses. If there is a tie, print a
message indicating the tie.

You might also like