1.
다음과 같은 종류의 각 데이터에는 어떤 데이터형을 사용해야 하는가?
(때로는 한 가지 이상의 데이터형이 적용될 수도 있다.)
a. 서울시 인구
b. DVD 영화 제작비
c. 이 장에서 가장 많이 사용한 글자
d. 이 장에 그 글자가 나타난 횟수
->
a. int
b. float or double
c. char
d. int
2.
int형 대신 long형 변수를 사용하는 이유는 무엇인가?
->
int형보다 long형이 더 큰 수를 수용할 수 있어서
3.
32비트 부호 있는 정수를 얻기 위해서는 어떤 이식 가능한 데이터형들을 할 수 있는가?
각각의 데이터형을 선택한 이유는 무엇인가?
->
int32_t, int_least32_t, int_fast32_t
4.
다음과 같은 각 상수들에 대해 데이터형과 의미가 무엇인지 말하라.
a. '\b'
b. 1066
c. 99.44
d. 0XAA
e. 2.0e30
->
a. char형 상수(그러나 int형으로 저장)
b. int형 상수
c. double형 상수
d. unsigned int형 상수(16진수)
e. double형 상수
5.
1
2
3
4
5
6
7
8
9
|
include <stdio.h>
main
(
float g; h;
float tax, rate;
g = e21;
tax = rate * g;
)
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
->
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <stdio.h>
int main()
{
float g, h; /*h 선언만 함*/
float tax, rate; /*rate 값에 대입 안함*/
g = 1e21;
tax = rate * g;
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
6.
12 ; int ; %d
0X3 ; unsigned int ; %#X
'C' ; char ; %c
2.34E07 ; double ; %e
'\040' ; char ; %c
7.0 ; double ; %f
6L ; long ; %ld
6.0f ; float ; %f
0x5.b6p12 ; float ; %a
7.
012 ; unsigned int ; %#o
2.9e05L ; long double ; %Le
's' ; char ; %c
100000 ; long ; %ld
'\n' ; char ; %c
20.0f ; float ; %f
0x44 ; unsigned int ; %x
-40 ; int ; %d
8.
1
2
3
4
5
6
7
|
int imate = 2;
long shot = 53456;
char grade = 'A';
float log = 2.71828;
printf("%d등에 당첨될 확률은 %ld분의 1이다.\n", imate, shot);
printf("%f의 성적은 %c 학점이 아니다.\n", log, grade);
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
9.
ch = '\r';
ch = 13;
ch = '\015';
ch = '\xd';
10.
1
2
3
4
5
6
7
8
|
void main(int)
{
cows, legs integer;
printf("젖소들의 다리를 세어 보니 모두 몇 개더냐?\n);
scanf("%c", legs);
cows = legs / 4;
printf("그렇다면 젖소가 %f마리로구나.\n", cows);
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
->
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <stdio.h>
int main()
{
int cows, legs;
printf("젖소들의 다리를 세어 보니 모두 몇 개더냐?\n");
scanf("%d", &legs);
cows = legs / 4;
printf("그렇다면 젖소가 %d마리로구나.\n", cows);
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
11.
다음과 같은 이스케이프 시퀀스가 나타내는 것은 각각 무엇인가?
a. \n
b. \\
c. \"
d. \t
->
a. 개행 문자
b. 백슬래시 문자
c. 큰따옴표
d. 탭 문자
'C언어' 카테고리의 다른 글
2019.12.07 C언어 기초 플러스 3일차(2일차하고 이어짐) (0) | 2019.12.07 |
---|---|
2019.12.06 C언어 기초 플러스 2일차(2) (0) | 2019.12.06 |
2019.12.05 C언어 기초 플러스 1일차(2) (0) | 2019.12.05 |
2019.12.05 C언어 기초 플러스 1일차(1) (0) | 2019.12.05 |