Snowflake SnowPro Core COF-C03 Practice Test Questions and Exam Dumps Part20 Q381-400

View Full Snowflake SnowPro Core COF-C03 Exam Dumps and Practice Test Dumps.

 

Question 381

Which Snowflake data type is designed to store arbitrary binary data?

  1. VARCHAR
  2. VARIANT
  3. BINARY
  4. OBJECT

Correct Answer: 3

Explanation

The BINARY data type is designed to store binary data rather than character strings. It can be useful for values represented as sequences of bytes, including encoded or encrypted data that should not be treated as ordinary text. VARCHAR is intended for character data, while VARIANT stores semi-structured values such as JSON-like objects, arrays, and scalar values. OBJECT is a semi-structured type specifically representing key-value collections. Choosing BINARY is therefore appropriate when the underlying value consists of bytes rather than textual characters or semi-structured content.

Question 382

Which Snowflake data type can represent JSON objects, arrays, and scalar values within a single column?

  1. VARIANT
  2. BINARY
  3. NUMBER
  4. DATE

Correct Answer: 1

Explanation

VARIANT is a flexible Snowflake data type designed to store semi-structured data, including JSON objects, arrays, and scalar values. It allows different structures to coexist in the same column without requiring a rigid relational schema for every nested element. This makes VARIANT useful for ingesting and analyzing semi-structured information. BINARY stores byte sequences, NUMBER represents numeric values, and DATE represents calendar dates. When the data source contains changing or nested structures that need to remain accessible through SQL, VARIANT provides an appropriate storage option.

Question 383

Which Snowflake data type specifically represents a collection of key-value pairs in semi-structured data?

  1. ARRAY
  2. OBJECT
  3. BINARY
  4. VARCHAR

Correct Answer: 2

Explanation

OBJECT represents a collection of key-value pairs within Snowflake’s semi-structured data model. It is commonly encountered when working with JSON objects where each key identifies an associated value. ARRAY is instead designed for ordered collections of elements, while BINARY stores byte sequences and VARCHAR stores character strings. OBJECT values can also be contained within VARIANT data, allowing complex nested structures to be represented. Understanding the distinction between OBJECT and ARRAY is important when querying semi-structured data and selecting the appropriate functions for extracting or transforming nested information.

Question 384

Which Snowflake data type represents an ordered collection of elements?

  1. OBJECT
  2. ARRAY
  3. BINARY
  4. BOOLEAN

Correct Answer: 2

Explanation

ARRAY represents an ordered collection of elements in Snowflake’s semi-structured data model. Array elements can contain values of different types, making arrays useful when the source data contains lists or sequences. OBJECT, by contrast, represents key-value pairs rather than an ordered list. BINARY stores byte sequences, while BOOLEAN represents true or false values. Arrays are frequently encountered in JSON and other semi-structured datasets. Understanding the distinction between arrays and objects helps users select suitable functions when extracting, filtering, or expanding nested data.

Question 385

Which function converts a JSON-formatted string into a Snowflake semi-structured value?

  1. PARSE_JSON
  2. BUILD_JSON
  3. JSON_TO_TEXT
  4. CONVERT_OBJECT

Correct Answer: 1

Explanation

PARSE_JSON converts a string containing valid JSON into a Snowflake semi-structured value, typically represented using VARIANT. This enables users to access individual fields, arrays, and nested structures using Snowflake’s semi-structured data capabilities. Simply storing JSON as a VARCHAR would leave the content as text and would not provide the same structured access behavior. Functions such as GET_PATH can subsequently retrieve nested values from the parsed result. PARSE_JSON is therefore an important function when JSON text needs to become queryable semi-structured data.

Question 386

Which function can construct a Snowflake OBJECT from explicitly supplied key-value pairs?

  1. ARRAY_CONSTRUCT
  2. OBJECT_CONSTRUCT
  3. OBJECT_KEYS
  4. PARSE_XML

Correct Answer: 2

Explanation

OBJECT_CONSTRUCT creates an OBJECT containing key-value pairs supplied to the function. It is useful when relational columns need to be transformed into a semi-structured representation, such as when constructing JSON-like objects for downstream processing. ARRAY_CONSTRUCT serves a different purpose by creating an array, while OBJECT_KEYS retrieves keys from an existing object. PARSE_JSON converts JSON text into a semi-structured value. OBJECT_CONSTRUCT is therefore particularly useful for dynamically building object structures from individual SQL expressions or columns.

Question 387

Which function returns the keys contained in a Snowflake OBJECT value?

  1. OBJECT_KEYS
  2. OBJECT_VALUES
  3. GET_KEYS_TEXT
  4. PARSE_KEYS

Correct Answer: 1

Explanation

