博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c#异常处理_C#异常处理能力问题和解答 套装4
阅读量:2526 次
发布时间:2019-05-11

本文共 2538 字,大约阅读时间需要 8 分钟。

c#异常处理

1) Which is not a valid keyword used in the context of exception handling?
Answer & Explanation

Correct answer: 3

final

The final keyword is not used to handle exceptions in C#.NET.

1)在异常处理的上下文中使用哪个无效关键字?
答案与解释

正确答案:3

最后

final关键字不用于处理C#.NET中的异常。

2) Which is a valid keyword used in the context of exception handling?
Answer & Explanation

Correct answer: 2

throw

The throw is a valid keyword used in exception handling.

2)在异常处理的上下文中使用哪个有效关键字?
答案与解释

正确答案:2

throw是异常处理中使用的有效关键字。

3) There are following statements are given below, which is correct about throw in C#.NET?
Answer & Explanation

Correct answer: 2

The throw keyword is used to throw an exception object programmatically

The 2nd statement is correct about throw keyword.

3)下面给出以下语句,关于C#.NET中的抛出正确吗?
答案与解释

正确答案:2

throw关键字用于以编程方式引发异常对象

关于throw关键字的第二条语句是正确的。

4) What is the correct output of the given code snippet?
using System;namespace my_namespace{
class program {
static void Main(string[] args) {
int a = 0; int b = 10; int c = 0; try {
c = b / a; } catch (DivideByZeroException d) {
Console.WriteLine("Divide by zero exception occurred"); } } }}
Answer & Explanation

Correct answer: 1

Divide by zero exception occurred

The above code will print "Divide by zero exception occurred" on the console screen.

4)给定代码段的正确输出是什么?
答案与解释

正确答案:1

除零发生异常

上面的代码将在控制台屏幕上显示“发生零除零异常”。

5) In the given code snippet finally block will execute or not?
using System;namespace my_namespace{
class program {
static void Main(string[] args) {
int a = 0; int b = 10; int c = 0; try {
c = b / a; } finally {
Console.WriteLine("Finally executed"); } } }}
Answer & Explanation

Correct answer: 1

Yes, finally will execute

Yes, finally block will execute.

The output would be,

5)在给定的代码片段中,finally块是否会执行?
using System ;namespace my_namespace{    class program    {        static void Main ( string [ ] args )        {            int a = 0 ;            int b = 10 ;            int c = 0 ;            try            {                c = b / a ;            }            finally            {                Console . WriteLine ( " Finally executed " ) ;            }        }    }}
答案与解释

正确答案:1

是的,最后会执行

是的,finally块将执行。

输出将是

翻译自:

c#异常处理

转载地址:http://hctzd.baihongyu.com/

你可能感兴趣的文章
iphone移动端踩坑
查看>>
vs无法加载项目
查看>>
Beanutils基本用法
查看>>
玉伯的一道课后题题解(关于 IEEE 754 双精度浮点型精度损失)
查看>>
《BI那点儿事》数据流转换——百分比抽样、行抽样
查看>>
哈希(1) hash的基本知识回顾
查看>>
Leetcode 6——ZigZag Conversion
查看>>
dockerfile_nginx+PHP+mongo数据库_完美搭建
查看>>
Http协议的学习
查看>>
【转】轻松记住大端小端的含义(附对大端和小端的解释)
查看>>
设计模式那点事读书笔记(3)----建造者模式
查看>>
ActiveMQ学习笔记(1)----初识ActiveMQ
查看>>
Java与算法之(2) - 快速排序
查看>>
Windows之IOCP
查看>>
机器学习降维之主成分分析
查看>>
CTP2交易所成交回报
查看>>
WebSocket & websockets
查看>>
openssl 升级
查看>>
ASP.NET MVC:通过 FileResult 向 浏览器 发送文件
查看>>
CVE-2010-2883Adobe Reader和Acrobat CoolType.dll栈缓冲区溢出漏洞分析
查看>>