<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            華為認證考試題及答案

            時間:2024-07-25 19:40:59 華為認證 我要投稿
            • 相關推薦

            2016年華為認證考試題及答案

              華為認證考試由Prometric考試服務公司代理。華為認證不同級別與方向的認證考試項目具有不同的考試要求與流程。要獲得HCNA、HCNP、HCIE等華為認證,需參加并通過一門或多門與認證項目對應的考試。本文為大家推薦的是華為認證的上機考試題及答案,希望能給予大家幫助!

            2016年華為認證考試題及答案

              1、通過鍵盤輸入100以內正整數的加、減運算式,請編寫一個程序輸出運算結果字符串。

              輸入字符串的格式為:“操作數1 運算符 操作數2”,“操作數”與“運算符”之間以一個空格隔開。

              補充說明:

              1. 操作數為正整數,不需要考慮計算結果溢出的情況。

              2. 若輸入算式格式錯誤,輸出結果為“0”。

              要求實現函數:

              void arithmetic(const char *pInputStr, long lInputLen, char *pOutputStr);

              【輸入】 pInputStr: 輸入字符串

              lInputLen: 輸入字符串長度

              【輸出】 pOutputStr: 輸出字符串,空間已經開辟好,與輸入字符串等長;

              【注意】只需要完成該函數功能算法,中間不需要有任何IO的輸入輸出

              示例

              輸入:“4 + 7” 輸出:“11”

              輸入:“4 - 7” 輸出:“-3”

              輸入:“9 ++ 7” 輸出:“0” 注:格式錯誤

              復制代碼

              1 void arithmetic(const char *pInputStr,long lInputLen,char *pOutputStr)

              2 {

              3 assert(pInputStr!=NULL && pOutputStr!=NULL && lInputLen>0);

              4 int iOperand1=0;

              5 int iOperand2=0;

              6 char cSymbol;

              7 long i;

              8 for (i=0;;i++)

              9 {

              10 if (pInputStr[i]>='0' && pInputStr[i]<='9')

              11 {

              12 iOperand1=iOperand1*10+(pInputStr[i]-'0');

              13 }

              14 else if (pInputStr[i]==' ')

              15 {

              16 break;

              17 }

              18 else

              19 {

              20 return;

              21 }

              22 }

              23

              24 for (++i;;i++)

              25 {

              26 if (pInputStr[i]=='+' || pInputStr[i]=='-')

              27 {

              28 cSymbol=pInputStr[i];

              29 }

              30 else if (pInputStr[i]==' ')

              31 {

              32 break;

              33 }

              34 else

              35 {

              36 return;

              37 }

              38 }

              39

              40 for (++i;i

              41 {

              42 if (pInputStr[i]>='0' && pInputStr[i]<='9')

              43 {

              44 iOperand2=iOperand2*10+(pInputStr[i]-'0');

              45 }

              46 else

              47 {

              48 break;

              49 }

              50 }

              51 int iTemp;

              52 switch(cSymbol)

              53 {

              54 case '+':

              55 iTemp=iOperand1+iOperand2;

              56 break;

              57 case '-':

              58 iTemp=iOperand1-iOperand2;

              59 break;

              60 default:

              61 break;

              62 }

              63

              64 int k=0;

              65 if (iTemp<0)

              66 {

              67 iTemp=-iTemp;

              68 pOutputStr[0]='-';

              69 k++;

              70 }

              71

              72 char cTemp[10];

              73 itoa(iTemp,cTemp,10);

              74 int j=0;

              75 while(cTemp[j])

              76 {

              77 pOutputStr[k++]=cTemp[j++];

              78 }

              79

              80 pOutputStr[k]='\0';

              81

              82 }

              復制代碼

              2、手機號碼合法性判斷(20分)

              問題描述:

              我國大陸運營商的手機號碼標準格式為:國家碼+手機號碼,例如:8613912345678。特點如下:

              1、 長度13位;

              2、 以86的國家碼打頭;

              3、 手機號碼的每一位都是數字。

              請實現手機號碼合法性判斷的函數(注:考生無需關注手機號碼的真實性,也就是說諸如86123123456789這樣的手機號碼,我們也認為是合法的),要求:

              1) 如果手機號碼合法,返回0;

              2) 如果手機號碼長度不合法,返回1

              3) 如果手機號碼中包含非數字的字符,返回2;

              4) 如果手機號碼不是以86打頭的,返回3;

              【注】除成功的情況外,以上其他合法性判斷的優先級依次降低。也就是說,如果判斷出長度不合法,直接返回1即可,不需要再做其他合法性判斷。

              要求實現函數:

              int verifyMsisdn(char* inMsisdn)

              【輸入】 char* inMsisdn,表示輸入的手機號碼字符串。

              【輸出】 無

              【返回】 判斷的結果,類型為int。

              示例

              輸入: inMsisdn = “869123456789“

              輸出: 無

              返回: 1

              輸入: inMsisdn = “88139123456789“

              輸出: 無

              返回: 3

              輸入: inMsisdn = “86139123456789“

              輸出: 無

              返回: 0

              復制代碼

              1 int verifyMsisdn(char *inMsisdn)

              2 {

              3 assert(inMsisdn!=NULL);

              4

              5 int iLen=strlen(inMsisdn);

              6 if (iLen!=13)

              7 {

              8 return 1;

              9 }

              10

              11 for (int i=0;i

              12 {

              13 if (inMsisdn[i]<'0' || inMsisdn[i]>'9')

              14 {

              15 return 2;

              16 }

              17 }

              18

              19 if (inMsisdn[0]!='8' || inMsisdn[1]!='6')

              20 {

              21 return 3;

              22 }

              23

              24 return 0;

              25

              26 }

              復制代碼

              3、將一個字符串的元音字母復制到另一個字符串,并排序(30分)

              問題描述:

              有一字符串,里面可能包含英文字母(大寫、小寫)、數字、特殊字符,現在需要實現一函數,將此字符串中的元音字母挑選出來,存入另一個字符串中,并對字符串中的字母進行從小到大的排序(小寫的元音字母在前,大寫的元音字母在后,依次有序)。

              說明:

              1、 元音字母是a,e,i,o,u,A,E,I,O,U。

              2、 篩選出來的元音字母,不需要剔重(chong);

              最終輸出的字符串,小寫元音字母排在前面,大寫元音字母排在后面,依次有序。

              要求實現函數:

              void sortVowel (char* input, char* output);

              【輸入】 char* input,表示輸入的字符串

              【輸出】 char* output,排好序之后的元音字符串。

              【返回】 無

              示例

              輸入:char *input = “Abort!May Be Some Errors In Out System. “

              輸出:char *output =“aeeeooouAEIO “

              復制代碼

              1 void sortVowel(char *pInput,char *pOutput)

              2 {

              3 assert(pInput!=NULL && pOutput!=NULL);

              4

              5 int iLen=strlen(pInput);

              6 char *pSmall=new char[iLen+1];

              7 char *pLarge=new char[iLen+1];

              8

              9 int iSmallCount=0;

              10 int iLargeCount=0;

              11

              12 for (int i=0;i

              13 {

              14 if (pInput[i]=='a' || pInput[i]=='e' || pInput[i]=='i' || pInput[i]=='o' || pInput[i]=='u')

              15 {

              16 pSmall[iSmallCount++]=pInput[i];

              17

              18 }

              19 else if (pInput[i]=='A' || pInput[i]=='E' || pInput[i]=='I' || pInput[i]=='O' || pInput[i]=='U')

              20 {

              21 pLarge[iLargeCount++]=pInput[i];

              22 }

              23 }

              24

              25 sort(pSmall,pSmall+iSmallCount);

              26 sort(pLarge,pLarge+iLargeCount);

              27

              28 int j,k=0;

              29 for (j=0;j

              30 {

              31 pOutput[k++]=pSmall[j];

              32 }

              33 for (j=0;j

              34 {

              35 pOutput[k++]=pLarge[j];

              36 }

              37

              38 pOutput[k]='\0';

              39

              40 delete []pSmall;

              41 delete []pLarge;

              42 }

              復制代碼

              4、我國公民的身份證號碼特點如下:

              1、 長度為18位;

              2、 第1~17位只能為數字;

              3、 第18位可以是數字或者小寫英文字母x。

              4、 身份證號碼的第7~14位表示持有人生日的年、月、日信息。

              例如:511002198808080111或51100219880808011x。

              請實現身份證號碼合法性判斷的函數。除滿足以上要求外,需要對持有人生日的年、月、日信息進行校驗。年份大于等于1900年,小于等于2100年。 需要考慮閏年、大小月的情況。所謂閏年,能被4整除且不能被100整除 或 能被400整除的年份,閏年的2月份為29天,非閏年的2月份為28天。其他情況的合法性校驗,考生不用考慮。

              函數返回值:

              1) 如果身份證號合法,返回0;

              2) 如果身份證號長度不合法,返回1;

              3) 如果身份證號第1~17位含有非數字的字符,返回2;

              4) 如果身份證號第18位既不是數字也不是英文小寫字母x,返回3;

              5) 如果身份證號的年信息非法,返回4;

              6) 如果身份證號的月信息非法,返回5;

              7) 如果身份證號的日信息非法,返回6(請注意閏年的情況);

              【注】除成功的情況外,以上其他合法性判斷的優先級依次降低。也就是說,如果判斷出長度不合法,直接返回1即可,不需要再做其他合法性判斷。

              要求實現函數:

              int verifyIDCard(char* input)

              【輸入】 char* input,表示輸入的身份證號碼字符串

              【輸出】 無

              【返回】 判斷的結果,類型為int

              示例

              1) 輸入:”511002111222”,函數返回值:1;

              2) 輸入:”511002abc123456789”,函數返回值:2;

              3) 輸入:”51100219880808123a”,函數返回值:3;

              4) 輸入:”511002188808081234”,函數返回值:4;

              5) 輸入:”511002198813081234”,函數返回值:5;

              6) 輸入:”511002198808321234”,函數返回值:6;

              7) 輸入:”511002198902291234”,函數返回值:6;

              8) 輸入:”511002198808081234”,函數返回值:0;

              復制代碼

              1 int verifyIDCard(char *input)

              2 {

              3 assert(input!=NULL);

              4

              5 int iLen=strlen(input);

              6 if (iLen!=18)

              7 {

              8 return 1;

              9 }

              10

              11 int i;

              12 for (i=0;i<17;i++)

              13 {

              14 if (input[i]<'0' || input[i]>'9')

              15 {

              16 return 2;

              17 }

              18 }

              19

              20 if ((input[17]<'0' || input[17]>'9') && input[17]!='x')

              21 {

              22 return 3;

              23 }

              24

              25 int iYear=0;

              26 for (i=6;i<10;i++)

              27 {

              28 iYear=iYear*10+(input[i]-'0');

              29 }

              30 if (iYear<1900 || iYear>2100)

              31 {

              32 return 4;

              33 }

              34

              35 int iMonth=0;

              36 for (i=10;i<12;i++)

              37 {

              38 iMonth=iMonth*10+(input[i]-'0');

              39 }

              40 if (iMonth<1 || iMonth>12)

              41 {

              42 return 5;

              43 }

              44

              45 int iDay=0;

              46 for (i=12;i<14;i++)

              47 {

              48 iDay=iDay*10+(input[i]-'0');

              49 }

              50

              51 if ((iYear%4==0) || (iYear%100!=0 && iYear%400==0))

              52 {

              53 if (iMonth==2)

              54 {

              55 if (iDay<1 || iDay>29)

              56 {

              57 return 6;

              58 }

              59 }

              60 else if (iMonth==1 || iMonth==3 || iMonth==5 || iMonth==7 || iMonth==8 ||iMonth==10 || iMonth==12)

              61 {

              62 if (iDay<1 || iDay>31)

              63 {

              64 return 6;

              65 }

              66 }

              67 else

              68 {

              69 if (iDay<1 || iDay>30)

              70 {

              71 return 6;

              72 }

              73 }

              74 }

              75 else

              76 {

              77

              78 if (iMonth==2)

              79 {

              80 if (iDay<1 || iDay>28)

              81 {

              82 return 6;

              83 }

              84 }

              85 else if (iMonth==1 || iMonth==3 || iMonth==5 || iMonth==7 || iMonth==8 ||iMonth==10 || iMonth==12)

              86 {

              87 if (iDay<1 || iDay>31)

              88 {

              89 return 6;

              90 }

              91 }

              92 else

              93 {

              94 if (iDay<1 || iDay>30)

              95 {

              96 return 6;

              97 }

              98 }

              99 }

              100

              101 return 0;

              102

              103 }

            【華為認證考試題及答案】相關文章:

            華為認證最新試題及答案08-28

            華為認證考試模擬卷及答案03-10

            華為hcna認證模擬試題及答案03-19

            華為認證考試試題及答案03-05

            Adobe認證考試題及答案06-25

            2016華為HCNE認證模擬試題及答案03-06

            華為認證中的HCIE認證03-19

            2016年華為認證考試題庫02-26

            2024華為認證考試仿真試題(附答案)10-26

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看