OBJECT_KEYS returns the keys contained in an OBJECT value. This can be useful when users need to inspect the structure of semi-structured data or determine which field names are present in an object. It is different from functions that retrieve a particular value by path because OBJECT_KEYS focuses on the object’s available key names. ARRAY-related functions operate on ordered collections rather than object fields. OBJECT_KEYS is therefore useful during exploratory analysis and transformation of JSON-like data when the set of available object attributes needs to be identified.

Question 388

Which function returns the number of elements contained in a Snowflake ARRAY?

  1. ARRAY_COUNT
  2. ARRAY_SIZE
  3. COUNT_ARRAY_ELEMENTS
  4. SIZE_ARRAY_VALUES

Correct Answer: 2

Explanation

ARRAY_SIZE returns the number of elements in a Snowflake ARRAY. It is useful when queries need to determine the length of an array before processing or filtering its contents. For example, analytical logic may need to identify records containing a certain number of elements or distinguish empty arrays from populated arrays. ARRAY_SIZE specifically operates on arrays, while OBJECT-related functions address key-value structures. Using the appropriate semi-structured function allows SQL logic to work directly with nested data instead of requiring manual text parsing.

Question 389

Which function can retrieve a value from a VARIANT or OBJECT using a specified path?

  1. GET_PATH
  2. READ_VARIANT
  3. VALUE_PATH
  4. OBJECT_PATH_ONLY

Correct Answer: 1

Explanation

GET_PATH retrieves a value from semi-structured data using a specified path. This is useful when a VARIANT or OBJECT contains nested fields and the query needs to access a particular location within that structure. Path-based access allows users to work with deeply nested data without first converting the entire value into a relational table. Other semi-structured functions may perform specialized operations, but GET_PATH is specifically designed for path-based extraction. It is therefore useful when querying nested JSON-like structures stored in Snowflake.

Question 390

Which Snowflake function can determine the data type of an expression at runtime?

  1. TYPEOF
  2. DATA_TYPE
  3. GET_TYPE_VALUE
  4. CHECK_TYPE

Correct Answer: 1

Explanation

TYPEOF returns information about the data type of an expression at runtime. This can be especially useful when analyzing VARIANT values because semi-structured data may contain different types across rows. By determining whether a value is an object, array, string, number, or another supported type, users can build more appropriate transformation or filtering logic. TYPEOF is therefore valuable during data exploration and validation. It differs from functions that convert values because it identifies the current type rather than changing the expression’s representation.

Question 391

Which Snowflake predicate can test whether a semi-structured value is an ARRAY?

  1. IS_ARRAY
  2. IS_LIST
  3. CHECK_ARRAY_TYPE
  4. ARRAY_TEST

Correct Answer: 1

Explanation

IS_ARRAY tests whether an expression represents an ARRAY. This is useful when processing VARIANT data whose structure may differ between rows. Before applying array-specific operations, users can use a type-checking function to determine whether the value actually contains an array. This can help prevent inappropriate operations against objects, strings, or scalar values. The predicate is specifically designed for array identification, while other similarly named options are not standard Snowflake functions. Type checks are particularly useful in flexible semi-structured data-processing workflows.

Question 392

Which Snowflake expression can explicitly convert a value to another data type while allowing the conversion operation to be written within an expression?

  1. CAST
  2. CHANGE_TYPE
  3. TYPE_SWITCH
  4. CONVERT_VALUE_ONLY

Correct Answer: 1

Explanation

CAST explicitly converts an expression from one data type to another supported type. It is commonly used when SQL operations require compatible data types or when users need to control the resulting type of an expression. For example, a textual representation of a number can be converted to a numeric type when appropriate. CAST performs an explicit conversion and may produce an error when the value cannot be converted successfully. This differs from TRY_CAST, which is designed to return NULL instead of failing for unsuccessful supported conversions.

Question 393

Which conversion function returns NULL instead of raising an error when a supported conversion cannot be performed?

  1. SAFE_CONVERT
  2. TRY_CAST
  3. NULL_CAST
  4. CAST_OR_NULL_ONLY

Correct Answer: 2

Explanation

TRY_CAST attempts to convert a value to a specified supported data type and returns NULL when the conversion cannot be performed successfully. This behavior can be useful when processing imperfect source data where invalid values should not cause the entire query to fail. CAST, by comparison, can raise an error when a conversion is invalid. TRY_CAST therefore provides a more tolerant approach for data-cleaning and validation workflows. Users can subsequently identify NULL results and handle invalid source values through additional SQL logic.

Question 394

Which Snowflake function returns the first expression that is not NULL from a list of expressions?

  1. NULLIF
  2. NVL2
  3. COALESCE
  4. ISNULL_ONLY

