C++基础知识练习题: while循环 建议答题时长:60min
1. 单选题

下列选项中,作用是“立即退出本层循环”的是(    )

A

while

B

break

C

continue

D

for

2. 单选题

下列选项中,作用是“跳过本次循环”的是(    )

A

while

B

break

C

continue

D

for

3. 单选题

下方while循环程序,共循环(    )次。

#include <iostream>

using namespace std;

 

int main (){

   int a = 10;

   

   while( a > 20 )

   {

       cout << "a 的值:" << a << endl;

       a++;

   }

 

   return 0;

}

A

无限次

B

10次

C

20次

D

不满足条件,跳过循环

4. 单选题

下方while循环程序,共循环()次。

#include <iostream>

using namespace std;

 

int main (){

   int a = 10;

   

   while( a < 20 )

   {

       cout << "a 的值:" << a << endl;

       a++;

       if (i == 15){

        continue;

      }

   }

   return 0;

}

A

无限次

B

10次

C

9次

D

5次

5. 单选题

下方while循环程序,共循环(    )次。

#include <iostream>

using namespace std;

 

int main (){

   int a = 10;

   

   while( a < 20 )

   {

       cout << "a 的值:" << a << endl;

       a++;

   }

 

   return 0;

}

A

无限次

B

10次

C

20次

D

不满足条件,跳过循环

6. 单选题

下方while循环程序,共循环(    )次。

#include <iostream>

using namespace std;

int main ( ){

   int a = 10;

   

   while( a < 20 )

   {

       cout << "a 的值:" << a << endl;

       a++;

       if (i == 15){

            break;

      }

   }

   return 0;

}

A

无限次

B

10次

C

5次

D

9次

7. 单选题

下方while循环程序,共循环(    )次。

#include <iostream>

using namespace std;

 

int main (){

   int a = 10;

   

   while( a != 20 )

   {

       cout << "a 的值:" << a << endl;

       a++;

   }

 

   return 0;

}


A

无限次

B

10次

C

20次

D

不满足条件,跳过循环

8. 编程题

要求:

设计一个程序,使用while循环输出1到100这些数字。

查看答案
试题目录
单选题
1 2 3 4 5 6 7
编程题
8
赣ICP备20007335号-2