Machine-translated by Google. Questions are authored in English.
Top

Discussion

An attribute A of datatype varchar(20) has the value “Avi” . The attribute B of datatype char(20) has value ”Reed” .Here attribute A has ____ spaces and attribute B has ____ spaces .

  • A.3, 20
  • B. 20, 4
  • C.20 , 20
  • D.3, 4

Answer: A

Correct answer: 3, 20

The attributes are asked for as stored, not as supplied. A is varchar(20) holding "Avi", and a varying-length type stores only the characters given, so it occupies 3.

B is char(20) holding "Reed". A fixed-length type pads to its full width with trailing spaces, so it occupies 20 whatever the value's length. That padding has a consequence beyond storage: comparisons and concatenations may carry the trailing spaces, which is why char is reserved for values that really are of fixed width.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.