You are on page 1of 29

Following table stores total population and states per country:

1. CREATE TABLE countries (


2. country_id uuid,
3. country_name text,
4. total_pop int,
5. state_code text,
6. state_name text,
7. PRIMARY KEY ((country_id), state_code)
8. );
Which columns should be made STATIC?

state_code and state_name

country_name

total_pop and country_name

country_id and state_code

2. In an Application Workflow diagram, Q2 and Q3 both require data collected by a top Q1. Q3 can be
split up into Q31 and Q32.

Which access patterns are evaluated before Q32?

Q1 and Q2

Only Q1

Q1 and Q3

Q1 and Q31
3. How many rows will be in the table after the following sequence?
1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. INSERT INTO countries (country, state, pop) VALUES ('USA', 'Oregon', 4200000);
9. INSERT INTO countries (country, state, pop) VALUES ('USA', 'Idaho', -1);
10. INSERT INTO countries (country, state, pop) VALUES ('USA', 'Idaho', 1700000);

Three rows in one partition.

Two rows in the same partition.

Two rows in different partitions.

Third query fails, as it requires IF NOT EXISTS.

4. Define the primary key for temperatures_by_network:

PRIMARY KEY (network)


1. PRIMARY KEY (network, date, hour, sensor)
2. WITH CLUSTERING ORDER BY (date DESC, hour DESC, sensor ASC)


1. PRIMARY KEY (network, date, hour, sensor)
2. WITH CLUSTERING ORDER BY (date ASC, hour ASC, sensor DESC)


1. PRIMARY KEY (network, date, hour, sensor)
2. WITH CLUSTERING ORDER BY (network, date DESC, hour DESC, sensor ASC)

5. Which is NOT a lightweight transaction?

INSERT INTO Countries (country, state) VALUES ('USA', 'Oregon') IF NOT EXISTS;

UPDATE Countries SET state='Idaho' WHERE country='USA' IF state='Oregon';


1. BEGIN BATCH
2. INSERT INTO Countries (country, state) VALUES ('USA', 'Oregon');
3. UPDATE Countries SET state='Idaho' WHERE country='USA';
4. APPLY BATCH;

DELETE FROM Countries WHERE country='USA' IF EXISTS;

6. Primary keys:

identify the nodes in the cluster that store the row(s).

uniquely identify rows in a table and determine their sort order.

uniquely identify rows in a partition and determine their sort order.

are alternative surrogate keys for row numbers.

7. You run dbbulk with the following result:


1. $ dsbulk count -query "SELECT id FROM myks.mytable WHERE mycol=2 ALLOW
FILTERING"
2. Operation directory: /tmp/logs/COUNT_20190314-171916-543786.
3. total | failed | rows/s | mb/s | kb/row | p50 ms | p99ms | p999ms
4. 6 | 0 | 18 | 0.00 | 0.00 | 130.81 | 131.07 | 131.07
5. Operation COUNT_20190314-171916-543786 completed successfully in 0 seconds.
What is the operation you performed?

You loaded 6 filtered rows into a table.

You unloaded 6 filtered rows from a table.

You counted the number of rows in a table.

You filtered data from a table and returned the number of rows.

8. You have a table definition with no primary key yet:


1. CREATE TABLE accounts_by_user (
2. account_number text,
3. cash_balance text,
4. name text,
5. username text,
6. PRIMARY KEY (…)
7. );
Define the primary key, knowing that:

· We need all accounts of some user, with their cash balance.

· Users can be identified by names or usernames.

· There can be more users with the same name.

· Accounts are uniquely identified by a number.

PRIMARY KEY ((username, account_number))

PRIMARY KEY (name, account_number)


1. PRIMARY KEY (username, account_number)
2. WITH CLUSTERING ORDER BY (account_number ASC)


PRIMARY KEY (username, account_number)

9. What can you say about the following batch?


