-此次很幸運沒出現什麼大問題,大概都能解決。只是發現編程真是一個須要細心的事情。java
(本週代碼輸入狀況)git
錯題1及緣由,理解狀況:
A cast is required in which of the following situations? (下列哪一種狀況須要強制轉換?)
A . using charAt to take an element of a String and store it in a char (使用charAt來獲取字符串元素並將其存儲爲char類型)
B . storing an int in a float (將一個int類型的數存儲爲float類型)
C . storing a float in a double (將一個float類型的數存儲爲double類型)
D . storing a float in an int (將一個float類型的數存儲爲int類型)
E . all of the above require casts (以上全部狀況都須要強制轉換)編程
個人答案:E 正確答案:D
現在分析與理解數據類型轉換時double>float>long>int>char>shart>byte.逆向轉換需聲明數據結構
錯題2及緣由,理解狀況:
Which of the following is true regarding the mod operator, %? (關於求餘運算符%,下面哪項是正確的?)
A . It can only be performed on int values and its result is a double (它只能執行int類型的數值,其結果是double類型的數)
B . It can only be performed on int values and its result is an int (它只能執行int類型的數值,其結果也是int類型的數)
C . It can only be performed on float or double values and its result is an int (它只能執行float或者double類型的數值,其結果是int類型的數)
D . It can only be performed on float or double values and its result is a double (它只能執行float或者double類型的數值,其結果是double類型的數)
E . It can be performed on any numeric values, and the result always is numeric (它能夠執行任何類型的數值,其結果始終是數值)dom
個人答案:B 正確答案:E
錯誤緣由:測試前作過相關的一個程序,關於Double型數據能不能求餘。由於那個程序有一些其餘的錯誤致使我覺得Double型數據不能求餘!!!但其實時能夠求得。學習
錯題3及緣由,理解狀況:
What is output with the statement System.out.println(x+y); if x and y are int values where x=10 and y=5? (若是x和y是int類型的數值,x=10,y=5,那麼語句System.out.println(x+y);的輸出是什麼?)
A . 15
B . 105
C . 10 5
D . x+y
E . An error since neither x nor y is a String (因x和y都不是字符串而引發的一個錯誤)測試
個人答案:B 正確答案:A
錯誤緣由:混淆了數字加法與字符串的拼接。數字的加法時會用括號括起來。ui
錯題4及緣由,理解狀況:
What value will z have if we execute the following assignment statement?
int z = 50 / 10.00; (若是咱們執行下面的賦值語句,z將獲得什麼值?)
A . 5
B . 5.0
C . 50
D . 10
E . none of the above, a run-time error arises because z is an int and 50 / 10.00 is not (以上皆錯,因z是一個整型數而50 / 10.00不是,會產生運行時錯誤)設計
個人答案:A 正確答案:E
理解狀況:弄錯了數據類型轉換時應該生命的位置。若是答案是A時其問題應該時z=(int)(50/10.00).調試
錯題5及緣由,理解狀況:
You cannot cast a String to be a char and you cannot cast a String which stores a number to be an int, float or double. (你不能將字符串強制轉換爲char類型,也不能將一個字符串強制轉換爲int、float或double類型。)
A . true
B . false
個人答案:B 正確答案:A
錯誤緣由:對char類型不熟悉。char類型在Java語言中,表明一個字符,且只能表示一個!
錯題6及緣由,理解狀況:
A variable of type boolean will store either a 0 or a 1. (Boolean類型的變量將被存儲爲0或1)
A . true
B . false
個人答案:A 正確答案:B
錯誤緣由:電腦中的數據都是二進制0 或者1存儲的,因此覺得就是對的。布爾型只包含兩個有效值:true and false.不能轉換成其餘任何類型的值。可是這說的時儲存啊,儲存不就是0 or 1 嗎??還請老師或者助教講解一下
代碼行數(新增/累積) | 博客量(新增/累積) | 學習時間(新增/累積) | 重要成長 | |
---|---|---|---|---|
目標 | 5000行 | 30篇 | 400小時 | |
第一週 | 072/200 | 1/1 | 05/20 | |
第二週 | 300/500 | 2/2 | 18/38 | |
第三週 | 972 /1000 | 4 /4 | 39/60 |