NEW
Font size
WorksheetsCUDA Programming Quiz
Total questions: 20
Worksheet time: 10mins
What is CUDA?
A type of CPU
A parallel computing platform and API model
A machine learning framework
A programming language
Which company developed CUDA?
Intel
AMD
NVIDIA
Qualcomm
What is a CUDA core?
A single-threaded CPU core
A specialized core for graphics rendering
A small processing unit inside an NVIDIA GPU
A high-performance RAM module
What is the primary programming language used for CUDA development?
Python
Java
C/C++
Assembly
What is the purpose of CUDA threads?
To improve CPU speed
To enable parallel execution on the GPU
To handle disk I/O operations
To replace RAM
What does a CUDA 'warp' refer to?
A group of 32 threads executed in parallel
A memory buffer in the GPU
A single-threaded execution unit
A specialized CUDA function
What is the function of shared memory in CUDA?
It acts as a bridge between CPU and GPU memory
It speeds up communication between threads in the same block
It stores CUDA kernels
It replaces global memory
What is the maximum number of threads in a CUDA block (typically)?
128
512
1024
2048
What is the purpose of CUDA streams?
To manage parallel kernel execution
To synchronize CPU and GPU execution
To store global memory
To create new CUDA threads
Which of the following memory types is the slowest in CUDA?
Shared memory
Register memory
Global memory
Constant memory
How do you declare a CUDA kernel function?
void kernel>>()
__global__ void kernel() {}
__kernel void kernel() {}
gpu_function void kernel() {}
How do you launch a CUDA kernel with 256 threads per block?
kernel();
kernel>>();
kernel>>();
kernel>>();
Which keyword is used to define a function that runs on the GPU but is called from the CPU?
__device__
__global__
__host__
__gpu__
What does the threadIdx.x variable represent?
The index of the current thread within a block
The index of the current block within the grid
The total number of threads in a block
The total number of blocks in the grid
How do you allocate memory on the GPU?
malloc(size);
cudaMalloc(&ptr, size);
gpuAlloc(&ptr, size);
cudaAlloc(&ptr, size);
Which function is used to copy data from the CPU to the GPU?
cudaMemcpy(dest, src, size, cudaHostToDevice);
cudaCopy(dest, src, size, cudaMemcpyHostToDevice);
cudaMemcpy(dest, src, size, cudaMemcpyHostToDevice);
memcpy(dest, src, size);
Which function is used to synchronize all threads in a CUDA kernel?
__sync();
cudaThreadSync();
__syncthreads();
cudaBarrier();
What is the correct way to free allocated GPU memory?
free(ptr);
cudaFree(ptr);
gpuFree(ptr);
cudaDealloc(ptr);
How do you check for CUDA errors after launching a kernel?
cudaErrorCheck();
cudaGetError();
cudaError_t err = cudaGetLastError();
checkCUDAError();
Which CUDA memory type is shared among all threads within a block?
Global memory
Shared memory
Constant memory
Local memory