1. CREATE TABLE countries (
2. country text,
3. total_pop int STATIC,
4. state text,
5. state_pop int,
6. PRIMARY KEY (country, state)
7. );
8.  
9. BEGIN BATCH
10. INSERT INTO countries (country, total_pop) VALUES ('USA', 0) IF NOT EXISTS;
11. INSERT INTO countries (country, state, state_pop) VALUES ('USA', 'Oregon', 4200000);
12. APPLY BATCH;

It's a single-partition batch that will be applied successfully.

It's a single-partition batch that will fail.

It's a multiple-partition batch that will be applied successfully.

It's a multiple-partition batch that will fail.

10. Which of the following is considered a specific read technique in Cassandra?

conditional updates

batches

materialized views

lightweight transactions

11. What is an example of multi-cloud deployment?


Cassandra in two inter-connected on-premise data centers.

Cassandra in two separate on-premise data centers.

Cassandra in separate AWS and Microsoft Azure Virtual machines.

Cassandra in inter-connected AWS and Microsoft Azure virtual machines.

12. What is an example of hybrid-cloud deployment?

Cassandra in on-premise data center accessed from AWS virtual machines.

Cassandra deployed on both on-premise and on Azure virtual machines.

Cassandra in two inter-connected on-premise data centers.

Cassandra in two separate on-premise data centers.

13. The main reason to use a batch is

atomicity

consistency

Isolation

durability

14 Which statement is a batch in CQL?

BEGIN BATCH ... COMMIT BATCH;

BEGIN BATCH ... ROLLBACK BATCH;

BEGIN BATCH ... APPLY BATCH;

BEGIN BATCH ... END BATCH;

15. What is the smallest replication factor that can ensure availability when two nodes fail?

5
16. Static columns are used to store values that are:

constant and cannot be changed

the same for all rows in a partition

shared by all rows in a table

17. Which one of the following is not a valid CQL statement?

UPDATE

INSERT

UPSERT

18. What are the main use cases for DSBulk?

importing and exporting data to and from Cassandra

data analysis with Apache Spark

querying data stored in Cassandra tables


19. Which DSBulk option can be used to specify how file fields correspond to table columns?

"-k"

"-t"

"-m"

20. A table with a composite partition key can be queried using:

only the first column of the partition key

any subset of partition key columns, as long as the primary key definition order is respected

all columns of the partition key

21. Row ordering is only possible:

on all primary key columns

within each partition

when explicitly specified in a query


22. Which of the following consistency levels are guaranteed to provide strong consistency in any
cluster?

QUORUM for writes and QUORUM for reads

QUORUM for writes and TWO for reads

QUORUM for writes and LOCAL QUORUM for reads

23. Which statement about materialized views is valid?

A materialized view is automatically maintained

Any changes to a view are automatically propagated to a base table

A materialized view can aggregate data from a base table

24. Which parameter in the cassandra.yaml file configures vnodes?

num_tokens

num_nodes

num_vnodes

set numnodes

25. Which of the following statements are true concerning gossip?

Constant trickle of network traffic

Does not cause network spikes

Minimal compared to data streaming

All of the above

26. Which is a valid statement about repairs in Cassandra?

Repairs should be run on all Cassandra clusters.

Repairs should only be run on Cassandra clusters after adding nodes.

Repairs should only be run on Cassandra clusters after deleting nodes


Cassandra clusters do not require repairs.

27. Which of the following are benefits from compaction? Check all that apply.

More optimal disk usage

Faster reads

Cassandra responds quick while compacting

Less memory pressure

28. All tombstones are discarded during compaction.

TRUE

FALSE

29. The partition summary:

stores the most recently accessed records.


stores partition byte offsets in the SSTable.

stores byte offsets into the partition index.

stores the actual partitions.

30. The key cache...

stores byte offsets of the most recently accessed records.

stores byte offsets for all partitions in a SSTable.

stores byte offsets into the partition index.

stores the actual partitions.

31. Which is the following is not a type of snitch?

SimpleSnitch

PropertyFileSnitch


DynamicSnitch

CassandraSnitch

32. What can you tell about the following batch?


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. BEGIN BATCH
9. INSERT INTO countries (country, state, pop) values ('USA', 'Oregon', 4200000);
10. UPDATE countries SET pop=1700000 WHERE country='USA' AND state='Idaho' IF
pop=NULL;
11. APPLY BATCH;

