Хелпикс

Главная

Контакты

Случайная статья





try { . I = I + 4 ; . dwTemp=14



 

1. При выполнении программы произошло исключение. Какое значение получит переменная I после выполнения данного фрагмента программы (примеры 1 и 2) при условии, что I изменяется только в указанных операторах, и для данного исключения:

1) EXCEPTION_EXECUTE_HANDLE (говорит системе, что для этого блока __try есть обработчик исключения и он готов обработать это исключение);

2) EXCEPTION_CONTINUE_SEARCH (говорит системе, чтобы она искала предыдущий по вложенности блок __except);

3) EXCEPTION_CONTINUE_EXECUTION (говорит системе, чтобы она снова продолжала выполнение с того места кода, который вызвал ИС)

 

 

1. Значение выражения Filter1 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter2 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter3 = EXCEPTION_EXECUTE_HANDLER

 

2. Значение выражения Filter1 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter2 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter3 = EXCEPTION_CONTINUE_EXECUTION

 

3. Значение выражения Filter1 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter2 = EXCEPTION_CONTINUE_EXECUTION

Значение выражения Filter3 = EXCEPTION_EXECUTE_HANDLER

 

4. Значение выражения Filter1 = EXCEPTION_CONTINUE_SEARCH

Значение выражения Filter2 = EXCEPTION_EXECUTE_HANDLER

Значение выражения Filter3 = EXCEPTION_CONTINUE_EXECUTION

 

 (Символом Ö отмечено место в программе, где произошло исключение)

 

Пример 1.

