bootstrap:
用bootstrap進行網(wǎng)頁的修飾,源碼如下:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" />
</head>
<body style="border:1px red solid; padding:10px">
<h1 class="text-center"><strong>統(tǒng)一建模語言理論測試</strong></h1>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<label class="control-label col-md-4" for="formGroupInputLarge">考試科目:統(tǒng)一建模語言</label>
<label class="control-label col-md-4" for="formGroupInputLarge">時間:100分鐘</label>
<label class="control-label col-md-4" for="formGroupInputLarge">得分</label>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<form class="form-inline">
<div class="form-group">
<label>班級(必填):</label>
<input type="text" class="form-control" id="exampleInputName2" />
</div>
</form>
</div>
<div class="col-md-4">
<form class="form-inline">
<div class="form-group">
<label class="control-label">學號(必填):</label>
<input type="text" class="form-control" id="exampleInputName2" />
</div>
</form>
</div>
<div class="col-md-4">
<form class="form-inline">
<div class="form-group">
<label for="exampleInputName2">姓名(必填):</label>
<input type="text" class="form-control" id="exampleInputName2" />
</div>
</form>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> 一、填空題(每空5分,共20分) </h3>
</div>
<div class="panel-body">
<div style="margin:5px">
1.UML的中文全稱是:
</div>
<input type="text" class="form-control" />
<div style="margin-top:15px">
<div style="margin:5px">
2.對象最突出的特征是:
</div>
<div class="row">
<div class="col-xs-4">
<input type="text" class="form-control" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" />
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> 二、選擇題(每空10分,共20分) </h3>
</div>
<div class="panel-body">
1.UML與軟件工程的關(guān)系是:
<br />
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> (A)UML就是軟件工程 </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> (B)UML參與到軟件工程中軟件開發(fā)過程的幾個階段 </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> (C)UML與軟件工程無關(guān) </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> (D)UML是軟件工程的一部分 </label>
</div>
<div style="margin-top:15px">
2.Java語言支持:
<br />
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> (A)單繼承 </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> (B)多繼承 </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> (C)單繼承和多繼承都支持 </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> (D)單繼承和多繼承都不支持 </label>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> 三、多項選擇題(每空10分,共20分) </h3>
</div>
<div class="panel-body">
1. 用例的粒度分為以下哪三種:
<br />
<div class="checkbox">
<label> <input type="checkbox" value="" /> (A)需求級 </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (B)概述級 </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (C)用戶目標級 </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (D)子功能級 </label>
</div>
<div style="margin-top:15px">
2. 類圖由以下哪三部分組成:
<br />
<div class="checkbox">
<label> <input type="checkbox" value="" /> (A)名稱(Name) </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (B)屬性(Attribute) </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (C)操作(Operation) </label>
</div>
<div class="checkbox">
<label> <input type="checkbox" value="" /> (D)方法(Function) </label>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> 四、判斷題(每題10分,共20分) </h3>
</div>
<div class="panel-body">
1.用例圖只是用于和客戶交流和溝通的,用于確定需求。
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> </label>
</div>
<div style="margin-top:15px">
2.在狀態(tài)圖中終止狀態(tài)在一個狀態(tài)圖中允許有任意多個。
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" /> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> </label>
</div>
<div class="radio">
<label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2" /> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> </label>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"> 五、簡答題(每題20分,共20分) </h3>
</div>
<div class="panel-body">
<div style="margin:5px">
1.簡述什么是模型以及模型的表現(xiàn)形式?
</div>
<textarea class="form-control" rows="3"></textarea>
</div>
</div>
<center>
<button type="button" class="btn btn-success">計算分數(shù)</button>
</center>
<hr />
</body>
</html>
效果如圖:

JavaScript
字符串
字符串必須使用引號包圍,其中,引號可以使用單引號也可使用雙引號,但必須成對出現(xiàn)。如:
"Hello World"
'世界,你好'
'Hello World,1946'
日志輸出
利用console中輸出.log()中括號內(nèi)的內(nèi)容,如:
console.log('Hello World');
在控制臺輸出字符串的結(jié)果是該字符串引號內(nèi)的字符,不包含引號。且輸出的是字符本身(javascript),而不是字符的類型(String)。
注釋符號
分號可加可不加,但當多條語句寫于一行時,必須加分號。
對js進行注釋時單行注釋使用//多行使用/* */進行注釋。
復制聲明
JavaScript 中創(chuàng)建變量經(jīng)常被稱為 “聲明” 變量。需要通過 var 語句來聲明 JavaScript 變量。
聲明之后,變量并沒有值,不過我們可以在聲明變量時向變量 賦值:
var x = 5;
var name = "Tom";
簡單數(shù)據(jù)類型
- undefined : 這個值表示變量不含有值。
- null : 這個值表示變量為空。
undefined 和 null 的區(qū)別是:typeof(undefined) 返回值是 'undefined',typeof(null) 返回值是字符串 'object'(對象類型)。
- boolean : true 或 false 代表布爾值。
- number : javascript 只有一種數(shù)字類型。數(shù)字可以帶小數(shù)點,也可以不帶。如:123 和12.3
- srting : 字符串是字符的載體,而且必須被成對的引號包圍。
復雜數(shù)據(jù)類型
javascript中的復雜數(shù)據(jù)類型只有一種,即 對象(object)。
{} 花括號,用來定義一個對象;
- 定義方式:
對象由花括號包圍。在括號內(nèi)部,屬性以鍵值對的形式,如 key : value 來定義,又稱屬性名和屬性值。屬性間由逗號分隔。例如:
var student={name:'Tom', finish_work:true, id:123};
- 獲取方式
name = student.name;
或
name = student['name'];
特殊的對象 - 數(shù)組(array)
數(shù)組由方括號包圍。在括號內(nèi)部,數(shù)據(jù)以獨立值的形式 value 來定義。數(shù)據(jù)值之間由逗號分隔。比如課程名的數(shù)組:
var courses = [ "Maths", "Chinese", "Biology", "Physics"];
需要注意數(shù)組的下標(序號)是從零開始的。
算術(shù)運算符
- +加號
- -減號
- /除號
- *乘號
- %求余
- ++累加
- -- 遞減
優(yōu)先級:++ -- , * / % , + -
關(guān)于+:
+運算符除了用于代碼中數(shù)學計算,還可以用于把字符串變量加起來(連接起來),這時的 + 運算符就不是數(shù)學運算中的 求和 了,而是字符串運算中的 拼接 作用。
比較運算符
x == y //等于 (判斷x,y的值是否相等)
x === y //等于 (判斷x,y的值和類型是否都相同)
x != y //不等于 (判斷x,y的值是否不相等)
x > y //大于 (判斷x是否大于y)
x < y //小于 (判斷x是否小于y)
x >= y //大于等于 (判斷x是否大于或者等于y)
x <= y //小于等于 (判斷x是否小于或者等于y)
當表達式符合判斷條件時,返回值是true 不符合判斷條件時,返回值是false。
邏輯運算符
邏輯運算符就三種
&& || !
條件運算符
JavaScript中條件判斷語句的基本語法:
condition ? expr1 : expr2;
condition實際值為true時,執(zhí)行expr1。condition實際值為false時,執(zhí)行expr2。
判斷語句
語法:
// 當 condition 的結(jié)果是 true 時,statement1 將會被執(zhí)行。
// 否則,statement2 將會被執(zhí)行。
if (condition) {
statement1; //當 condition 的值為 true 時,statement1 被執(zhí)行。
} else {
statement2; //當 condition 的值為 false 時,statement2 被執(zhí)行。
}
循環(huán)語句
語法 :
// for循環(huán)的語法:結(jié)合下面流程圖理解(每次循環(huán)的執(zhí)行順序為:1-2-4-3, 1-2-4-3, ...)
for (1初始化表達式;2條件表達式;3更新表達式)
{
4循環(huán)體函數(shù)
}
// 語法拆解
for (變量=初始值;變量<=最終值;變量=變量+步進值)
{
需要執(zhí)行的代碼塊
}
函數(shù)
- 聲明
通過函數(shù)聲明語句來定義一個函數(shù).函數(shù)聲明語句以關(guān)鍵字 function 開始,其后跟有 函數(shù)名 參數(shù)列表 和 函數(shù)體代碼塊。
function 函數(shù)名(參數(shù), 參數(shù), ...){
代碼塊
}
- 調(diào)用
在javascript中,代碼是自上而下執(zhí)行的,但函數(shù)的聲明代碼不會被執(zhí)行,準確的說,函數(shù)的聲明代碼也是被執(zhí)行了,只不過執(zhí)行的結(jié)果就跟聲明變量一樣,只是聲明而已。 只有在調(diào)用該函數(shù)時才會執(zhí)行該函數(shù)內(nèi)部的代碼。如:
console.log("1");
function write(){ // 聲明一個函數(shù)(沒有參數(shù),且沒有返回值)
console.log("2");
}
console.log("3");
write(); // 調(diào)用函數(shù)
/*執(zhí)行結(jié)果
console > 1
console > 3
console > 2*/
作用域
所有{}包起來的代碼,都可以稱之為 “代碼塊” , 英文名叫Block。
每個代碼塊都有一個自己的作用域,作用域決定了變量能否被訪問(不論讀取變量還是修改變量)。
訪問的規(guī)則大概是這樣的:
- 在最上層沒有任何{}包裹的作用域為頂層作用域,聲明的變量是哪里都可以訪問的
- 任何一個代碼塊,{}之間的代碼區(qū)域稱之為它的作用域,每一對大括號括起來的代碼塊里聲明的變量,只能在這個代碼塊的作用域里訪問,不過在js里是不具備這個能力的。 這是一個語言缺陷,在新版js(所謂的EcmaScript6,簡稱es6)中加入了let關(guān)鍵字,使用let關(guān)鍵字聲明的變量就會遵守塊級作用域的規(guī)則了, 但是es6目前不是所有瀏覽器都支持
- 代碼塊是有層級的,在一個代碼塊里寫的新的代碼塊,后者是前者的子作用域
- 子作用域可以訪問父作用域的變量,但是父作用域無法訪問子作用域的變量
- 作用域的父級的父級作用域的變量,該作用域里也可以訪問,甚至無窮多級父的作用域里的變量都可以被訪問,這種無窮多級的父,被稱之為祖先
- 頂層作用域是所有作用域的祖先