This is a single-partition batch that will be applied successfully.

This is a multi-partition batch that will be applied successfully.

This is a single-partition batch that will fail.

This is a multi-partition batch that will fail.

33. DSBulk creates log files in a /tmp/logs/LOAD_... operations directory.

Which is NOT a file saved there?

operation.log

positions.txt

mapping-errors.log

gc.log

34. What two row values are returned by the last SELECT query?
1. CREATE TABLE Countries (
2. country text,
3. state text,
4. info text STATIC,
5. PRIMARY KEY (country, state)
6. );
7.  
8. INSERT INTO Countries (country, state, info) VALUES ('USA', 'Oregon', 'nice country');
9. INSERT INTO Countries (country, state, info) VALUES ('USA', 'Idaho', 'lovely country');
10.  
11. SELECT info FROM Countries WHERE country='USA';

'nice country' followed by 'lovely country'

'lovely country' followed by 'nice country'

'lovely country' followed by 'lovely country'

'nice country' followed by 'nice country'


35. Clustering keys:

identify the nodes in the cluster that store the row(s).

uniquely identify rows in a partition and determine their sort order.

are alternative surrogate keys for row numbers.


uniquely identify rows in a table and determine their sort order.

36. You execute one by one the following statements:


1. CREATE TABLE Countries (
2. id timeuuid PRIMARY KEY,
3. country text
4. );
5.  
6. INSERT INTO Countries (id, country) VALUES (uuid(), 'USA');
7. INSERT INTO Countries (id, country) VALUES (uuid, 'UK');
8. INSERT INTO Countries (id, country) VALUES (timeuuid(), 'France');
9. INSERT INTO Countries (id, country) VALUES (NOW(), 'Mexico');
10. INSERT INTO Countries (id, country) VALUES (tOtimeStamp(now()), 'Italy');
How many rows are now in the table?

More than 2

37. You have a table definition with no primary key yet:


1. CREATE TABLE orders_by_user (
2. user_id text,
3. order_id text,
4. order_date date,
5. order_status text,
6. order_total decimal,
7. PRIMARY KEY (…)
8. );
Define the primary key, knowing that:

· We need to list all orders by user, with most recent first.

· Users and orders are each uniquely identified by their id.

PRIMARY KEY (user_id, order_date, order_id)


PRIMARY KEY (user_id, order_id, order_date)


1. PRIMARY KEY (user_id, order_date, order_id)
2. WITH CLUSTERING ORDER BY (order_date DESC, order_id ASC)


1. PRIMARY KEY (user_id, order_date, order_id)
2. WITH CLUSTERING ORDER BY (order_date DESC)

38. Which is NOT a common Cassandra log file?

transactions.log

debug.log

system.log

gc.log

39. How many tombstones are created after this sequence?


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. INSERT INTO countries (country, state, pop) values ('USA', 'Oregon', null);
9.  
10. INSERT INTO countries (country, state, pop) values ('USA', 'Idaho', 1700000);
11. UPDATE countries SET pop=NULL WHERE country='USA' AND state='Idaho';
12.  
13. INSERT INTO countries (country, state, pop) values ('Canada', 'Alberta', 4300000);
14. DELETE pop FROM countries WHERE country='Canada' AND state='Alberta';
15. INSERT INTO countries (country, state, pop) values ('Canada', 'Ontario', 14500000);
16. DELETE FROM countries WHERE country='Canada' AND state='Ontario';

1

40. What is the role of the HEADER option in a CQL COPY command? (check all that apply)

It overrides the column names on data import.

It tells if the first line in the CSV input file contains column names.

It tells to write column names in the first line of the CSV output file.

It selects only a few table columns to export data from.

