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

05 Types Tutorial Mod

Uploaded by

timothybonario
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)
5 views

05 Types Tutorial Mod

Uploaded by

timothybonario
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

05 Types

Tutorial Questions

1. What are the following in decimal?

a) 07
b) 077
c) 0777

2. What are the following in decimal?

a) 0x123
b) 0x321
c) 0XABC
d) 0XCBA

3. What are the following in hexadecimal?

a) 07
b) 077
c) 0777

4. What are the following in octal?

a) 0x123
b) 0x321
c) 0XABC
d) 0XCBA

5. Which of the following are not legal constants in C?

a) 010E2
b) 32.1E+5
c) 0790
d) 100_000
e) 3.978e-2

P.T.O. ...

These questions are taken from the recommended textbook for this course:
K. N. King. C Programming; a Modern Approach (Second Edition). Norton and Company, 2008.
6. Assuming an ASCII character set, which one of the following is not a legal way to
write the number 65?

a) ‘A’
b) 0b1000001
c) 0101
d) 0x41

7. For each of the following types of data, specify which one of char, short, int or
long is the smallest one guaranteed to be able to store the data.

a) Days in a month
b) Days in a year
c) Minutes in a day
d) Seconds in a day

8. Suppose that i and j are of type int. What is the type of

i / j + ‘a’ ?

9. Suppose that i is an int, f is a float and d is a double. What type is

i * f / d ?

10. Assuming

char c = ‘1’;
short s = 2;
int i = -3;
long m = 5;
float f = 6.5f
double d = 7.5;

give the value and type of

a) c * i
b) s + m
c) f / c
d) d / s
e) f – d
f) (int) f

11. Use typedef to create types to represent 8-bit, 16-bit and 32-bit integers.

These questions are taken from the recommended textbook for this course:
K. N. King. C Programming; a Modern Approach (Second Edition). Norton and Company, 2008.

You might also like