practice exam c

practice exam c - KEY CPSC 206 507 Final Exam Spring 2006...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
KEY CPSC 206 – 507 Final Exam Spring 2006 (20060510) SID/SSN: Score Possible Points Part One 10 pts Part Two 35 pts Part Three 20 pts Part Four 35 pts Part Five 15 pts Part Six 25 pts Total 140 pts 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
PART ONE (10 points) 1. What is the output of the following code? #include <stdio.h> #include <string.h> #define MAXSTRING 100 main() { char c=’a’, *p, s[MAXSTRING]; p=&c; printf(“%c%c%c “, *p, *p+1, *p+2); strcpy(s, “ABC”); printf(“%s %c%c%s\n”, s, *s+6, *s+7, s+1); strcpy(s,”she sells sea shells by the seashore”); p=s+14; for ( ; *p != ’\0’; ++p) { if (*p == ‘e’) *p=’E’; if (*p == ‘ ‘) *p=’\n’; } printf(“%s\n”, s); } abc ABC GHBC she sells sea shElls by thE sEashorE 2
Background image of page 2
PART TWO (35 points). Each question is worth 3 (+/-) points. Short Answers. 2. How is the char ‘e’ represented in the computer? char e = 101 base 10 = 65 base 8 = 01100101 base 2. How is the logical value ‘true’ represented in the computer? Any non-zero value. How is the int ‘256’ represented in the computer? 256 base 10 = 0100 base 16 = 00000001 00000000 base 2. How is the float ‘1.8’ represented in the computer? 1.8 base 10 = 1.2E07AE0 base 16 = 0 100 0000 0001 0111 0000 0011 1101 0111 = 401703D7 base 16 How is the double ‘1.8’ represented in the computer? 1.8 base 10 = 1.2E07AE0 base 16 =
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/19/2012 for the course MATH MATH 304 taught by Professor Young during the Spring '09 term at Texas A&M.

Page1 / 7

practice exam c - KEY CPSC 206 507 Final Exam Spring 2006...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online