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

Midsem

ahh ahh

Uploaded by

Swanand Pande
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Midsem

ahh ahh

Uploaded by

Swanand Pande
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSO 101 Computer Programming

Mid Semester Assignment


Answer All Questions
15th May 2021 Maximum Marks 100

1.
a) Describe the four basic datatypes . .How could we extend the range of values they represent?
[2]

b) When dealing with very small or very large numbers, what steps would you take to improve
the accuracy of the calculations? [2]

c) Distinguish between variable and constant? [2]


2
a) Write a program to read two floating point numbers using a scanf
statement , assign their sum to an integer variable and then output the
values of all the three variables. [4]
b) Write a program that request two float type numbers from the user
and then divides the first number by the second and display the result
along with the numbers. [3]

3
A) What is the basic difference between a keyword and an identifier? List
the various keywords in C programming. Write the rules for naming an
identifier. [4]
B) Which of the following are invalid variable names and why? [3]
a) Minimum
b) First.name
c) &name
d) float
e) column-total
f) doubles
4 Write a program to take a navigation key as a single character input from the user. Print the output for
the same. Write the output for all the navigation keys. [2]

5 Is it possible to enter an ascii value from the user and print its respective character on the screen. If
yes then write the program to do so. If no, give the proper reason. [4]

6 Write a program to enter the DoB (Date of Birth) from the user in DD/MM/YYYY format. Find the
current age of the user in days only. You are not allowed to use any conditional statements. Write one
test output also. If the written program does follow the given conditions will be awarded with 0 marks
straightaway. [6]

7 Draw a flow chart diagram to show the internal working of Operating System, related processes and
softwares which is starting from a key pressed from the keyboard till it is typed on the screen. Consider
you just pressed one key from the keyboard and it is printed on the textpad. The diagram will show the
steps taken internally to print the character which is taken as input from the keyboard. [8]
8 What is the value of x in this C code? Explain your answer. [4]

void main()
{
int x = 4 *5 / 2 + 9;
}

9 What is the output of the following program? Explain your answer. [4]

#include <stdio.h>

int main()
{
int a = 1;
int b = 1;
int c = a || --b;
int d = a-- && --b;
printf("a = %d, b = %d, c = %d, d = %d", a, b, c, d);
return 0;
}

10. Determine the output with proper justification. [4]

void main()
{
int i=0, j=1, k=2, m;
m = i++ || j++ || k++;
printf("%d %d %d %d", m, i, j, k);
}
11. What will be the output of this program on an implementation where int occupies 2 bytes? Explain
your answer. [4]

#include <stdio.h>
void main()
{
int i = 3;
int j;
j = sizeof(++i + ++i);
printf("i=%d j=%d", i, j);
}

12. What is the value of z in the sample code given below? Explain your answer. [4]
int z, x=5, y= -10, a=4, b=2;
z = x++ - --y*b/a;

13. If a five-digit number is input through the keyboard, write a program to print a new number by
adding one to each of its digits. For example if the number that is input is 12391 then the output should
be displayed as 23402. [5]
14. A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is
input through the keyboard in hundreds, find the total number of currency notes of each denomination
the cashier will have to give to the withdrawer. [5]
15. In a town, the percentage of men is 52. The percentage of total literacy is 48. If total percentage of
literate men is 35 of the total population, write a program to find the total number of illiterate men and
women if the population of the town is 80,000. [5]
16. Two numbers are input through the keyboard into two locations C and D. Write a program to
interchange the contents of C and D. [5]
17. Draw a flow chart to find (i) gcd of two numbers (ii) nCr given n and r [5+5]
18. What is the difference between compiler and interpreter ? Give two examples for compiled and
interpreted languages [3]
19. How does a high-level language like C differ from an assembly language ? [3]
20. What are different types of registers and their functions [4]

You might also like