wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CUDA Programming Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is CUDA?

a)

A type of CPU

b)

A parallel computing platform and API model

c)

A machine learning framework

d)

A programming language

2.

Which company developed CUDA?

a)

Intel

b)

AMD

c)

NVIDIA

d)

Qualcomm

3.

What is a CUDA core?

a)

A single-threaded CPU core

b)

A specialized core for graphics rendering

c)

A small processing unit inside an NVIDIA GPU

d)

A high-performance RAM module

4.

What is the primary programming language used for CUDA development?

a)

Python

b)

Java

c)

C/C++

d)

Assembly

5.

What is the purpose of CUDA threads?

a)

To improve CPU speed

b)

To enable parallel execution on the GPU

c)

To handle disk I/O operations

d)

To replace RAM

6.

What does a CUDA 'warp' refer to?

a)

A group of 32 threads executed in parallel

b)

A memory buffer in the GPU

c)

A single-threaded execution unit

d)

A specialized CUDA function

7.

What is the function of shared memory in CUDA?

a)

It acts as a bridge between CPU and GPU memory

b)

It speeds up communication between threads in the same block

c)

It stores CUDA kernels

d)

It replaces global memory

8.

What is the maximum number of threads in a CUDA block (typically)?

a)

128

b)

512

c)

1024

d)

2048

9.

What is the purpose of CUDA streams?

a)

To manage parallel kernel execution

b)

To synchronize CPU and GPU execution

c)

To store global memory

d)

To create new CUDA threads

10.

Which of the following memory types is the slowest in CUDA?

a)

Shared memory

b)

Register memory

c)

Global memory

d)

Constant memory

11.

How do you declare a CUDA kernel function?

a)

void kernel>>()

b)

__global__ void kernel() {}

c)

__kernel void kernel() {}

d)

gpu_function void kernel() {}

12.

How do you launch a CUDA kernel with 256 threads per block?

a)

kernel();

b)

kernel>>();

c)

kernel>>();

d)

kernel>>();

13.

Which keyword is used to define a function that runs on the GPU but is called from the CPU?

a)

__device__

b)

__global__

c)

__host__

d)

__gpu__

14.

What does the threadIdx.x variable represent?

a)

The index of the current thread within a block

b)

The index of the current block within the grid

c)

The total number of threads in a block

d)

The total number of blocks in the grid

15.

How do you allocate memory on the GPU?

a)

malloc(size);

b)

cudaMalloc(&ptr, size);

c)

gpuAlloc(&ptr, size);

d)

cudaAlloc(&ptr, size);

16.

Which function is used to copy data from the CPU to the GPU?

a)

cudaMemcpy(dest, src, size, cudaHostToDevice);

b)

cudaCopy(dest, src, size, cudaMemcpyHostToDevice);

c)

cudaMemcpy(dest, src, size, cudaMemcpyHostToDevice);

d)

memcpy(dest, src, size);

17.

Which function is used to synchronize all threads in a CUDA kernel?

a)

__sync();

b)

cudaThreadSync();

c)

__syncthreads();

d)

cudaBarrier();

18.

What is the correct way to free allocated GPU memory?

a)

free(ptr);

b)

cudaFree(ptr);

c)

gpuFree(ptr);

d)

cudaDealloc(ptr);

19.

How do you check for CUDA errors after launching a kernel?

a)

cudaErrorCheck();

b)

cudaGetError();

c)

cudaError_t err = cudaGetLastError();

d)

checkCUDAError();

20.

Which CUDA memory type is shared among all threads within a block?

a)

Global memory

b)

Shared memory

c)

Constant memory

d)

Local memory