First time here? Checkout the FAQ!
+1 vote
Which of the following is a checked dynamic semantic error in C?
A. Use of uninitialized variable
B. Access off the end of an array
C. wrong number of parameters passed to a function
D, Divide by zero

In my opinion B is correct answer, But D is given in solution
asked in Compiler Design by Veteran (14.6k points)   | 144 views

3 Answers

+1 vote
Best answer

there are 2 types of exceptions
1)checked- the classes which extends "Exception" class are called checked exceptions
2)unchecked- the classes which extends "runtimeexception" class are called unchecked exceptions
optionB arrayIndexOutOfBounds class extends RunTimeException class hence its unchecked 
optionD dividedByZero class extends "Exception" class hence its checked.
so option is D


answered by Veteran (11.5k points)  
selected by
@vijay How can we answer on basis of JAVA a C question?? C have no classes concept. Here option b and d both should be correct in context to C language.
as they specifically mentioned abt "checked" i answered that way
+1 vote

Checked: are the exceptions that are checked at compile time.

Unchecked are the exceptions that are not checked at compiled time. Means at run time

Access off the end of an array- happen at runtime

Divide by zero -happen at copile time


answered by (361 points)  
0 votes
acess to an array out of bound willl give me an garbage value so i think its not an semantic error random acess to array is possible so option b is wrong option d is semantic error becouse divide by zero does not sound meaning full expression so it is semantic error
answered by Active (1.1k points)  

Top Users May 2017
  1. akash.dinkar12

    3338 Points

  2. pawan kumarln

    2108 Points

  3. Bikram

    1922 Points

  4. sh!va

    1682 Points

  5. Arjun

    1614 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1208 Points

  8. Angkit

    1056 Points

  9. LeenSharma

    1018 Points

  10. Arnab Bhadra

    812 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    1008 Points

  2. pawan kumarln

    734 Points

  3. Arnab Bhadra

    726 Points

  4. Arjun

    342 Points

  5. bharti

    328 Points

22,893 questions
29,196 answers
27,695 users