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

Tutorial Sheet (CSO 101 Computer Programming) I

The document provides a tutorial sheet with 12 questions covering topics such as IEEE 754 floating point number representation, C code output, 1's and 2's complement representations, programs to sum digits of a number, sort strings alphabetically, find the median of integers, multiply positive integers recursively, replace characters in a string, and count blanks/tabs/newlines in text.
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)
20 views

Tutorial Sheet (CSO 101 Computer Programming) I

The document provides a tutorial sheet with 12 questions covering topics such as IEEE 754 floating point number representation, C code output, 1's and 2's complement representations, programs to sum digits of a number, sort strings alphabetically, find the median of integers, multiply positive integers recursively, replace characters in a string, and count blanks/tabs/newlines in text.
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/ 1

Tutorial Sheet (CSO 101: Computer Programming)

Full Marks: 30
Final Submission Date: 06.12.2022

1. Represent (5. 25)10 using IEEE 754 Floating point number representation. [2]
2. Mention appropriate output/Warning/Compilation error for the following C code segment.
#include<stdio.h>
Int main()
{
Int k=5;

printf(“ The value of post Increment is %d \n”, (k+1)++);

return 0;
}
[2]
3. Write down the 8-bit 1’s complement representation of +17, -24. [2]
4. Write down the output of the programme snippet. [2]
for (int i = 0; i < 10; i++)
{
printf ("%d \n", i);
if(i==4) continue;
if (i/5|| i/7)
break;
}
5. Write 8-bit 2’s complement representation of 34, -43. [2]
6. Write a program that reads a positive integer and outputs the sum of its digits.
Ex: On input 342 the program should output 9. [3]
7. Write a program to get a string of length N from the user and print them in alphabetical
order. [3]
8. Write a program which finds the median of N integers where N is also an input. [3]
9. Write a recursive function to multiply two positive integer numbers. [3]
10. Write a flowchart to find 2’s complement of an integer which is represented in 8-bit
binary representation. [2]
11. Write a program that reads two characters a and b, and a stream of 100 characters. The
program should output the stream of 50 characters such that all occurrences of
characters a are replaced by b. Ex: If the input is a='T', b='E', and the character stream is
- The name of this course is computer programming... The output should be Ehe name
of this course is computer programming… [3]
12. Write a program to count blanks, tabs, and newlines in an input stream of 300
characters. [3]

You might also like