All quizzesEasy
Keys, TTL & Data Types — Series 2
Preview — 3 of 10 questions
What does TYPE mykey return for a key created with LPUSH mykey 'a'?
javascript
LPUSH mylist "a"
TYPE mylist
"list"A"list"
B"string"
C(integer) 1
DTYPE only works on String keys; it errors for List keys
What does RENAME oldkey newkey do if newkey already exists?
javascript
SET a "hello"
SET b "world"
RENAME a b
GET b
"hello" -- b's original value ("world") is gone, silently overwritten
GET a
(nil) -- a no longer existsAIt fails with an error to avoid overwriting existing data
BIt renames oldkey to newkey, silently overwriting whatever value newkey previously held
CIt merges the values of both keys together
DIt creates a third key combining both names
What does APPEND mykey 'World' do if mykey currently holds 'Hello'?
javascript
SET greeting "Hello"
APPEND greeting "World"
(integer) 10 -- length of "HelloWorld"
GET greeting
"HelloWorld"AIt returns an error because APPEND only works on empty keys
BIt replaces the value entirely with 'World'
CIt concatenates 'World' onto the existing value, making mykey equal to 'HelloWorld', and returns the new total string length
DIt creates a List with two elements: 'Hello' and 'World'
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.