__try { ........ I = 0 ; ............

       __try { ........ I = I + 1 ; ............

                __try { ........ I = I + 2 ; ............

                          __try { ........ I = I + 3 ; ............

                                   __try { .... Ö .... I = I + 4 ; ............ }

                                   __except ( Filter1 ){ .... I = 0; ..... }

                          __finally { ..... I = I - 3 ; ..... }

                __except (Filter2 ) { .... I = 100; .... }

       __finally { ..... I = I - 1 ; ..... }

__except (Filter3 ) { .... I = 200; .... }

.......    I = ?

 

Пример 2.

__try { ........ I = 0 ; ............

       __try { ........ I = I + 1 ; ............

                __try { ........ I = I + 2 ; ............

                          __try { ........ I = I + 3 ; ..... Ö .....

                                   __try { .... I = I + 4 ; ......

                                                   __try {…}

                                                   __finally { … I= 1000; }

                                        }

                                   __except ( Filter1 ){ .... I = 0; ..... }

                          __finally { ..... I = I – 3 ; ..... }

                __except (Filter2 ) { .... I = 100; .... }

       __finally { ..... I = I – 1 ; ..... }

__except (Filter3 ) { .... I = 200; .... }

.......    I = ?

 

 

1.1

__try { ........ I = 0 ; (1)............

       __try { ........ I = I + 1 ; (2)............

                __try { ........ I = I + 2 ; (3)............

                          __try { ........ I = I + 3 ;(4) ...........

                                   __try { .... Ö (5) .... I = I + 4 ; ............ }

                                      __except (EXCEPTION_CONTINUE_SEARCH(6)){ .... I = 0; ..... }

                          __finally { ..... I = I - 3 ; ..... }

                __except (EXCEPTION_CONTINUE_SEARCH(7)) { .... I = 100; .... }

       __finally { ..... I = I - 1 ; ..... }

__except (EXCEPTION_EXECUTE_HANDLER(8)) { .... I = 200;(9) .... }

.......    I = 200

1.2

__try { ........ I = 0 ; (1)............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ............

                                   __try { .... Ö(5) (9) .... I = I + 4 ; (10)............ }

                                   __except (EXCEPTION_CONTINUE_SEARCH(6)){ .... I = 0; ..... }

                          __finally { ..... I = I - 3(11) ; ..... }

                __except (EXCEPTION_CONTINUE_SEARCH(7)) { .... I = 100; .... }

       __finally { ..... I = I - 1 ;(12) ..... }

__except (EXCEPTION_CONTINUE_EXECUTION(8)) { .... I = 200; .... }

.......    I = 6

1.3

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ............

                                   __try { .... Ö(5) .... I = I + 4 ;(8) ............ }

                                   __except (EXCEPTION_CONTINUE_SEARCH(6)){ .... I = 0; ..... }

                          __finally { ..... I = I - 3 ;(9) ..... }

                __except (EXCEPTION_CONTINUE_EXECUTION(7)) { .... I = 100; .... }

       __finally { ..... I = I - 1;(10) ..... }

__except (EXCEPTION_EXECUTE_HANDLER) { .... I = 200; .... }

.......    I = 6

1.4

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ............

                                   __try { .... Ö (5).... I = I + 4 ; ............ }

                                      __except (EXCEPTION_CONTINUE_SEARCH(6)){ .... I = 0; ..... }

                          __finally { ..... I = I - 3 ;  ..... }

                __except (EXCEPTION_EXECUTE_HANDLER(7)) { .... I = 100;(8) .... }

       __finally { ..... I = I - 1 ;(9) ..... }

__except (EXCEPTION_CONTINUE_EXECUTION) { .... I = 200; .... }

.......    I = 99


 

2.1

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ..... Ö (5)  .....

                                   __try { .... I = I + 4 ; ......

                                                   __try {…}

                                                   __finally { … I= 1000; }

                                        }

                                   __except (EXCEPTION_CONTINUE_SEARCH){ .... I = 0; ..... }

                          __finally { ..... I = I – 3 ; ..... }

                __except (EXCEPTION_CONTINUE_SEARCH(6)) { .... I = 100; .... }

       __finally { ..... I = I – 1 ; ..... }

__except (EXCEPTION_EXECUTE_HANDLER(7)) { .... I = 200;(8) .... }

.......    I = 200

2.2

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ..... Ö (5) (8) .....

                                   __try { .... I = I + 4 ; (9)......

                                                   __try {…}

                                                   __finally { … I= 1000;(10) }

                                        }

                                      __except (EXCEPTION_CONTINUE_SEARCH){ .... I = 0; ..... }

                          __finally { ..... I = I – 3 ;(11) ..... }

                   __except (EXCEPTION_CONTINUE_SEARCH(6)) { .... I = 100; .... }

       __finally { ..... I = I – 1 ;(12) ..... }

__except (EXCEPTION_CONTINUE_EXECUTION(7)) { .... I = 200; .... }

.......    I = 996

 

2.3

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ..... Ö (5) (7) .....

                                   __try { .... I = I + 4 ;(8) ......

                                                   __try {…}

                                                   __finally { … I= 1000;(9) }

                                        }

                                      __except (EXCEPTION_CONTINUE_SEARCH){ .... I = 0; ..... }

                          __finally { ..... I = I – 3 ;(10) ..... }

                __except (EXCEPTION_CONTINUE_EXECUTION(6)) { .... I = 100; .... }

       __finally { ..... I = I – 1 ;(11) ..... }

__except (EXCEPTION_EXECUTE_HANDLER) { .... I = 200; .... }

.......    I = 996

 

2.4

__try { ........ I = 0 ;(1) ............

       __try { ........ I = I + 1 ;(2) ............

                __try { ........ I = I + 2 ;(3) ............

                          __try { ........ I = I + 3 ;(4) ..... Ö (5)  .....

                                   __try { .... I = I + 4 ; ......

                                                   __try {…}

                                                   __finally { … I= 1000; }

                                        }

                                      __except (EXCEPTION_CONTINUE_SEARCH){ .... I = 0; ..... }

                          __finally { ..... I = I – 3 ; ..... }

                __except (EXCEPTION_EXECUTE_HANDLER(6)) { .... I = 100;(7) .... }

       __finally { ..... I = I – 1 ;(8) ..... }

__except (EXCEPTION_CONTINUE_EXECUTION) { .... I = 200; .... }

.......    I = 99


2. Что явится результатом выполнения этой функции:

A.DWORD FuncCounter(void)

{ DWORD dwTemp = 0;(1)

while (dwTemp < 10)

{

__try

{ if (dwTemp == 2)

  continue;(4)

if (dwTemp == 3)

  break;(6)

}

__finally

{ dwTemp ++; (2) (5) (7)}

dwTemp ++;(3)

}

dwTemp +=10;(8)

return (dwTemp);(9) {14}

}

dwTemp=14



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.