41. You execute one by one the following statements:


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. INSERT INTO countries (country, state, pop) values ('USA', 'Oregon', 4200000);
9. UPDATE countries SET pop=1700000 WHERE country='USA' AND state='Idaho';
10. UPDATE countries SET pop=1 WHERE country='USA' AND state IN ('Oregon', 'Florida');
11. UPDATE countries SET pop=0 WHERE country='USA';
12.  
13. SELECT pop FROM countries WHERE country='USA' AND state='Oregon';
What value is returned by the SELECT query?


1

4200000

1700000

42. How can you say if a node will trigger a hinted handoff?

nodetool statushandoff

nodetool enablehandoff

DESCRIBE HINTS

check the data/hints folder

43. Which is NOT a way to change the logging level?

cassandra.yaml

logback.xml

JConsole

nodetool setlogginglevel

44. What kind of rows may be discarded during a compaction?

Expired tombstones with a new version number.


Tombstones not yet expired.

New inserts.

Older versions for rows with the same primary key.

45. Consider the table:


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY ((country, state))
6. );
Assuming the table is populated, what can be returned by the SELECT query?
1. SELECT * FROM countries
2. WHERE country='USA' AND state='Oregon';

One single row from one partition.

Multiple rows from one partition.

Multiple rows from multiple partitions, with one row from each.

Multiple rows from multiple partitions, with multiple rows from each.

46. Which is NOT an operation that happens during compaction?

Rows from older SSTables are written in a new SSTable on disk.

For rows with the same primary key, only the most recent change is kept.

All tombstones are immediately removed.

Older SSTables are deleted at the end.

47. What is wrong with the SELECT query?


1. CREATE TABLE Countries (
2. country text,
3. state text,
4. city text,
5. area text,
6. population int,
7. PRIMARY KEY ((country, state), city, area)
8. );
9.  
10. SELECT * FROM Countries WHERE country='USA';

A SELECT query must reference all primary keys.

A SELECT query must reference all partition keys.

A SELECT query must include at least one cluster key.

This SELECT query must end with ALLOW FILTERING.

48. What can you tell about the following batch?


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. BEGIN BATCH
9. INSERT INTO countries (country, state, pop) values ('USA', 'Oregon', 4200000);
10. UPDATE countries SET pop=4300000 WHERE country='Canada' AND state='Alberta' IF
pop=NULL;
11. APPLY BATCH;

This is a single-partition batch that will be applied successfully.


This is a multi-partition batch that will be applied successfully.

This is a single-partition batch that will fail.

This is a multi-partition batch that will fail.

49. Consider the table:


1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
Assuming the table is populated, what can be returned by the SELECT query?
1. SELECT * FROM countries
2. WHERE country='USA' AND state IN ('Oregon', 'Idaho');

One single row from one partition.

Multiple rows from one partition.

Multiple rows from multiple partitions, with one row from each.

Multiple rows from multiple partitions, with multiple rows from each.

50. You have three data centers with 5 nodes each, replication factors 1, 2, 3, and one node down in
each data center. In the worst case scenario, how many nodes are still up with your data?


5

51. How many rows exist in the table after the following sequence?
1. CREATE TABLE countries (
2. country text,
3. state text,
4. pop int,
5. PRIMARY KEY (country, state)
6. );
7.  
8. BEGIN BATCH
9. UPDATE countries SET pop=4200000 WHERE country='USA' AND state='Oregon';
10. INSERT INTO countries (country, state, pop) values ('USA', 'Idaho', 1700000);
11. INSERT INTO countries (country, state) values ('USA', 'Oregon');
12. APPLY BATCH;

52. You run dbbulk with the following result:


1. $ dsbulk count -query "SELECT id FROM myks.mytable WHERE mycol=2 ALLOW
FILTERING"
2. Operation directory: /tmp/logs/COUNT_20190314-171916-543786.
3. total | failed | rows/s | mb/s | kb/row | p50 ms | p99ms | p999ms
4. 6 | 0 | 18 | 0.00 | 0.00 | 130.81 | 131.07 | 131.07
5. Operation COUNT_20190314-171916-543786 completed successfully in 0 seconds.
What is the operation you performed?

You loaded 6 filtered rows into a table.

You unloaded 6 filtered rows from a table.


You counted the number of rows in a table.

