PrepAway - Latest Free Exam Questions & Answers

Which of the following vulnerabilities would occur if t…

Refer to the following code:

Which of the following vulnerabilities would occur if this is executed?

PrepAway - Latest Free Exam Questions & Answers

A.
Page exception

B.
Pointer deference

C.
NullPointerException

D.
Missing null check

6 Comments on “Which of the following vulnerabilities would occur if t…

  1. Alexander says:

    There is nothing even close in Darril’s book! That madness to ask such questions on entry level exam! I see that this is not very hard question if you have a little programming experience, but fact that such skill was not mention where-ever as expected skill for candidates. If you haven’t C programming experience it is impossible to understand C or D is the correct answer.




    2



    0
  2. JayWalkerIT says:

    Crazy question.
    As a programmer I recognize this as likely being C++
    That means it’s not C (NullPointerException) because that exact phrasing is from Java.
    So it has to be D. However, this isn’t really a missing null check… this is someone doing nothing except setting something to null then trying to use it. It’s not a vulnerability as much as a deliberate two lines of code designed to crash.




    1



    0
  3. javadev says:

    This is 100% java code – I had to create an account to correct everyone saying D. I ran this code and received:

    Exception in thread “main” java.lang.NullPointerException
    at rainbow.main(rainbow.java:4)

    Process finished with exit code 1

    So the answer is C, although technically the code is invalid unless “object” is capitalized (which I fixed since none of the answer choices would be right).

    So, while a null check could have prevented the error from occurring, the error you will get when you execute the code is “NullPointerException”

    I have spoken




    1



    0

Leave a Reply