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

Mody University of Science and Technology Faculty of Engineering and Technology

This document is the midterm examination for a programming language course taken by engineering students. It contains 4 questions assessing various programming concepts. Question 1 has 5 subparts testing if/else statements, switch statements, logical operators, for loops, and while loops. Question 2 asks students to write programs to check voter eligibility based on age and calculate food discount based on original price. Question 3 requires extracting even digits from a number. Question 4 finds the middle age out of 3 ages provided as input. The exam is out of a total of 20 marks and allocated 1 hour for completion.

Uploaded by

kakhani
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)
22 views

Mody University of Science and Technology Faculty of Engineering and Technology

This document is the midterm examination for a programming language course taken by engineering students. It contains 4 questions assessing various programming concepts. Question 1 has 5 subparts testing if/else statements, switch statements, logical operators, for loops, and while loops. Question 2 asks students to write programs to check voter eligibility based on age and calculate food discount based on original price. Question 3 requires extracting even digits from a number. Question 4 finds the middle age out of 3 ages provided as input. The exam is out of a total of 20 marks and allocated 1 hour for completion.

Uploaded by

kakhani
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
You are on page 1/ 2

Mody University of Science and Technology

Faculty of Engineering and Technology


Mid Term Examination-I, Spring Semester 2014-2015
B. Tech. / MBA(T)(ECE/EE/ME/IT ), 1st Year

Course Name: Programming language


Course Code: CS 14.101 Max. Mark: 20
Total no. of Printed Pages: 2 Time: 1 Hr
1.

Instruction to candidates:
1. All questions are compulsory and carry equal marks.
Q.1 What would be the output of following code? [ 1*5=5 ]

( a ) #include<stdio.h>
void main() { if(!5)
printf(“Teachers”);
else
printf(“Students”);
}
( b ) #include<stdio.h>
void main() { int x=2;
switch(x%2)
{ case 1: printf(“Cakes”);
case 2:printf(“Chocolates”);
default: printf(“Pizza”);
}}
( c ) #include<stdio.h>
void main() {
int a=5,b=0,c;
c = a ||b;
printf(“%d”,++c);
}
( d ) #include<stdio.h>
void main() { int i;
for(i=0;i<10;i=i+2);
printf(“%d”,i);
}
( e ) #include<stdio.h>
void main() { while (1)
printf(“ Mody University\n”);
}

1/2
Q.2 ( i ) The voter’s eligibility age in our country is 18 years. Write a program to input the age of a
person and print whether the person is eligible to vote or not. [3]

INPUT : 19
OUTPUT: Eligible to vote

( ii ) A restaurant outside your campus offers discount of 10% on every food item. Write a program
to input the original cost of the food item and calculate the cost after discount. Print the
discounted price. [2]

INPUT : 100
OUTPUT:90

Q.3 Write a program to input a number and print the even digits of the number. [5]

INPUT : 12345
OUTPUT: 2 4

Q.4 Write a program to input age of three persons and find out the middle age. [5]

INPUT : 19 17 21
OUTPUT: 19

2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy