Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 久久亚洲精品中文字幕60分钟,91正在播放,亚洲视频第一页

          整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          程序員面試必備PHP基礎面試題 – 第十一天

          、兩張表 city表和province表。分別為城市與省份的關系表。

          表名:city
          id City Provinceid
          1 廣州 1
          2 深圳 1
          3 惠州 1
          4 長沙 2
          5 武漢 3
          ………. 廣州
          表名稱:province:
          id Province
          1 廣東
          2 湖南
          3 湖北
          ……….

          1、寫一條sql語句關系兩個表,實現:顯示城市的基本信息。顯示字段:城市id ,城市名, 所屬省份 。
          如:
          Id(城市id) Cityname(城市名) Privence(所屬省份)

          select A.id,A.Cityname,B.Province from city as A,province as B where A.provinceid=B.id

          2、如果要統計每個省份有多少個城市,請用group by 查詢出來。顯示字段:省份id ,省份名,包含多少個城市。

          select B.id,B.Province,count(*) as num from city A,province B where A.provinceid=B.id group by B.id

          二、主鍵 和外鍵表示什么?一般用于做什么?

          主鍵:能夠唯一表示數據表中的每個記錄的字段或者字段的組合就稱為主鍵。一個主鍵是唯一識別一個表的每一行記錄,但這只是其作用的一療分,主鍵的主要作用是將記錄和存放在其他表中的數據進行關聯,在這一點上,主鍵是不同表中各記錄間的簡單指針,主鍵約整就是確定表中的每一條記錄,主鍵不能是空值,唯一約束是用于指定一個或多個列的組合值具有唯一性,以防止在列中輸入重復的值,所以,主鍵的值對用戶而言是沒有什么意義,并且和它賦予的值也沒有什么特別聯系。

          外鍵:若有兩個表A,B,C是A的主鍵,而B中也有C字段,則C就是表B的外鍵,外鍵約束主要用來維護兩個表之間數據的一致性。A為基本表,B為信息表。
          在數據庫中,常常不只是一個表,這些表之間也不是相互獨立的,不同的表之間需要建立一種關系,才能將它們的數據相互溝通,而在這個溝通過程中,就需要表中有一個字段作為標志,不同的記錄對應的字段取值不能相同,也不能是空白的,通過這個字段中不同的值可以區別各條記錄,就像我們區別不同的人,每個人都有名字,但它卻不能作為主鍵,因為人名很容易出現重復,而身份證號是每個人都不同的,所以可以根據它來區別不同的人,數據庫的表中作為主鍵的段段就要像人的身份證號一樣,必須是每個記錄的值都不同,這才能根據
          主鍵的值來確定不同的記錄。

          關系:外鍵一定是另外某個表的主鍵。

          三、select now(),Date_ADD(now(),INTERVAL 14 day),Date_SUB(now(),INTERVAL 3 Day) from table; 會獲得什么內容,請寫出來。

          會獲得三條數據:
          第一條:當前時間;
          第二條:當前時間加上14天;
          第三條:當前時間減去3天。

          四、您所知道的MYSQL 數據庫備份,還原方式有哪幾種?
          備份:
          一,搭建主從架構,master-slave,通過binlog文件同步復制主庫的數據,也可以直接通過binlog文件恢復數據。
          二,通過系統計劃任務執行mysqldump做周期性全備份。
          三,物理備份,直接拷貝數據文件、參數文件、日志文件。
          還原:
          一.通過mysql操作工具,如phpmyadmin,sqlyog等導入備份過的數據庫文件。
          二.將物理備份的文件拷貝到mysql的data目錄下

          五、內容管理系統中,表message有如下字段
          id 文章id
          title 文章標題
          content 文章內容
          category_id 文章分類id
          hits 點擊量
          創建上表,寫出MySQL語句

          Create table if not exists message(

            Id int not null AUTO_INCREMENT PRIMARY key comment '文章id',

            title varchar(60) not null comment '文章標題',

            Content text not null comment '文章內容',

            Category_id tinyint not null comment '文章分類id',

            Hits int not null default 0 comment '點擊量'

          )engine=myisam default charset = utf8;

          六、同樣上述內容管理系統:表comment記錄用戶回復內容,字段如下
          comment_id 回復id
          id 文章id,關聯message表中的id
          comment_content 回復內容
          現通過查詢數據庫需要得到以下格式的文章標題列表,并按照回復數量排序,回復最高的排在最前面
          文章id 文章標題 點擊量 回復數量
          用一個SQL語句完成上述查詢,如果文章沒有回復則回復數量顯示0

          select m.id,m.title,m.hits,count(c.comment_content) count from message m,comment c where m.id = c.coment_id group by m.id order by count desc;

          七、內容管理系統,表category保存分類信息,字段如下
          category_id int(4) not null auto_increment;
          category_name varchar(40) not null;
          用戶輸入文章時,通過選擇下拉菜單選定文章分類
          寫出如何實現這個下拉菜單

          <?php

          $dsn = ‘mysql:host=***;dbname=***’;

          $pdo = new PDO($dsn,’用戶名’,’密碼’);

          $sql = ‘select category_id,category_name from category’;

          $list = $pdo->query($sql);

          //使用類似smarty模板引擎

          $this->assign(‘list’,$list);

          ?>

          //模板實現端

          <select name=””>

          <option>-請選擇分類-</option>

          {foreach $list as $val}

          <option value=”{$val.category_id}”>{$val.category_name}</option>

          {/foreach}

          </select>

          八、PHP文件操作

          1、內容管理系統:用戶提交內容后,系統生成靜態HTML頁面;寫出實現的基本思路

          2、簡單描述用戶修改發布內容的實現流程和基本思路

          1)當用戶提交后生成一個由url地址MD5后的文件的編譯頁面,用文件處理file函數生成一個模板合成頁,判斷模板編譯頁是否有,模板頁無或者編譯頁的創建時間戳小于模板頁的修改時間都會從新生成編譯頁面,編譯后的頁面會調用對應數據庫的值顯示在頁面中,通過對內存數據的讀取釋放,顯示出我們看到的靜態數據,然后用file文件將其保存起來生成靜態的頁面

          2)當用戶修改了發布內容都會修改數據相關的內容,并通過編譯頁面更新靜態數據并用文件的方式緩存起來,當用戶查看時將不做任何數據庫查找,直接調用該緩存文件即可

          7、事件代理

          事件代理 也就是 事件委托

          不是直接給標簽添加事件 是給標簽的父級添加事件 通過 事件對象 判斷觸發事件的標簽對象是誰 執行不同的函數程序的語法形式

          委托的優點

          減少內存消耗
          試想一下,若果我們有一個列表,列表之中有大量的列表項,我們需要在點擊列表項的時候響應一個事件

          如果給每個列表項一一都綁定一個函數,那對于內存消耗是非常大的,效率上需要消耗很多性能;

          因此,比較好的方法就是把這個點擊事件綁定到他的父層,也就是 ul 上,然后在執行事件的時候再去匹配判斷目標元素;

          所以事件委托可以減少大量的內存消耗,節約效率。

          動態綁定事件
          比如上述的例子中列表項就幾個,我們給每個列表項都綁定了事件;

          在很多時候,我們需要通過 AJAX 或者用戶操作動態的增加或者去除列表項元素,那么在每一次改變的時候都需要重新給新增的元素綁定事件,給即將刪去的元素解綁事件;

          如果用了事件委托就沒有這種麻煩了,因為事件是綁定在父層的,和目標元素的增減是沒有關系的,執行到目標元素是在真正響應執行事件函數的過程中去匹配的;

          所以使用事件在動態綁定事件的情況下是可以減少很多重復工作的。


          88、不卡頓

          如何在不卡住頁面的情況下渲染數據,也就是說不能一次性將幾萬條 都渲染出來,而應該一次渲染部分 DOM,那么就可以通過 requestAnimationFrame 來 每 16 ms 刷新一次。

          <ul>控件</ul>
           <script>
              setTimeout(() => {
                 // 插入十萬條數據
                const total = 100000
                // 一次插入 20 條,如果覺得性能不好就減少
                const once = 20
                // 渲染數據總共需要幾次
               const loopCount = total / once
                let countOfRender = 0
                let ul = document.querySelector("ul");
                function add() {
                // 優化性能,插入不會造成回流
                 const fragment = document.createDocumentFragment();
                for (let i = 0; i < once; i++) {
                  const li = document.createElement("li");
                  li.innerText = Math.floor(Math.random() * total);
                  fragment.appendChild(li);
                }
               ul.appendChild(fragment);
               countOfRender += 1;
               loop();
            }
            function loop() {
                if (countOfRender < loopCount) {
                 window.requestAnimationFrame(add);
             }
            }
            loop();
            }, 0);

          89、JavaScript中的instanceof

          JavaScript中變量的類型判斷常常使用typeof運算符,但使用typeof時存在一個缺陷,就是判斷引用類型存儲值時,無論引用的是什么類型的對象,它都返回 object。ECMAScript 引入了另一個 Java 運算符 instanceof 來解決這個問題。instanceof 運算符與 typeof 運算符相似,用于識別正在處理的對象的類型。與 typeof 方法不同的是,instanceof 方法要求開發者明確地確認對象為某特定類型。
          
          1.instanceof運算符用法
          
          var strObj = new String("字符串");
          console.log(strObj instanceof String);// true
          
          
          該段代碼判斷的是變量strObj是否為String對象的實例,strObj 是 String 對象的實例,因此是”true”。盡管不像 typeof 方法那樣靈活,但是在 typeof 方法返回 “object” 的情況下,instanceof 方法就很有用。
          
          // 判斷 foo 是否是 Foo 類的實例
          function Foo(){}
          var foo = new Foo();
          
          console.log(foo instanceof Foo)
          
          
          2.instanceof在繼承關系中使用
          
          // 判斷 foo 是否是 Foo 類的實例 , 并且是否是其父類型的實例
          function Aoo(){}
          function Foo(){}
          Foo.prototype = new Aoo(); //JavaScript 原型繼承
          
          var foo = new Foo();
          console.log(foo instanceof Foo)//true
          console.log(foo instanceof Aoo)//true
          foo作為構造函數Foo的實例,因為構造函數Foo原型繼承了構造函數Aoo,因此返回true。該代碼中是判斷了一層繼承關系中的父類,在多層繼承關系中,instanceof 運算符同樣適用。
          
          3.instanceof運算符代碼
          function instance_of(L, R) { //L 表示左表達式,R 表示右表達式
          var O = R.prototype; // 取 R 的顯示原型
          L = L.__proto__; // 取 L 的隱式原型
          while (true) {
            if (L === null)
              return false;
            if (O === L) // 這里重點:當 O 嚴格等于 L 時,返回 true
              return true;
            L = L.__proto__;
          }
          }

          90、forEach中的await

          不知道你是否寫過類似的代碼:

          function test() {
               let arr = [3, 2, 1]
               arr.forEach(async item => {
                const res = await fetch(item)
                console.log(res)
               })
               console.log('end')
              }
          
           function fetch(x) {
           return new Promise((resolve, reject) => {
            setTimeout(() => {
             resolve(x)
            }, 500 * x)
           })
          }
          
          test()

          我當時期望的打印順序是

          3
          2
          1
          end
          結果現實與我開了個玩笑,打印順序居然是
          
          end
          1
          2
          3
          為什么?

          其實原因很簡單,那就是 forEach 只支持同步代碼。

          我們可以參考下 Polyfill 版本的 forEach,簡化以后類似就是這樣的偽代碼

          while (index < arr.length) {
            callback(item, index)   //也就是我們傳入的回調函數
          }

          從上述代碼中我們可以發現,forEach 只是簡單的執行了下回調函數而已,并不會去處理異步的情況。并且你在 callback 中即使使用 break 也并不能結束遍歷。

          怎么解決?

          一般來說解決的辦法有2種,for...of和for循環。

          使用 Promise.all 的方式行不行,答案是:不行

          從上述代碼中我們可以發現,forEach 只是簡單的執行了下回調函數而已,并不會去處理異步的情況。并且你在 callback 中即使使用 break 也并不能結束遍歷。
          
          怎么解決?
          
          一般來說解決的辦法有2種,for...of和for循環。
          
          使用 Promise.all 的方式行不行,答案是:不行

          可以看到并沒有按照我們期望的輸出。

          這樣可以生效的原因是 async 函數肯定會返回一個 Promise 對象,調用 map 以后返回值就是一個存放了 Promise 的數組了,這樣我們把數組傳入 Promise.all 中就可以解決問題了。但是這種方式其實并不能達成我們要的效果,如果你希望內部的 fetch 是順序完成的,可以選擇第二種方式。

          第1種方法是使用 for...of

          async function test() {
            let arr = [3, 2, 1]
            for (const item of arr) {
             const res = await fetch(item)
             console.log(res)
            }
            console.log('end')
           }

          這種方式相比 Promise.all 要簡潔的多,并且也可以實現開頭我想要的輸出順序。

          但是這時候你是否又多了一個疑問?為啥 for...of 內部就能讓 await 生效呢。

          因為 for...of 內部處理的機制和 forEach 不同,forEach 是直接調用回調函數,for...of 是通過迭代器的方式去遍歷。

          async function test() {
           let arr = [3, 2, 1]
           const iterator = arr[Symbol.iterator]()
           let res = iterator.next()
           while (!res.done) {
            const value = res.value
            const res1 = await fetch(value)
            console.log(res1)
            res = iterator.next()
           }
           console.log('end')
          }

          第2種方法是使用 for循環

          async function test() {
            let arr = [3, 2, 1]
            for (var i=0;i<arr.length;i++) {
              const res = await fetch(arr[i])
              console.log(res)
            }
            console.log('end')
          }
          
          function fetch(x) {
           return new Promise((resolve, reject) => {
            setTimeout(() => {
             resolve(x)
            }, 500 * x)
           })
          }
          
          test()

          第3種方法是使用 while循環

          async function test() {
            let arr = [3, 2, 1]
            var i=0;
            while(i!==arr.length){
              const res = await fetch(arr[i])
              console.log(res)
              i++;
            }
            console.log('end')
          }
          
          function fetch(x) {
           return new Promise((resolve, reject) => {
            setTimeout(() => {
             resolve(x)
            }, 500 * x)
           })
          }
          
          test()

          要想在循環中使用async await,請使用for...of 或者 for 循環, while循環

          forEach支持async awaitforEach 在正常情況像下面這么寫肯定是做不到同步的,程序不會等一個循環中的異步完成再進行下一個循環。原因很明顯,在上面的模擬中,while 循環只是簡單執行了 callback,所以盡管 callback 內使用了 await ,也只是影響到 callback 內部。

          arr.myforeach(async v => {
              await fetch(v);
          });

          要支持上面這種寫法,只要稍微改一下就好

          Array.prototype.myforeach = async function (fn, context = null) {
              let index = 0;
              let arr = this;
              if (typeof fn !== 'function') {
                  throw new TypeError(fn + ' is not a function');
              }
              while (index < arr.length) {
                  if (index in arr) {
                      try {
                          await fn.call(context, arr[index], index, arr);
                      } catch (e) {
                          console.log(e);
                      }
                  }
                  index ++;
              }
          };

          91、src和href

          src和href都是用在外部資源的引入上,比如圖像,CSS文件,HTML文件,以及其他的web頁面等等,那么src和href的區別都有哪些呢?

          1、請求資源類型不同
          (1) href是Hypertext Reference的縮寫,表示超文本引用。用來建立當前元素和文檔之間的鏈接。常用的有:link、a。
          (2)在請求 src 資源時會將其指向的資源下載并應用到文檔中,常用的有script,img 、iframe;

          2、作用結果不同
          (1)href 用于在當前文檔和引用資源之間確立聯系;

          (2)src 用于替換當前內容;

          3、 瀏覽器解析方式不同
          (1)若在文檔中添加href ,瀏覽器會識別該文檔為 CSS 文件,就會并行下載資源并且不會停止對當前文檔的處理。這也是為什么建議使用 link 方式加載 CSS,而不是使用 @import 方式。

          (2)當瀏覽器解析到src ,會暫停其他資源的下載和處理,直到將該資源加載、編譯、執行完畢,圖片和框架等也如此,類似于將所指向資源應用到當前內容。這也是為什么建議把 js 腳本放在底部而不是頭部的原因。

          92、JavaScript中事件綁定的方法

          在JavaScript的學習中,我們經常會遇到JavaScript的事件機制,例如,事件綁定、事件監聽、事件委托(事件代理)等。這些名詞是什么意思呢,有什么作用呢?

          一、事件綁定要想讓 JavaScript 對用戶的操作作出響應,首先要對 DOM 元素綁定事件處理函數。所謂事件處理函數,就是處理用戶操作的函數,不同的操作對應不同的名稱。

          在JavaScript中,有三種常用的綁定事件的方法:

          在DOM元素中直接綁定;在JavaScript代碼中綁定;綁定事件監聽函數。

          1、在DOM中直接綁定事件

          我們可以在DOM元素上綁定onclick、onmouseover、onmouseout、onmousedown、onmouseup、ondblclick、onkeydown、onkeypress、onkeyup等。好多不一一列出了。如果想知道更多事件類型請查看, DOM事件 。
          
          <input type="button" value="click me" onclick="hello()">
          
          
          <script>
          function hello(){
           alert("hello world!");
          }

          2、在JavaScript代碼中綁定事件

          在 JS 代碼中(即 script 標簽內)綁定事件可以使 JS 代碼與HTML標簽分離,文檔結構清晰,便于管理和開發。
          
          <input type="button" value="click me" id="btn">
          
          <script>
          document.getElementById("btn").onclick = function(){
           alert("hello world!");
          }

          3、使用事件監聽綁定事件

          綁定事件的另一種方法是用 addEventListener() 或 attachEvent() 來綁定事件監聽函數。下面詳細介紹,事件監聽。


          1)事件監聽

          關于事件監聽,W3C規范中定義了3個事件階段,依次是捕獲階段、目標階段、冒泡階段。
          
          起初Netscape制定了JavaScript的一套事件驅動機制(即事件捕獲)。隨即IE也推出了自己的一套事件驅動機制(即事件冒泡)。最后W3C規范了兩種事件機制,分為捕獲階段、目標階段、冒泡階段。IE8以前IE一直堅持自己的事件機制(前端人員一直頭痛的兼容性問題),IE9以后IE也支持了W3C規范。
          
          W3C規范
          
          element.addEventListener(event, function, useCapture)
          event : (必需)事件名,支持所有 DOM事件 。
          function:(必需)指定要事件觸發時執行的函數。
          useCapture:(可選)指定事件是否在捕獲或冒泡階段執行。true,捕獲。false,冒泡。默認false。
          注:IE8以下不支持。
          
          <input type="button" value="click me" id="btn1">
          
          <script>
          document.getElementById("btn1").addEventListener("click",hello);
          function hello(){
           alert("hello world!");
          }
          IE標準
          
          
          element.attachEvent(event, function)
          event:(必需)事件類型。需加“on“,例如:onclick。
          function:(必需)指定要事件觸發時執行的函數。
          <input type="button" value="click me" id="btn2">
          <script>
          document.getElementById("btn2").attachEvent("onclick",hello);
          function hello(){
           alert("hello world!");
          }
          <script>
          document.getElementById("btn2").attachEvent("onclick",hello);
          function hello(){
           alert("hello world!");
          }

          2)事件監聽的優點

          1、可以綁定多個事件;常規的事件綁定只執行最后綁定的事件。

          <input type="button" value="click me" id="btn3">
          <input type="button" value="click me" id="btn4">
          
          var btn3 = document.getElementById("btn3");
          btn3.onclick = function(){                  //動態綁定事件
           alert("hello 1");           //不執行
          }
          btn3.onclick = function(){
           alert("hello 2");           //執行
          }
          
          
          var btn4 = document.getElementById("btn4");
          btn4.addEventListener("click",hello1);      //添加事件監聽器
          btn4.addEventListener("click",hello2);
          
          function hello1(){
           alert("hello 1");        //執行
          }
          function hello2(){
           alert("hello 2");        //執行 (順序執行)
          }

          2、可以解除相應的綁定

          <input type="button" value="click me" id="btn5">
          
          <script>
          var btn5 = document.getElementById("btn5");
          btn5.addEventListener("click",hello1);//執行了
          btn5.addEventListener("click",hello2);//不執行
          btn5.removeEventListener("click",hello2);
          
          
          function hello1(){
           alert("hello 1");
          }
          function hello2(){
           alert("hello 2");
          }

          3)封裝事件監聽

          <input type="button" value="click me" id="btn5">
          
          //綁定監聽事件
          function addEventHandler(target,type,fn){
           if(target.addEventListener){
           target.addEventListener(type,fn);
           }else{
           target.attachEvent("on"+type,fn);
           }
          }
          
          //移除監聽事件
          function removeEventHandler(target,type,fn){
           if(target.removeEventListener){
           target.removeEventListener(type,fn);
           }else{
           target.detachEvent("on"+type,fn);
           }
          }

          93、git常見分支

          git 分支命名規范
          為規范開發,保持代碼提交記錄以及 git 分支結構清晰,方便后續維護,現規范 git 的相關操作。

          主要規范兩點:

          git 分支命名規范

          git 提交記錄規范

          1. git 分支命名規范
          git 分支分為集成分支、功能分支和修復分支,分別命名為 develop、feature 和 hotfix,均為單數。不可使用 features、future、hotfixes、hotfixs 等錯誤名稱。

          master(主分支,永遠是可用的穩定版本,不能直接在該分支上開發)
          develop(開發主分支,所有新功能以這個分支來創建自己的開發分支,該分支只做只合并操作,不能直接在該分支上開發)
          feature-xxx(功能開發分支,在develop上創建分支,以自己開發功能模塊命名,功能測試正常后合并到develop分支)
          feature-xxx-fix(功能bug修復分支,feature分支合并之后發現bug,在develop上創建分支修復,之后合并回develop分支。PS:feature分支在申請合并之后,未合并之前還是可以提交代碼的,所以feature在合并之前還可以在原分支上繼續修復bug)
          hotfix-xxx(緊急bug修改分支,在master分支上創建,修復完成后合并到 master)


          注意事項:
          一個分支盡量開發一個功能模塊,不要多個功能模塊在一個分支上開發。
          feature 分支在申請合并之前,最好是先 pull 一下 develop 主分支下來,看一下有沒有沖突,如果有就先解決沖突后再申請合并。


          94、前端引擎模板

          JavaScript隨著各種神奇的實用功能庫日漸豐富,而越來越受到Web開發者與設計師的追捧,例如jQuery,MooTools,Prototype等。

          1) Jade

          Jade是一個有著完善API和驚艷特性的JavaScript模板引擎。使用空白與縮進敏感的代碼格式編寫HTML頁面。基于Node.js,運行在服務器端。

          2) Mustache

          Mustache是一個logic-less(無邏輯或輕邏輯)語法模板。可以用于組織HTML、配置文件、源代碼在內的任何東西。Mustache使用JavaScript對象的值,用來擴展模板代碼中的大括號標簽。

          3) Transparency

          Transparency是一個強大的客戶端模板引擎,用來將數據綁定到Web頁面的BOM結構中。其模板無需特殊格式,直接完全符合HTML。直接使用JavaScript邏輯,無需新學特殊的“模板語言”。兼容IE9+、Chrome、Fx、iOS、安卓等瀏覽器。

          4) Underscore.js

          Underscore.js是一個JavaScript庫,提供一系列實用的工具函數(helper)。Underscore.js僅作為額外的工具函數獨立工作,不擴充(污染)任何JavaScript內建對象的本身。

          5) Embeddedjs

          EJS以類似PHP的JS/HTML通過標簽混排的形式,幫助開發者將JavaScript和HTML部分有效分離。

          6) DoTjs

          最快和簡潔的JavaScript模板引擎,同時用于Node.js和瀏覽器。

          7) Handlebarsjs

          一套語義化模板引擎。兼容Mustache。

          8) T.js

          一個用簡單的JavaScript數據結構去渲染表現html/xml內容的模板引擎。

          9) Dustjs

          一套同時可用于瀏覽器或Node.js的異步模板引擎。

          10) Nunjucks

          Nunjucks是一套富功能的模板引擎。模板語言功能強大,支持塊繼承、自動轉義、宏、異步控制等功能。

          怎么樣的模板引擎是適合前端的

          前端模板引擎需要有開發時的透明性我認為前端任何框架和工具都要有對開發的透明性,模板引擎也不例外。所謂透明性即指我在搭建好開發環境后,隨手寫代碼隨手刷新瀏覽器就能看到最新的效果,而不需要額外地執行任何命令或有任何的等待過程所以一切依賴編譯過程的模板引擎并不適合前端使用,編譯只能是模板引擎的一個特性,而不能是使用的前提更嚴格地說,使用FileWatch等手段進行文件變更檢測并自動編譯也不在我的考慮范圍之內,因為這會造成額外的等待,像我這種手速極快的人可能編譯速度跟不上由此可以推出,前端的模板引擎應該是具備可在純前端環境中解析使用的能力的

          前端模板引擎要有良好的運行時調試能力

          前端并不像后端,任何錯誤都可以有嚴格的日志記錄和調用堆棧以供分析。

          由于用戶行為的不確定性、執行環境的不確定性、各種第三方腳本的影響等,前端很難做到完全的錯誤處理和跟蹤,這也導致前端必然存在需要直接在線上排查問題的情況而當問題出現在模板引擎這一層時,就需要模板引擎提供良好的調試能力

          一般來說,編譯后生成的函數的調試能力是弱于原先手動編寫的模板片斷的,因為自動生成的函數基本不具備可讀性和可斷點跟蹤性因此在這一點上,一個供前端使用的模板引擎應該具備在特定情況下從“執行編譯后函數獲取HTML”換回“解析原模板再執行函數獲取HTML”的模式,即應該支持在兩種模式間切換或者更好地,

          一個強大的前端模板引擎編譯生成的函數,可以使用Source Map或其它自定義的手段直接映射回原模板片段,不過現在并沒有什么模板引擎實現了這一功能

          前端模板引擎要對文件合并友好

          在HTTP/2普及之前,文件合并依舊是前端性能優化中的一個重要手段,模板作為文件的一部分,依舊是需要合并的

          在提供編譯功能的模板引擎中,我們可以使用編譯的手段將模板變為JavaScript源碼,再在JavaScript的基礎上做文件合并

          但是如果我們出于上文所說的調試能力等原因希望保留原模板片段,那就需要模板引擎本身支持模板片段合并為一個文件了

          大部分僅支持將一段輸入的字符串作為模板解析的引擎并不具備這一能力,他們天生并不能將一整個字符串切分為多個模板片段,因而無法支持模板片段層面上的文件合并

          需要實現對文件合并的支持,最好的辦法就是讓模板的語法是基于“片段”的

          前端模板引擎要擔負XSS的防范

          從安全性上來說,前端對XSS的控制是有嚴格要求的

          我在 單頁面(SPA)開發會不會比多頁面有更多的安全問題?- 張立理的回答 中有提到過,前端對XSS的防范比較合適的方法是使用“默認轉義”的白名單式策略

          基于此,一個合理的模板引擎是必須支持默認轉義的,即所有數據的輸出都默認經過escape的邏輯處理,將關鍵符號轉為對應的HTML實體符號,以從根源上杜絕XSS的入侵路徑

          當然并不是所有的內容都必須經過轉義的,在系統中免不了有對用戶輸入富文本的需求,因此需要支持特定的語法來產生無轉義的輸出,但時刻注意無轉義輸出才是特例,默認情況下必須是轉義輸出的

          前端模板引擎要支持片段的復用

          這并不是前端模板引擎的需求,事實上任何模板引擎都應該支持片段的復用,后端如Velocity、Smarty等無不擁有此功能

          所謂片段復用,應該有以下幾個層次的應用:

          一個片段可以被引入到另一處,相當于一個變量到處用的效果

          一個片段被引入時,可以向其傳遞不同的數據,相當于一個函數到處用的效果

          一個片段可以被外部替換,但外部不提供此片段的話保持一個默認的內容,類似設計模式中的策略模式

          滿足第1和第2點的模板引擎并不少,而滿足第3點的前端模板引擎卻不多見,而后端的Razor、Smarty等都具備這一功能

          話說我當時設計我們自己的模板引擎的第3個版本時,就想出了block這一個概念來實現第3點,在做完交付將近半年之后,有人告訴我說Smarty上就有這概念,頓時有種不知應該高興還是悲傷的不知所措感。還好他并沒有懷疑我直接抄了別人的功能,不然真是冤枉

          前端模板引擎要支持數據輸出時的處理

          所謂數據輸出時處理,指一個數據要在輸出時做額外的轉換,最常見的如字符串的trim操作,比較技術性的如markdown的轉換等

          誠然數據的轉換完全可以在將數據交給模板引擎前就通過JavaScript的邏輯處理完,但這會導致不少有些丑陋又有些冗余的代碼,對邏輯本身的復用性也會造成負面的影響

          通常模板引擎對數據做額外處理會使用filter的形式實現,類似bash中的管道的邏輯。filter的實現和注冊也會有不同的設計,如mustache其實注冊的是fitler工廠,而另一些模板引擎則會直接注冊filter本身,不同設計有不同的考量點,我們很難說誰好誰壞

          但是,模板引擎支持數據的輸出處理后,會另我們在編碼過程中產生一個新的糾結,即哪些數據處理應該交由模板引擎的filter實現,哪些應該在交給模板引擎前由自己的邏輯邏輯實現。這個話題展開來又是一篇長長的論述,于當前的話題無關就略過吧

          前端模板引擎要支持動態數據

          在開發過程中,其實有不少數據并不是靜態的,如EmberJS就提供了Computed Property這樣的概念,Angular也有類似的東西,Backbone則可以通過重寫Model的get方法來變相實現

          雖然ES5在語言層面上直接提供了getter的支持,但我們在前端開發的大部分場景下依舊不會使用這一語言特性,而會選擇將動態的數據封裝為某種對象的get等方法而模板引擎在將數據轉為HTML片段的過程中,同樣應該關注這一點,對這些動態計算的數據有良好的支持

          說得更明白一些,模板引擎不應該僅僅接受純對象(Plain Object)作為輸入,而應該更開放地接受類似帶有get方法的動態的數據

          一個比較合理的邏輯是,如果一個對象有一個get方法(模板引擎決定這個接口),則數據通過該方法獲取,其它情況下視輸入的對象為純對象(Plain Object),使用標準的屬性獲取邏輯

          前端模板引擎要與異步流程嚴密結合

          前端有一個很大的特點,就是到處充斥著異步的流程。由于JavaScript在瀏覽器提供的引擎中單線程執行的特性、大部分與IO相關的API都暴露為異步的事實,以及多數模塊定義規范中模板的動態獲取是異步的這一現象,注定我們無法將這個世界當作完全同步來看

          一個很常見的例子是,我們有一個AMD模塊存放了全局使用的常量,模板引擎需要使用這些常量。當然我們可以在使用模板引擎之前讓JavaScript去異步獲取這一模塊,隨后將常量作為數據傳遞給模板引擎,但這是一種業務與視圖相對耦合的玩法,出于強迫癥我并不覺得這是一個漂亮的設計,所以我們希望直接在模板中這么寫:

          {{$globals.ICP_SERIAL}}

          這是我假想的一個語法,通過$globals可以使用AMD Loader獲取globals這一模塊,隨后獲取其中的ICP_SERIAL屬性輸出

          模板引擎支持異步是一個比較具有挑戰性的話題,我的計劃是在我們自己的模板引擎的下一個版本中嘗試實現。這其中涉及很多的技術點,比如:

          模板的輸出本身成了異步的方法,而不再像現在一樣直接返回字符串

          分析模板對異步操作的依賴,整個字符串的拼接邏輯被打斷成多個異步

          異步是需要等待的,且等待是未知的,從性能上考慮,是否需要考慮Stream式的輸出,以便完成一段提供一段

          是提供內置的固定幾種異步邏輯,還是基于Promise支持任何自定義的異步邏輯,在復雜度和實用性上作出平衡

          至今我還沒有完全明確模板與異步結合的方式和接口,這個話題也沒辦法繼續深入探討了

          前端模板引擎要支持不同的開發模式

          前端發展至今,有很多不同的開發模式,比如:

          最普通的HTML頁面,使用DOMContentLoaded等事件添加邏輯,特定交互下局部刷新頁面

          采用傳統的MVC模型進行單頁式開發

          使用MVVM方式以數據為核心,數據與視圖方向綁定進行開發

          基于Immutable Data進行數據比對Diff轉DOM更新的開發(其中可能有Virtual DOM的引入)

          一個模板引擎要能支持這么多種不同的的模式是一個非常大的挑戰,特別是對雙向綁定的支持尤為突出。至今為止幾乎所有的支持雙向綁定的開發框架都自帶了專用的模板引擎,這是因為雙向綁定對模板有兩大要求:

          能夠從模板中提取“這一模板對哪些數據有依賴”的元信息

          能夠知道一個數據變化引擎的是模板的哪一塊,而不至于整個刷新

          而通用模板引擎很少提供這兩個特性,所以沒辦法對不同的前端開發模式進行全面到位的支持

          從模板引擎本身的實現上來說,一種方法是直接將模板解析后的類似AST的結構暴露出去,供其他框架合理地處理,同時提供對模板局部的刷新功能(也可與前面所說的模板片段一起考慮),但是大部分模板引擎為了性能等考慮,是不會解析出類似AST的語法結構來的

          前端模板引擎要有實例間的隔離

          在大型的前端項目,特別是單頁式的項目中,會有完全未知個數的模板片段同時存在,如果這些片段是帶有名稱(出于復用的考慮)的,就很容易造成名稱上的沖突對于同一層級的邏輯(如大家都是業務層代碼,或者大家都是控件層代碼),名稱沖突是可以通過一些開發時的約定來解決的。但不同層之間,由于封裝性的要求,外部不應該知道一些僅內部使用的片段的名稱,此時如果不幸有名稱與其它層有沖突,會讓情況變得比較麻煩,這類問題甚至都不容易跟蹤,往往會導致大量的精力和時間的浪費

          因此,一個好的模板引擎應該是多實例的,且不同實例間應該相互具備隔離性,不會出現這種不可預期的沖突

          將這個話題再往深地研究,就會發現單純的隔離是不夠的,不同層間除了不沖突的需求,同樣還有片段復用的需求,我們還會需要不同模板實例間可以開放一些固定的片段共享,因此模板引擎各個實例的關系是一種組合依賴但又具備基本的封裝和隔離的狀態

          95、datalist 用法

          <input list="browsers">
          <datalist id="browsers">
            <option value="Internet Explorer">
            <option value="Firefox">
            <option value="Chrome">
            <option value="Opera">
            <option value="Safari">
          </datalist>

          這里注意綁定datalist的id給input的list屬性,這樣在input輸入框下面就會出現列表

          96、ajax同步和異步的區別

          在使用ajax請求數據的時候,通常情況下我們都是把async:true當做默認來處理,讓我們的請求成為一個異步的請求。但是在某種情況下我們是需要吧async:false設置為false的,方便我們進行觀察數據的走向、去處。那同步和異步有什么區別呢?

          同步請求 async:false

          $.ajax({
                  async:false,
                  type:"POST",
                  url:"Venue.aspx?act=init",
                  dataType:"html",
                  success:function(result){  //function1()
                      f1();
                      f2();
                   }
                   failure:function (result) {
                      alert('我在彈');
                  }
                  }
          function2();

          分析這個時候ajax塊發出請求后,他會等待在function1()這個地方,不會去執行function2(),直到function1()部分執行完畢。異步請求 async:true

          $.ajax({
                  async: true, //默認為 true
                  type:"POST",
                  url:"./xxx/xxx/a/b.html",
                  dataType:"html",
                  success:function(result){  //function1()
                       f1();
                       f2();
                  }
                  failure:function (result) {
                        alert('我彈');
                  },
                  }
          function2();

          分析當ajax塊發出請求后,他將停留function1(),等待返回結果,但同時(在這個等待過程中),function2()就可以跑起來。總結(兩者的區別)同步的請求的時候,代碼好比在排隊,必須是一個挨著一個的去執行,前面的沒有結束,后面的代碼就處于一個阻塞的狀態。異步執行的時候,數據請求的同時,其他代碼語句也可以同步執行,比如,在數據請求的時候,由于某些愿意,需要慢慢的返回請求結果,在這個時候帶寬是很空閑的,那么,代碼不會等到前面的數據完全請求返回就可以開始后面的代碼運行。

          97、JavaScript偽數組

          數組

          定義: 數組是一種類列表對象,它的原型中提供了遍歷和修改元素的相關操作。JavaScript 數組的長度和元素類型都是非固定的。只能用整數作為數組元素的索引,而不能用字符串。對象是沒有索引的,是數組的基本特征。

          var obj = {};
          var arr = [];
          
          obj[2] = 'a';
          arr[2] = 'a';
          
          console.log(obj[2]); // => a
          console.log(arr[2]); // => a
          console.log(obj.length); // => undefined
          console.log(arr.length); // => 3

          obj[2]輸出’a’,是因為對象就是普通的鍵值對存取數據而arr[2]輸出’a’ 則不同,數組是通過索引來存取數據,arr[2]之所以輸出’a’,是因為數組arr索引2的位置已經存儲了數據obj.length并不具有數組的特性,并且obj沒有保存屬性length,那么自然就會輸出undefined而對于數組來說,length是數組的一個內置屬性,數組會根據索引長度來更改length的值為什么arr.length輸出3,而不是1在給數組添加元素時,并沒有按照連續的索引添加,所以導致數組的索引不連續,那么就導致索引長度大于元素個數

          偽數組

          定義:

          偽數組是一個對象(Object),而真實的數組是一個數組(Array)擁有length屬性,且必須是number類型,其它屬性(索引)為字符串不具有數組所具有的方法,forEach()等,不過有Object的方法偽數組長度不可變,真數組長度可以變可以通過for in遍歷

          var fakeArray = {
              length: 3,
              "0": "first",
              "1": "second",
              "2": "third"
          }
          var arr = [1, 2, 3, 4]
          
          // 真數組的方法來自Array.prototype
          console.log(fakeArray instanceof Array) //false
          console.log(arr instanceof Array) // true
          
          Array.isArray(fakeArray) // false;
          Array.isArray(arr) // true;
          
          console.log(arr.__proto__ === Array.prototype) // true
          console.log(fakeArray.__proto__ === Array.prototype) // false
          console.log(fakeArray.__proto__ === Object.prototype) // true
          
          arr.forEach(x => console.log(x)) // 1 2 3 4
          fakeArray.forEach(x => console.log(x)) // fakeArray.forEach is not a function
          
          Object.keys(fakeArray) //  ["0", "1", "2", "length"]

          常見的偽數組有:

          函數內部的 argumentsDOM 對象列表(比如通過 document.getElementsByTags 得到的列表)jQuery 對象(比如 $(“div”) )偽數組是一個 Object,而真實的數組是一個 Array。偽數組存在的意義,是可以讓普通的對象也能正常使用數組的很多方法,比如:

          使用Array.prototype.slice.call();
          var arr = Array.prototype.slice.call(arguments);
          
          Array.prototype.forEach.call(arguments, function(v) {
            // 循環arguments對象
          });
          
          // push
          // some
          // every
          // filter
          // map
          // ...
          
          
          使用[].slice.call()
          var fakeArray = {
              length: 3,
              "0": "first",
              "1": "second",
              "2": "third"
          }
          var arr = [].slice.call(fakeArray)
          console.log(arr) // ["first", "second", "third"]
          
          使用ES6中的Array.from方法
          var fakeArray = {
            length: 3,
              "0": "first",
              "1": "second",
              "2": "third"
            }
          var arr = Array.from(fakeArray)
          console.log(arr) // ["first", "second", "third"]
          
          使用擴展運算符,也是ES6的語法
          var fakeArray = document.querySelectorAll('div')
          var newArr= [...fakeArray]
          console.log(newArr.__proto__ === Array.prototype) // true
          
          
          偽數組轉換為真數組原理
          Array.prototype.slice = function (start, end) {
            start = start || 0
            end = start || this.length
            const arr = []
            for (var i = start; i < end; i++) {
              arr.push(this[i])
            }
            return arr
          }

          結論對象沒有數組 Array.prototype 的屬性值,類型是 Object ,而數組類型是 Array數組是基于索引的實現, length 會自動更新,而對象是鍵值對使用對象可以創建偽數組,偽數組可以正常使用數組的大部分方法

          98、同源策略

          何為同源?
          域名、協議、端口完全一致即為同源。
          
          
          www.juejin.com 和juejin.com
          不同源,因為域名不同
          
          
          www.bilibili.tv和http://www.bilibili.com
          不同源,因為域名不同
          
          
          http://localhost:3000 和 http://localhost:3001
          不同源,因為端口不同
          
          
          qq.com 和https://qq.com
          不同源,因為協議不同
          
          
          www.pixiv.net 和 www.pixiv.net/manage/illu…
          同源,因為域名,協議,端口都相同
          
          
          何為策略?
          策略主要限制js的能力
          1.無法讀取非同源的 cookie、Storage、indexDB的內容
          2.無法讀取非同源的DOM
          3.無法發送非同源的AJAX,更加準確的說應該是發送了請求但被瀏覽器攔截了。
          為什么會有同源策略?
          
          為了保護用戶數據安全
          
          1.為了防止惡意網頁可以獲取其他網站的本地數據。
          2.為了防止惡意網站iframe其他網站的時候,獲取數據。
          3.為了防止惡意網站在自已網站有訪問其他網站的權利,以免通過cookie免登,拿到數據。
          跨域問題
          前后端分離,和使用服務商數據時,導致前端頁面地址和后端API不是同源的,例如前端地址為baidu.com,后端API為api.baidu.com。直接訪問API會觸發同源策略,所以需要想辦法跨過去。
          常見的跨域方法的原理
          1.CORS
          ?CORS(跨域資源共享)使用專用的HTTP頭,服務器(api.baidu.com)告訴瀏覽器,特定URL(baidu.com)的ajax請求可以直接使用,不會激活同源策略。
          2.JSONP
          ?這個方案相當于黑魔法,因為js調用(實際上是所有擁有src屬性的 <\script>、<\img>、<\iframe>)是不會經過同源策略,例如baidu.com引用了CDN的jquery。所以我通過調用js腳本的方式,從服務器上獲取JSON數據繞過同源策略。
          3.nginx反向代理
          ?當你訪問baidu.com/api/login的時候,通過在baidu.com的nginx服務器會識別你是api下的資源,會自動代理到api.baidu.com/login,瀏覽器本身是不知道我實際上是訪問的api.baidu.com的數據,和前端資源同源,所以也就不會觸發瀏覽器的同源策略。

          99、獲取第二大的數字

          方法一將數組從大到小排序然后找第二個當然在JS中有sort()方法可以進行數組排序

          var arr=[5,2,10,8,0,4,7,11,9,1];
          function array1(){
              var max,min;
              if(arr[0]<arr[1]){
                    max=arr[1];
                    min=arr[0];
              }
              else
              {
                   max=arr[0];
                   min=arr[1];
              }
              for(i=2;i<arr.length;i++)
              {
                  if(arr[i]>min)
                  {
                      if(arr[i]>max)
                      {
                          min=max;
                          max=arr[i];
                      }
                      else
                          min=arr[i];
                  }
              }
              alert(min);
          }
          array1();

          方法二

          定義兩個變量max min循環遍歷分別存儲當前最大和第二大的數然后輸出第二大的數min;

          var arr=[5,2,10,8,0,4,7,11,9,1];
          function array2(){
              var temp,min;
              for(var i=0;i<arr.length-1;i++){
                  min=i;
                  for(var j=i+1;j<arr.length;j++){
                      if(arr[j]>arr[i]){
                          temp= arr[i];
                          arr[i] = arr[j];
                          arr[j] = temp;
                      }
                  }
              }
              alert(arr[1]);
          }
          array2();

          100、forin和Object.keys的區別

          使用for in 去遍歷 對象會將prototype上面擴展的方法或者屬性也打印出來

          // 遞歸寫法

          為本吹部營業的第一天,先為剛剛步入高三的各位小可愛們準備了九月初的一模考試模擬試題,還望大家多多笑納~

          本吹部的營業范圍包含了專業解讀習題服務吖,有什么課業問題可以多多私信吖。評論區留言的各路問題我們也會匯總并在每周專門的時間做出專欄回復噠。

          關注我@清北之光吹奏部更多高考資訊等你來拿。


          第二部分 閱讀理解(共兩節,滿分40分)

          21.When Ricochet was just a young pup,her owner Judy Fridono hoped the dog might one day become a service dog and help people.But Ricochet had other plans,at least for the first part.She failed at service dog training,but she went on to help millions of people around the world learn how to trust,how to love,and how to surf.

          According to Fridono,the dog seemed naturally suited to life as a service dog.She was great with people,especially kids,and she had plenty of energy.But birds were her weakness.She just couldn't seem to stop running after them.And that's not a good quality for a service dog that needs to focus on the person she's helping.

          Fridono said at the beginning she was disappointed when Ricochet didn't succeed at service dog schoo1.But it wasn't long before the Pup let her true skills shine through.At just 8weeks old,Ricochet climbed on to a board that had been left in a children's pool,showing her special talent for balance.

          Soon,Ricochet was making headlines as the beach﹣loving dog who could hang ten on a surfboard.But she wasn't finished showing off her special talents yet.

          "One day at the beach,she jumped on a surfboard with a 14﹣year﹣old boy who had spinal cord(脊髓)injuries,"Fridono said."It was at that moment that her life purpose to surf with people who are disabled was realized.She is just such an inspiration to everyone﹣﹣she's got such a strong connection to people,and we see such improvements in the people who she surfs with."

          Ricochet now surfs daily with children and adults with special needs.She specializes in helping military veterans(退伍軍人)with some diseases and children with autism(自閉癥)by connecting with them in ways that no one else can.


          21.What do we know about Ricochet?   

          A.She has been helpful for many people.

          B.She was taught how to surf.

          C.She saved thousands of people's lives.

          D.She learnt special skills at service dog schoo1.

          22.What was Ricochet's shortcoming when in training school?   

          A.Impatience.

          B.Great pride.

          C.Lack of concentration.

          D.Not being brave.

          23.What may have amazed Fridono?   

          A.Ricochet's widespread popularity.

          B.Ricochet's rapid progress.

          C.Ricochet's extraordinary talents.

          D.Ricochet's dropping out of schoo1.

          24.What can we infer from the text?   

          A.Ricochet once had a spinal cord injury.

          B.Fridono made Ricochet's dream come true.

          C.Ricochet has a unique connection with people having special needs.

          D.Fridono helped Ricochet develop her skills and talents.

          25.Drive through any suburb in the U.S.Today,and it's hard to miss the bins that have become companions to America's trash cans.Recycling has become commonplace,as people recognize the need to care for the environment.Yet most people's recycling consciousness extends only as far as paper,bottles,and cans.People seldom find themselves facing the growing problem of e﹣waste.

          E﹣waste rapidly increases as the techno﹣fashionable frequently upgrade to the most advanced devices,and the majority of them end up in landfills(垃圾填埋地).Some people who track such waste say that users throw away nearly 2million tons of TVs,VCRs,computers,cell phones,and other electronics every year.Unless we can find a safe replacement,this e﹣waste may get into the ground and poison the water with dangerous toxins(毒素),such as lead,mercury,and arsenic.Burning the waste also dangerously contaminates the air.

          However,e﹣waste often contains reusable silver,gold,and other electrical materials.Recycling these materials reduces environmental problems by reducing both landfill waste and the need to look for such metals,which can destroy ecosystems.

          A growing number of states have adopted laws to ban dumping(傾倒)e﹣waste.Still,less than a quarter of this refuse will reach lawful recycling programs.Some companies advertising safe disposal(處置)in fact merely ship the waste to some developing countries,where it still ends up in landfills.These organizations prevent progress by unsafely disposing of waste in an out﹣of﹣sight,out﹣of﹣mind location.

          However,the small but growing number of cities and corporations that do handle e﹣waste responsibly represents progress toward making the world a cleaner,better place for us all.


          25.What can we infer from the first paragraph?   

          A.Many Americans now have access to recycling bins.

          B.E﹣waste cannot be put into trash cans in the U.S.

          C.Most Americans have realized the dangers of e﹣waste.

          D.Most of America's trash cans are made of recycled material.

          26.What can best replace the underlined word"contaminates"in Paragraph 2?   

          A.Pollutes.

          B.Heats.

          C.Absorbs.

          D.Reduces.

          27.How does the author feel about burying e﹣waste in landfills?   

          A.It's important.

          B.It's unsafe.

          C.It's acceptable.

          D.It's uncommon.

          28.What's the author's purpose in writing this text?   

          A.To tell us how to recycle e﹣waste.

          B.To talk about the future of e﹣waste.

          C.To discuss if it's necessary to recycle e﹣waste.

          D.To encourage us to deal with e﹣waste properly.

          29.For most of us Veterans Day just means a chance to enjoy an extra day off from school or work.However this November 11th,be sure to spend a few minutes on its true purpose,by acknowledging(感謝)the men and women who have served in our armed forces.

          And you don't have to stop at just this one day.Join the over 10,000youth members of the Young Marines group that honor these brave men and women all year long with special events and completely spoil them for an entire week,from November 4th to 11th,by visiting hospitalized veterans,performing chores for disabled veterans and even organizing community﹣wide social event.The program open to kids ranging from the age of eight all the way to high school,is a great way to not only show your appreciation,but also get a chance to do some fun activities with like﹣minded kids and make a real difference in a veteran's life.

          People often believe that Memorial Day and Veterans Day are celebrated for the same reason.There is however a subtle but important difference between the two.While both honor our military personnel,the former is a day to remember and pay respect to all the men and women that died serving our country in a war,while Veterans Day is to celebrate the soldiers who are still alive and served in the forces at any time,during peace or war.

          Though several other countries celebrate this day in honor of their own veterans,the meaning is slightly different for each one.Some like the United Kingdom,celebrate it in honorof all soldiers﹣living or dead,while others like Canada celebrate it to honor all living veterans.They also call it different names.France and New Zealand silll call it Armistice Day.In the United Kingdom,Australia and Canada it is referred to as Remembrance Day,while Malta and South Africa celebrate it as Poppy Day.

          No matter what it is called,the reason for observing the day is the same﹣to show our appreciation to the brave men and women who sacrifice(犧牲)everything to make this world a safer place for the rest of us.


          29.What's the main purpose of Veterans Day?   

          A.To celebrate America's success in world wars.

          B.To let people have one more day off.

          C.To organize fun activities for school children.

          D.To show respect for soldiers'contributions.

          30.What can kids do at the Young Marines group program?   

          A.Organize parties for disabled veterans.

          B.Help take care of sick veterans.

          C.Share stories With veterans and other kids.

          D.Entertain veterans by singing and dancing.

          31.What can we learn about Memorial Day?   

          A.It is another name for Veterans Day.

          B.It is in remembrance of war dead.

          C.It is observed on November 11th every year.

          D.It honors soldiers who are serving in the military.

          32.What is Paragraph 4mainly about?   

          A.The origin of Veterans Day.

          B.The history of Veterans Day.

          C.Veterans Day observance.

          D.Veterans Day around the world.

          33.In his book The Tipping Point Canadian author Malcolm Gladwell explains how a trend can take many forms.It can be a general change in social behaviour,an idea or a fashion.However,why do some trends catch on and others not?What makes one particular brand of training shoe suddenly become the must﹣have product?How do people find out about trends and what makes people want to buy into them?Is it simply a question of keeping up with other people?

          In his new work,Gladwell explores the moment when something becomes common and how products,ideas,messages and forms of behaviour spread.He looks at the reasons why trends are similar in the way they develop to outbreaks of disease,or medical epidemics(流行病).

          Epidemics,like trends,start in a very small way,maybe from a single person with a virus,then spread very quickly until they take over the population and appear to be everywhere.Eventually,they will slow down gradually or die out suddenly.Gladwell shows how these changes happen not gradually but at one sudden moment.

          Gladwell identifies three types of people who are influential in the development of these kinds of social epidemics:

          Connectors are people in a community who have wide social circles.They know a lot ofpeople and like to introduce people to each other.The people they know often come from a variety of social,cultural,professional and economic circles.

          Mavens are people with a lot of knowledge or experts in a particular field.They wish to pass on their knowledge to others.Mavens collect and gather information so are the first to pick up on new trends.

          Salesmen are people with charisma(魅力).They have a"soft"influence over people rather than actual power.This means they are influential because people want to imitate them.

          Overall,Gladwell's book is a thought﹣provoking(引人深思的)read for anyone interested in the origins of trends.What's more,he writes in a clear style so even the most difficult ideas are easy to understand.


          33.What do we know about Gladwell?   

          A.He is a productive North American writer.

          B.He has written many books on the subject of trends.

          C.He thinks trends develop in the same way as illnesses.

          D.He believes there are three types of people in the world.

          34.According to the text,connectors   .

          A.are very social persons

          B.Often follow others

          C.know many people from the same circle

          D.are knowledgeable and experienced

          35.What do we learn from the text?   

          A.Salesmen try to control other people using their power.

          B.Mavens quickly become aware of changes in fashions.

          C.Connectors and Mavens try to get their information across.

          D.Gladwell's book is interesting but hard to understand for readers.

          36.根據短文內容,從短文后的選項中選出能填入空白處的最佳選項.選項中有兩項為多余選項.

          Things that Kill Smartphone Battery and How to Fix Them

          You have bad service.

          Dead zones mean poor reception for a cellphone which can run out of your battery by the second.Here's why:Your smartypants phone is working overtime to reconnect you.If it fails,the cell phone will try to send the message again with increased power.(36)   

          (37)   

          If you have an iPhone 7,scroll up from the bottom on your lock screen and it'11show your most recent notifications.We bet you'11see everything from your mom's comment on your Facebook picture to an update from CNN on the latest breaking news.Most apps﹣unless

          specifically turned off﹣will send you push notifications that often aren't necessary.Try going to

          Settings>Notifications and adjusting those apps.

          Your Bluetooth is always on.

          Quick:Go to Settings on your smartphone and do a quick search for"Bluetooth."Most devices are designed to have this automatically turned on,even if you don't need it frequently

          (38)   "Don't need it?Shut it off,"he suggests.

          You use too many apps with GEO﹣locators.

          Your smartphone GPS is convenient.(39)    Turning it off will cause those apps to only locate you when you're using them.

          It's too hot or too cold where you are.

          Cold affects your phone's battery so much that some people even use hand warmers to

          wrap around their devices in winter.But before you look into moving to a warmer climate to

          keep your phone happy,also watch out for warmer conditions.If you're overheating or have

          your phone in your feather jacket,the added warmth could kill the battery,too.Just keep thin in

          mind:(40)   


          A.Recommended option is to switch your phone to airplane mode and try to connect to free WiFi if possible.

          B.However,all expert says having that level turned on puts pressure on your battery.

          C.But countless apps may enable"location finding"without asking you.

          D.You have too many applications that send you alerts.

          E.You'd better take good care of your smartphone.

          F.Conditions need to be just right.

          G.You have installed too many apps.

           

          第三部分 英語知識運用(共兩節,滿分45分)

          41.第一節 完形填空

          Harjit was waiting for his suitcase to arrive at the airport.Suddenly,he felt that a boy who was the same age was(41)    his turban(穆斯林頭巾),which upset him.In a hurry,Harjit snatched a (42)    that looked similar to his own (43)    he wasn't entirely sure it was his.He wanted to get away from the spying eyes right away.

          When they arrived at their new (44)   ,his father told him to go to bed very soon (45)   it was already late and he must enroll at school the next day.Early the next morning,when he opened the suitcase,he was(46)    to see that it was not his own!"Don't (47)   ,son.I shall ring the airport and we shall soon have your (48)   ."Father assured him.After breakfast.Father drove him to schoo1.While they were waiting in a reception room,Harjit noticed a boy sobbing alone."That is the boy who stared at me yesterday!''said Harjit,barely able to contain his (49)   .Father suggested that he go and say hello,"Some people are just (50)   .They do not mean any harm."

          Harjit walked up and (51)   ,"Hello,my name is Harjit.I just arrived from India yesterday.Do you speak any English?"The boy,looking a little (52)    that he had been caught crying,hesitated for just a moment and then said:"I do speak a little English.I am Pierre.""Why are you sad,Pierre?"Harjit asked.

          It was then that Pierre explained how he had (53)   just arrived from India after his family holidays."I am supposed to give a presentation to my class tomorrow about (54)   I saw and collected along the way,but I lost my bag at the airport and now I don't know what to do.""I don't believe it!"(55)   Harjit,"I think that I have your bag at home.I took it at the airport (56)   ."

          Using their(57)    English as best they could,the two boys managed to have quite (58)   ,and after a while they both (59)    considerably.That day Pierre was (60)   to have found his missing bag and Harjit was happy to be introduced to lots of new friends.

          61.閱讀下面材料,在空白處填入適當的內容(1個單詞)或括號內單詞的正確形式.

          Some foreign friends share their tips on how to spend the Chinese New Year in China:

          ※"Don't travel during the holidays"is one golden role(61)    (follow)by some friends for years,especially during Spring Festival as the traffic is heavy.And in China,I always spend Spring Festival Eve with Chinese(62)    (family),eating dumplings,laughing,joking.I love

          the Chinese and there are no other people I would rather spend my time(63)   .

          ※I(64)    (real)love to watch people set off fireworks for the feeling of(65)    (excite)and joy!I've never seen so many fireworks in my life!But I do wish people would be more careful,especially with(66)    (them)children.Sometimes I see kids who are too young(67)    play fireworks.

          ※I(68)    (impress)with the Spring Festival gala on CCTV though I don't understand Chinese well.It is one of the most(69)    (maze)TV shows from an artistic point of view.What's more,I like to go to temple fairs.I enjoyed some snack food,(70)    was nice for me first couple minutes until my hands started freezing and I could no longer use my chopsticks properly﹣my fingers were getting numb.

           

          第四部分 寫作(共兩節,滿分35分)

          71.第一節 短文改錯

          假定英語課上老師要求同桌之間交換修改作文,請你修改你同桌寫的以下作文.文中共有10處語言錯誤,每句中最多有兩處.每處錯誤僅涉及一個單詞的增加、刪除或修改.

          增加:在缺詞處加一個漏字符號(∧),并在其下面寫出該加的詞.

          刪除:把多余的詞用斜線(\)劃掉.

          修改:在錯的詞下劃一橫線,并在該詞下面寫出修改后的詞.

          注意:1.每處錯誤及其修改均僅限一詞;2.只允許修改10處,多者(從第11處起)不計分.

          Dear Jack,

          Thanks for your letter.I'm glad you've been offered two summer jobs at same time﹣working in a restaurant and working in a museum.If I were him,I would take the one in the museum.

          First,you can gain more knowledge about history,that will enrich your life great.Second,you can make more friend from different parts of the country by serve them when working there.Finally,compared to the job in the restaurant,working in the museum can be most challenging.If you find a position at there,I'm sure you'11see a rapid improve in both your

          character or abilities.You will also have a great time.

          Good luck!

          Yours,

          Li Hua

          81.第二節 書面表達

          假設你是李華,你的美國朋友Michael正在一家孔子學院學習漢語和中國文化,知道中國人很重視家風傳承.他在給你的電子郵件中想了解你家的家風以及家風對你的影響.請你給他回復一封電子郵件.開頭已經給出,不計入總詞數.

          注意:

          1.詞數100左右;

          2.可以適當增加細節,以使行文連貫.

          3.參考詞匯:家風family spirits

          Dear Michael,

          I'm glad to know that you are learning Chinese language and culture.   .


          小結:

          本日高三狗們的日常刷題就到此了吖,本試卷的答案和解析將在下一天的午后太陽最溫暖的時刻與您相見吖。

          最后還要多多拜托小可愛們的點贊和分享吖,這對我們本部的動力是很重要啦!


          主站蜘蛛池模板: 国产一区二区影院| 日韩精品一区二区三区四区| 无码人妻一区二区三区精品视频| 国产精品无码AV一区二区三区 | 久久国产精品无码一区二区三区| 乱子伦一区二区三区| 中文字幕精品无码一区二区三区 | 精品91一区二区三区| 国产精品揄拍一区二区| 日韩精品一区二区午夜成人版| 69久久精品无码一区二区| 奇米精品一区二区三区在线观看| 麻豆一区二区三区蜜桃免费| 国产乱码精品一区二区三区香蕉| 麻豆AV一区二区三区| 精品国产鲁一鲁一区二区| 亚洲一区二区三区在线网站| 麻豆亚洲av熟女国产一区二| 久久无码人妻一区二区三区午夜 | 国产一区二区三区在线| 性色AV一区二区三区天美传媒| 精品国产aⅴ无码一区二区| 亚洲一区二区三区夜色| 免费无码毛片一区二区APP| 人妻无码一区二区不卡无码av| 日本视频一区在线观看免费| 精品无码人妻一区二区三区| 精品一区二区三区免费毛片爱| 无码人妻精品一区二区三区99性| 亚洲国产成人精品无码一区二区| 久久精品一区二区三区AV| 亚洲欧美一区二区三区日产| 日韩一区二区三区在线| 无码精品前田一区二区| 又硬又粗又大一区二区三区视频| 日韩精品成人一区二区三区| 中文字幕一区日韩精品| 国产高清视频一区二区| 韩国福利一区二区三区高清视频| 亚洲A∨无码一区二区三区| 国产精品高清一区二区三区不卡|