If you have pointer to the first node
Insertion at beginning: O(n)
Insertion at the end: O(n) // As you have to traverse till the end.
If you have pointer to the last node
Insertion at beginning: O(1)
Insertion at end: O(1)
In GATE question they will most likely clearly mention to which nodes we have the pointer to.
Check this: https://gateoverflow.in/1033/gate2004-36