GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
396 views

asked in DS by Boss (9.1k points) 4 64 208 | 396 views
option B is true but the question asking which is false so ans is C,but what is option A ,if list is empty , function crashes ...??
yes, because when head is NULL, head->next throws invalid memory access error.
@Arjun Sir, when we try to access an invalid memory do we get an error or it works considering that memory and gives garbage value.

For example : PRINT(*(4615)) Does it print bit pattern stored at location 4615 or error?

Another example : int *a = 62; Does it point to memory 62( which is garbage value) or error.?

1 Answer

+2 votes
Best answer

The only option false in the above question is (C)

 

Reasons To back my Answer:

1. It is always required to chek the underflow and overflow conditions. It will throw an error : Invalid memory access error.

2. It is obvious from the the diagram below.

​​​​​​​

3. If we move the head then the previous data will be lost , so it is always advisable to use another pointer "p" to navgate in a link list.

answered by Active (2.5k points) 2 17 46
selected by


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23324 Points

  2. Bikram

    17048 Points

  3. Habibkhan

    7808 Points

  4. srestha

    6222 Points

  5. Debashish Deka

    5430 Points

  6. jothee

    4958 Points

  7. Sachin Mittal 1

    4772 Points

  8. joshi_nitish

    4286 Points

  9. sushmita

    3964 Points

  10. Rishi yadav

    3794 Points


Recent Badges

Popular Question iarnav
Notable Question makhdoom ghaya
Popular Question LavTheRawkstar
Avid Voter atul_21
Popular Question hem chandra joshi
100 Club nikhil_cs
Notable Question Sukannya
Notable Question Sourabh Kumar
Notable Question shikharV
Nice Comment Sachin Mittal 1
27,287 questions
35,134 answers
83,911 comments
33,223 users