String類相關的常見面試題

2021-08-18 03:57:44 字數 1538 閱讀 6773

1.下面程式段的執行結果是?(a)

public

static

void

main(string args)

a. true true          b.true false     c.false false     d.false true

2.下面的程式建立了多少個物件? (b)

public

static

void

main(string args)

a.1      b.2     c.3      d.4

3.下面程式段的執行結果是?(d)

public

static

void

main(string args)

a. true true          b.true false     c.false false     d.false true

4.下面程式執行的結果是?(a)

public

static

void

main(string args)

a. true true          b.true false     c.false false     d.false true

5.下面程式的執行結果是?(d)

public

static

void

main(string args)

a. true true          b.true false     c.false false     d.false true

6.equals(object obj)、equalsignorecase(string str)、contains(string str)、startswith(string str)、endswidth(string str)、isempty()各方法的作用?

答案:

equals(object obj):比較字串的內容是否相同,區分大小寫

equalsignorecase(string str):比較字串的內容是否相同,忽略大小寫

contains(string str):判斷大字串中是否包含小字串

startswith(string str):判斷字串是否以某個指定的字串開頭

endswidth(string str):判斷字串是否以某個指定的字串結尾

isempty():判斷字串是否為空

7.下面程式執行結果是?(c)

public

static

void

main(string args)

a.true true          b.true 異常     c.false 異常     d.false true

常見面試題

1.get和post的區別 1 本質區別 get是向伺服器請求資料,post是向伺服器傳送資料。2 伺服器獲取值的方式 get方式提交的資料,伺服器端使用request.querystring獲取變數的值。post方式提交的資料,伺服器端使用request.form獲取資料。3 安全性 get安全效...

常見面試題

1 一行 實現1 100之和 lst i for i in range 1,101 print sum lst 2 如何在乙個函式內部修改全域性變數?在函式內部新增 global 變數名 這樣就可以在本地作用域定義全域性作用域了 name 大明 def eat name1 global name n...

常見面試題

dns解析 發起tcp三次握手,並建立tcp連線 發起http請求 伺服器相應http請求並得到html 伺服器解析html 並對頁面進行渲染然後返回給使用者 首先先進行ioc容器的初始化 ioc 容器的初始化過程分為三步驟 resource 定位 beandefinition 的載入和解析,bea...