Correct Answer: 3

Explanation

COALESCE evaluates its supplied expressions and returns the first value that is not NULL. It is useful for handling missing information and providing fallback values when earlier expressions contain NULL. For example, a query can prioritize one column and use another column when the first contains no value. NULLIF has a different purpose because it returns NULL when two expressions are equal. COALESCE can accept multiple expressions, making it useful for layered fallback logic in analytical queries and data-transformation workflows.

Question 395

Which function returns NULL when two specified expressions are equal?

  1. NULLIF
  2. COALESCE
  3. NVL
  4. IF_EQUAL_NULL

Correct Answer: 1

Explanation

NULLIF compares two expressions and returns NULL when they are equal; otherwise, it returns the first expression. This can be useful when a particular value should be treated as missing rather than as meaningful data. For example, a placeholder value can potentially be converted into NULL before further analysis. COALESCE and NVL are commonly used to replace or handle NULL values rather than intentionally producing NULL from equal expressions. NULLIF therefore serves a specific conditional-nullification purpose in Snowflake SQL.

Question 396

Which Snowflake timestamp type stores a timestamp without time zone information?

  1. TIMESTAMP_LTZ
  2. TIMESTAMP_TZ
  3. TIMESTAMP_NTZ
  4. TIMESTAMP_UTC

Correct Answer: 3

Explanation

TIMESTAMP_NTZ represents a timestamp without time zone information. The value is stored without an associated time-zone offset, making it useful when the application needs a timestamp representing a date and time without timezone semantics. TIMESTAMP_LTZ uses local-time-zone behavior for presentation, while TIMESTAMP_TZ includes time-zone information. TIMESTAMP_UTC is not a standard Snowflake timestamp data type. Selecting the appropriate timestamp type is important because time-zone behavior can affect how values are stored, interpreted, and displayed across different sessions.

Question 397

Which Snowflake timestamp type stores UTC-based time internally while displaying values according to the session’s time zone?

  1. TIMESTAMP_NTZ
  2. TIMESTAMP_LTZ
  3. TIMESTAMP_TZ
  4. TIMESTAMP_LOCAL_ONLY

Correct Answer: 2

Explanation

TIMESTAMP_LTZ represents timestamps using local time-zone semantics. Snowflake stores the timestamp in a way that supports consistent instant representation while displaying it according to the session’s current time zone. This makes TIMESTAMP_LTZ useful when the same point in time needs to be presented appropriately to users operating in different time zones. TIMESTAMP_NTZ does not carry time-zone semantics, while TIMESTAMP_TZ includes an associated time-zone offset. Understanding these differences helps prevent incorrect interpretation of timestamps in globally distributed applications and analytical environments.

Question 398

Which timestamp type includes time zone information with the stored timestamp value?

  1. TIMESTAMP_NTZ
  2. TIMESTAMP_LTZ
  3. TIMESTAMP_TZ
  4. TIMESTAMP_SESSION

Correct Answer: 3

Explanation

TIMESTAMP_TZ represents a timestamp with time-zone information. It is appropriate when the time-zone offset associated with the timestamp needs to be retained as part of the value’s representation. This differs from TIMESTAMP_NTZ, which does not contain time-zone information, and TIMESTAMP_LTZ, which uses session time-zone behavior for display while representing an instant consistently. Choosing TIMESTAMP_TZ can be useful when preserving time-zone context is important to the application or dataset. The distinction among Snowflake timestamp types is important for accurate global time handling.

Question 399

Which transaction command makes the changes from the current transaction permanent?

  1. COMMIT
  2. SAVE
  3. APPLY
  4. CONFIRM

Correct Answer: 1

Explanation

COMMIT permanently applies the changes made during the current transaction. It marks the successful completion of the transaction so that its changes are no longer pending for rollback within that transaction. ROLLBACK serves the opposite purpose by undoing applicable uncommitted changes. Transaction control is useful when multiple related statements need to be treated as a unit of work. COMMIT is therefore the command used when the transaction’s changes have been validated and should become permanent according to Snowflake’s transaction behavior.

Question 400

Which transaction command reverses uncommitted changes made during the current transaction?

  1. COMMIT
  2. CANCEL TRANSACTION
  3. ROLLBACK
  4. REVERT SESSION

Correct Answer: 3

Explanation

ROLLBACK reverses changes made during the current transaction that have not yet been committed. It is useful when validation fails, an error is detected, or a group of related operations should not be applied. COMMIT instead makes the transaction’s changes permanent. Transaction control allows multiple statements to be managed as a logical unit, helping maintain consistency when operations depend on one another. ROLLBACK therefore provides a controlled way to abandon applicable uncommitted work rather than leaving partial transaction changes applied.