You are on page 1of 4

TRNG H S PHM K THUT TPHCM

KHOA IN-IN T

Mn: K thut lp trnh v giao tip

BM: IN T VIN THNG

Ch k gim th 1

P N CUI K HK 2 NM HC 2014 - 2015


M mn hc: PRIN337664

Ch k gim th 2

s/M : 01 thi c 6 trang.


Thi gian: 90 pht.
S dng ti liu trn giy, khng s dng laptop, in
thoi.

im v ch k

SV lm bi trc tip trn thi, vit kt qu vo


cc hoc cc dng qui nh.
CB chm thi th nht

CB chm thi th hai


H v tn:.................................................................
M s SV:.................................................................
S TT: ...................... Phng thi: ..............................

V tr c nh du

l p n

Cu 1: (0.5 im) Cho bit kt qu in ra mn hnh sau khi chy chng trnh sau:

12

Cu 2: (0.5 im) Cho bit kt qu in ra mn hnh sau khi chy chng trnh sau:

27

25

10

Cu 3: (1.0 im) Cho bit kt qu in ra mn hnh sau khi chy chng trnh sau: 0.2 cho
mi dng c kt qu ng

Dng 1

20

Dng 2

60

Dng 3

120

Dng 4

120

Dng 5

S hiu: BM3/QT-PBCL-RTV

Trang: 1/1

Cu 4: (1.0 im) Cho on chng trnh di y, hy vit li chng trnh s dng cu


trc lp WHILE sao cho chc nng chng trnh khng thay i
#include <stdio.h>
void main()
{
int i=0;
while(i<10)
{
printf("\n %d",i);
i+=3;
}
}

Cu 5: (0.5 im) Cho on chng trnh di y, hy vit li chng trnh s dng cu


trc r nhnh IF sao cho chc nng chng trnh khng thay i
#include <stdio.h>
void main()
{
int x;
printf("\n Nhap gia tri cua x= ");
scanf("%d",&x);
if((x==1)||(x==3)||(x==5)||(x==7)||(x==9))printf("\n Ban da nhap so le");
else if((x==2)||(x==4)||(x==6)||(x==8))printf("\n Ban da nhap so chan");
else printf("\n Chi nhap so tu 0-9");
}

Cu 6: (1.0 im) Cho bit kt qu in ra mn hnh sau khi chy chng trnh sau:
t 1.0 ch khi ghi ng 5 gi tr

2015

889

2000

15

Cu 7: (2.5 im) Di y l khung m ngun ca chng trnh thc hin chc nng: khi
to mng 1 chiu c s lng n phn t. Xc nh s lng s l c trong mng. In ra mn
hnh gi tr ca cc s l c phn n v l 7 trong mng va khi to. Gi s dy s nhp l:
8

100

17

20

27

117

for(int i=0;i<n;i++)
{
printf("\n Phan tu thu %d=",i);
scanf("%d",p+i);
}

55

83

0.5

//Hy gi hm ham1 v truyn vo cc tham s sau cho khi thc hin ham1 s
lng phn t mang gi tr l s c lu vo bin dem

ham1(p,n);

0.5

//Hy hon thnh on chng trnh sau in ra gi tr cc s l c


phn n v l 7 trong mng c khi to trn, gi : gi hm ham2
xc nh 1 s c phi l s c gi tr phn n v l 7

if(ham2(*(p+i)))
printf("\n %d",*(p+i));

0.5

S hiu: BM3/QT-PBCL-RTV

Trang: 1/1

}
void ham1(int *p, int n)

{
for(int i=0;i<n;i++)
if(*(p+i)%2==1)
dem++;

Cu 8: (2.0 im) Di y l khung m ngun ca chng trnh thc hin s dng cu trc
t to sinhvien nhm qun l mt mng cc bin kiu cu trc, mi bin thuc kiu sinhvien
c 3 trng tn (ten), m s sinh vin (mssv), im C (diemC). Da vo 3 trng thng tin ny
hy b sung cc on m ngun hon thin chng trnh vi yu cu: nhp d liu cho
mng cu trc, in ra m s sinh vin v im ca cc sinh vin u mn C, in ra tn ca sinh
vin no c im C cao nht. Gi s cho bng d liu nh sau:
Stt
0
1
2
3
4

Ten
Binh
An
Phuc
Tam
Truong

MSSV
K12035
K12044
K12051
K12083
K12066

diemC
3.5
5.2
7.8
4.5
9.0

char ten[30];
char MSSV[30];
float diemC;

0.25

printf("\n nhap vao ten SV: ");


gets(sv[i].ten);
printf("\n nhap vao MSSV: ");
gets(sv[i].MSSV);
printf("\n nhap vao diem C: ");
scanf("%f", &sv[i].diemC);

for(int i=0;i<5;i++)
if(sv[i].diemC>=5)
{
printf("Sinh vien voi MSSV %s voi so diem la %2.2f
\n",sv[i].MSSV,sv[i].diemC);

float max=sv[0].diemC;
int index;
for(int i=0;i<5;i++)
if(max<sv[i].diemC){max=sv[i].diemC;
index=i;}
printf("\n Sinh vien %s co diem C cao nhat la
%f",sv[index].ten,max);

S hiu: BM3/QT-PBCL-RTV

0.5

0.5

0.5
0.25

Trang: 1/1

Cu 9: (1.0 im) Cho chng trnh C# vi giao din c thit kt nh hnh di. Tn ca
cc i tng trn Form (radioButton, textbox, Button) c t nh minh ha trong hnh.
private void button1_Click(object sender, EventArgs e)
{
double a = 0, b = 0;
a = Convert.ToDouble(textBox1.Text);
(0.25 )
if (radioButton1.Checked == true)
b = a * 1.8 + 32; (0.25 )
else
b = (a - 32) / 1.8;
(0.25 )
textBox2.Text = Convert.ToString(b);

(0.25 )

Ngy 16 thng 06 nm 2015


Thng qua B mn

S hiu: BM3/QT-PBCL-RTV

Trang: 4/6