关闭

几道经典C 语言笔试题

567人阅读 评论(0) 收藏 举报

1.

int main()
{
 int i, n = 20;
 for (i = 0; i < n; i--)
  printf("*");
 return 0;
}

Change/add only one character and print '*' exactly 20 times.
(there are atleast 3 solutions to this problem :-)

2. display below like:

        1
       212
      32123
     4321234
    543212345

3. search for maximum and minimum value, before  save into arrange for any 5 natural number (use multiful for grammer)

ex)

save to any 5 natural number

30 20 75 15 64 <enter>

minimum : 15
maximum : 75


4. use ms-sql of join grammer. show query fot result

Table.1
                ac_country
--------------------------------------
country_cd            country_nm
--------------------------------------
kor                     koera
jpn                     japan
usa                      usa
cha                     china


Table.2
                ac_currency1
-------------------------------------------
country_cd     currency_cd     currency_nm
-------------------------------------------
kor              won               W
jpn              yen               Y
usa              usd               US


# Result
-------------------------------------------
country_nm     currency_cd     currency_nm
-------------------------------------------
korea             won              W
japan             yen              Y
usa               usd              US

Result Query :


5.use ms-sql of join grammer. show query fot result

table.1
              account
--------------------------------------
userid          cost          date
--------------------------------------
use01          10,000       2007-01-02
use02           5,000       2007-01-03
use05           7,000       2007-01-03
use03           5,000       2007-01-03
use01           5,000       2007-01-04
use04           5,000       2007-01-05
use02          10,000       2007-01-05
use01           1,000       2007-01-05


table.2
                 userinfo
-----------------------------------------------
code      userid       money        register
-----------------------------------------------
AAA      use01        8,500        2007-01-02
AAA      use02        5,000        2007-01-03
AAA      use03        2,000        2007-01-04
AAA      use04        4,500        2007-01-05
BBB      use05        5,500        2007-01-02


table.3
  stateinfo
-------------------------------------
connect        state        indate
-------------------------------------
AAA-use01       Yes        2007-01-03
AAA-use02        No        2007-01-05
AAA-use03        No        2007-01-04
AAA-use04       Yes        2007-01-05
BBB-use05        NO        2007-01-04


#result
----------------------------------------------------------
userid    money    account_count   account_total   state
----------------------------------------------------------
use01     8,500          3            16,000        Yes
use02     5,000          2            15,000         No
use03     2,000          1             5,000         No
use04     4,500          1             5,000        Yes


Result Query :


6. show 2 query each fot result.A, result.B

table.data_table
-----------------------
       F_DATE
-----------------------
2007-04-17 11:42:55.200
2007-04-18 01:45:33.403
2007-04-18 01:47:01.500
2007-04-17 11:40:15.000
2007-04-18 11:41:25.700
2007-04-18 11:41:49.420
2007-04-17 11:44:58.000
2007-04-18 11:45:23.340

 

#Result.A
----------
  F_DATE
----------
2007-04-17
2007-04-18

Result Query :


#Result.B
----------
  F_DATE
----------
2


Result Query :

 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:814226次
    • 积分:11720
    • 等级:
    • 排名:第1288名
    • 原创:303篇
    • 转载:137篇
    • 译文:53篇
    • 评论:220条
    最新评论