Uploaded by Devanshi Chauhan

Fundamentals of Computing Science

advertisement
1
1.1 Evaluate the following expression without using code blocks.
int i =9,j=6;
float x =0.5,y =0.1;
char a ='a', b ='b';
Expression
Output (With Justification)
(3 * i – 2 * j) % (2 * a - b)
x
(x>y) && (i>0) && (j>5)
(1)&&(1)&&(1)
=1
a==99
0(a=97)
2. Write a C program to accept three integer numbers and display the Average as float using
type casting technique.
3.1 Find the output of following code snippets without running the code on codeblocks.
Justify your answer.
int main( )
{
int d = 14;
int m = 7;
int y = 4696;
int c = 0;
int val;
val = ( d + m + y + (y/4) + c) % 7;
printf (“%d”,val);
return 0;
}
Output - 4
3.2 Find the output of following code snippets without running the code on codeblocks.
Justify your answer.
int main()
{
int x, y = 25, z = 25;
x = y == z;
printf("%d", x);
}
Output - 1
4 Write a program to check if the year is entered is leap year or not. (if-else)
5. Write a program to Check whether entered character is vowel, consonant (if-else)
6. Write a program to check the validity of triangle based on the sides and then classify into the types
of triangle.
Download