Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

C Programming MIT Problem SET2 - Solutions

Rating
-
Sold
-
Pages
4
Grade
A
Uploaded on
19-10-2023
Written in
2023/2024

"C Programming MIT Problem Set 1" is a valuable educational resource designed for individuals interested in mastering the intricacies of the C programming language, particularly from a problem-solving perspective. Developed by the Massachusetts Institute of Technology (MIT), this problem set offers a series of challenging exercises and tasks aimed at enhancing one's understanding of C programming. Whether you are a student looking to strengthen your programming skills or an enthusiast interested in solving complex problems, this resource provides an excellent platform for honing your C programming abilities. By engaging with these MIT problem sets, you can sharpen your problem-solving skills, gain a deeper understanding of C, and broaden your horizons in the world of computer science.

Show more Read less
Institution
Course

Content preview

Massachusetts Institute of Technology
Department of Electrical Engineering and Computer Science

6.087: Practical Programming in C

IAP 2010

Problem Set 2 – Solutions
Types, operators, expressions

Out: Tuesday, January 12, 2010. Due: Wednesday, January 13, 2010.

Problem 2.1
Determine the size,minimum and maximum value following data types. Please specify if your
machine is 32 bit or 64 bits in the answer.

• char

• unsigned char

• short

• int

• unsigned int

• unsigned long

• float

Hint: Use sizeof() operator,limits.h and float.h header files
Answer: On my 32-bit machine (/usr/include/limits.h,/usr/include/float.h), the sizes and limits
are as follows. Results may differ if you used a 64 bit machine.

Data type size (bytes) min max
char 1 SCHAR MIN (-128) SCHAR MAX (127)
unsigned char 1 0 UCHAR MAX(255)
short 2 SHRT MIN (-32768) SHRT MAX (32767)
int 4 INT MIN (-2147483648) INT MAX (2147483647)
unsigned int 4 0 UINT MAX(4294967295)
unsigned long 4 0 ULONG MAX(4294967295)
float 4 FLT MIN(1.175494e-38) FLT MAX(3.402823e+38)

Problem 2.2
Write logical expressions that tests whether a given character variable c is

• lower case letter (Answer: c>=’a’&& c<=’z’)

• upper case letter (Answer: c>=’A’&& c<=’Z’)

• digit (Answer: c>=’0’&& c<=’9’)

1

Written for

Course

Document information

Uploaded on
October 19, 2023
Number of pages
4
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$49.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
shubhjaiswal

Get to know the seller

Seller avatar
shubhjaiswal Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
48
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions