StreakPeaked· Practice

ExamsGATETechnical › Computer Science and Information Technology Set 2 (C S2)

GATE Technical: Computer Science and Information Technology Set 2 (C S2) questions with solutions

3 questions with worked solutions.

Questions

Q1. Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?

  1. 2PL permits only serializable schedules
  2. With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation
  3. With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction
  4. A deadlock is possible with 2PL

Answer: A deadlock is possible with 2PL

Deadlocks can occur in the Two Phase Locking protocol because transactions may hold locks while waiting for other locks to be released, leading to a situation where two or more transactions are waiting indefinitely for each other.

Q2. Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?

  1. Source IP Address
  2. Protocol
  3. Time to Live (TTL)
  4. Header Checksum

Answer: Header Checksum

The Header Checksum is recalculated by routers each time an IP packet is forwarded to ensure data integrity, as the packet may have been altered during transit. This modification is necessary to reflect any changes in the packet's contents or routing information.

Q3. Consider the following C function definition. int fX(char *a){ char *b = a; while (*b) b++; return b - a;} Which of the following statements is/are TRUE?

  1. The function call fX("abcd") will always return a value
  2. Assuming a character array c is declared as char c[] = "abcd" in main(), the function call fX(c) will always return a value
  3. The code of the function will not compile
  4. Assuming a character pointer c is declared as char *c = "abcd" in main(), the function call fX(c) will always return a value

Answer: The function call fX("abcd") will always return a value

The function fX counts the number of characters in the string pointed to by 'a' by iterating through it until it reaches the null terminator. Since the input '"abcd"' is a valid string, the function will successfully return the length of the string, which is always a value.

⚔️ Practice GATE Technical free + battle 1v1 →