You filtered data from a table and returned the number of rows.

53. You create the table:


CREATE TABLE Countries (

country text,

state text,

created timestamp,

PRIMARY KEY (country, state, created)

);
Which of the following queries is valid?

SELECT * FROM Countries


WHERE country='USA'
AND state IN ('Oregon', 'Idaho', 'Montana')
AND created >= '2020-01-01' AND created <= '2020-12-01';

SELECT * FROM Countries


WHERE country='USA'
AND created >= '2020-01-01' AND created <= '2020-12-01';

SELECT * FROM Countries


WHERE state IN ('Oregon', 'Idaho', 'Montana')
AND created >= '2020-01-01' AND created <= '2020-12-01';

SELECT * FROM Countries


WHERE country='USA'
AND state IN ('Oregon', 'Idaho', 'Montana')
AND (created <= '2020-01-01' OR created >= '2020-12-01');

54. How many rows will be in the table after the following sequence?
CREATE TABLE countries (

country text,
state text,

pop int,

PRIMARY KEY (country, state)

);

UPDATE countries SET pop=4200000 WHERE country='USA' AND state='Oregon' IF EXISTS;

UPDATE countries SET pop=-1 WHERE country='USA' AND state='Idaho';

INSERT INTO countries (country, state, pop) VALUES ('USA', 'Idaho', 1700000);

One row.

Two rows into the same partition.

Two rows in two different partitions.

Second UPDATE query fails, as it requires IF EXISTS.

55. You try to execute the following statements one by one:


CREATE TABLE Countries (

country text,

state text,

city text,

PRIMARY KEY (country, state)

);

INSERT INTO Countries (country, state, city) VALUES ('USA', 'Oregon', 'Portland');

UPDATE Countries SET city='Vancouver' WHERE country='USA' AND state='Oregon';

UPDATE Countries SET state='Idaho' WHERE country='USA' AND state='Oregon';

UPDATE Countries SET country='Canada' WHERE country='USA' AND state='Idaho';

 SELECT * FROM Countries;


What row values are returned by the SELECT query?

USA-Oregon-Portland

USA-Oregon-Vancouver

Canada-Idaho-Vancouver

USA-Idaho-Vancouver
56. How many email entries can have for the same attachment?

one or more

zero or more

always one


one or zero

57. Define the primary key for the networks table:


1. PRIMARY KEY (name)
2. WITH CLUSTERING ORDER BY (name ASC)

PRIMARY KEY ((username), description, region, num_sensors)

name text PRIMARY KEY

name PRIMARY KEY text


58. What is a valid table definition for positions_by_account?


1. CREATE TABLE positions_by_account (
2. account text,
3. symbol text,
4. quantity int,
5. PRIMARY KEY ((account, symbol))
6. );


1. CREATE TABLE positions_by_account (
2. account text,
3. symbol text,
4. quantity int,
5. PRIMARY KEY (account, symbol)
6. ) WITH CLUSTERING ORDER BY (symbol ASC);


1. CREATE TABLE positions_by_account (
2. account text PRIMARY KEY,
3. symbol text,
4. quantity int
5. ) WITH CLUSTERING ORDER BY (account ASC, symbol ASC);


1. CREATE TABLE positions_by_account (
2. account text,
3. symbol text,
4. quantity int,
5. PRIMARY KEY (account, symbol ASC)
6. );

59.Define the primary key for accounts_by_user:

PRIMARY KEY (username, account_number ASC)

PRIMARY KEY ((username), account_number)

PRIMARY KEY (username, (account_number))

PRIMARY KEY ((username, account_number))

60. Define the primary key for tracks_by_user:


PRIMARY KEY (id)

PRIMARY KEY (id, timestamp DESC, album_title, album_year, number)

PRIMARY KEY (id, timestamp DESC, album_title ASC, album_year ASC, number ASC)


1. PRIMARY KEY (id, timestamp, album_title, album_year, number)
2. WITH CLUSTERING ORDER BY (timestamp DESC, album_title ASC, album_year
ASC, number ASC)

You might also like