Chapter: Shared Memory Programming with OpenMP
1.

Which directive must precede the directive: #pragma omp sections (not necessarily immediately)?

A. #pragma omp section
B. #pragma omp parallel
C. None
D. #pragma omp master
Answer» A. #pragma omp section
2.

When compiling an OpenMP program with gcc, what flag must be included?

A. -fopenmp
B. #pragma omp parallel
C. –o hello
D. ./openmp
Answer» A. -fopenmp
3.

Within a parallel region, declared variables are by default ________ .

A. Private
B. Local
C. Loco
D. Shared
Answer» D. Shared
4.

A ______________ construct by itself creates a “single program multiple data” program, i.e., each thread executes the same code.

A. Parallel
B. Section
C. Single
D. Master
Answer» A. Parallel
5.

_______________ specifies that the iteration of the loop must be executed as they would be in serial program.

A. Nowait
B. Ordered
C. Collapse
D. for loops
Answer» B. Ordered
6.

___________________ initializes each private copy with the corresponding value from the master thread.

A. Firstprivate
B. lastprivate
C. nowait
D. Private (OpenMP) and reduction.
Answer» A. Firstprivate
7.

The __________________ of a parallel region extends the lexical extent by the code of functions that are called (directly or indirectly) from within the parallel region.

A. Lexical extent
B. Static extent
C. Dynamic extent
D. None of the above
Answer» C. Dynamic extent
8.

The ______________ specifies that the iterations of the for loop should be executed in parallel by multiple threads.

A. Sections construct
B. for pragma
C. Single construct
D. Parallel for construct
Answer» B. for pragma
9.

_______________ Function returns the number of threads that are currently active in the parallel section region.

A. omp_get_num_procs ( )
B. omp_get_num_threads ( )
C. omp_get_thread_num ( )
D. omp_set_num_threads ( )
Answer» B. omp_get_num_threads ( )
10.

The size of the initial chunksize _____________.

A. total_no_of_iterations / max_threads
B. total_no_of_remaining_iterations / max_threads
C. total_no_of_iterations / No_threads
D. total_no_of_remaining_iterations / No_threads
Answer» A. total_no_of_iterations / max_threads
11.

A ____________ in OpenMP is just some text that modifies a directive.

A. data environment
B. clause
C. task
D. Master thread
Answer» B. clause
12.

In OpenMP, the collection of threads executing the parallel block the original thread and the new thread is called a ____________

A. team
B. executable code
C. implicit task
D. parallel constructs
Answer» A. team
13.

When a thread reaches a _____________ directive, it creates a team of threads and becomes the master of the team.

A. Synchronization
B. Parallel
C. Critical
D. Single
Answer» B. Parallel
14.

Use the _________ library function to determine if nested parallel regions are enabled.

A. Omp_target()
B. Omp_declare target()
C. Omp_target data()
D. omp_get_nested()
Answer» D. omp_get_nested()
15.

The ____________ directive ensures that a specific memory location is updated atomically, rather than exposing it to the possibility of multiple, simultaneous writing threads.

A. Parallel
B. For
C. atomic
D. Sections
Answer» C. atomic
16.

A ___________ construct must be enclosed within a parallel region in order for the directive to execute in parallel.

A. Parallel sections
B. Critical
C. Single
D. work-sharing
Answer» D. work-sharing
17.

____________ is a form of parallelization across multiple processors in parallel computing environments.

A. Work-Sharing Constructs
B. Data parallelism
C. Functional Parallelism
D. Handling loops
Answer» B. Data parallelism
18.

In OpenMP, assigning iterations to threads is called ________________

A. scheduling
B. Static
C. Dynamic
D. Guided
Answer» A. scheduling
19.

The ____________is implemented more efficiently than a general parallel region containing possibly several loops.

A. Sections
B. Parallel Do/For
C. Parallel sections
D. Critical
Answer» B. Parallel Do/For
20.

_______________ causes no synchronization overhead and can maintain data locality when data fits in cache.

A. Guided
B. Auto
C. Runtime
D. Static
Answer» D. Static
21.

How does the difference between the logical view and the reality of parallel architectures affect parallelization?

A. Performance
B. Latency
C. Bandwidth
D. Accuracy
Answer» A. Performance
22.

How many assembly instructions does the following C instruction take? global_count += 5;

A. 4 instructions
B. 3 instructions
C. 5 instructions
D. 2 instructions
Answer» A. 4 instructions
Tags
Question and answers in Shared Memory Programming with OpenMP, Shared Memory Programming with OpenMP multiple choice questions and answers, Shared Memory Programming with OpenMP Important MCQs, Solved MCQs for Shared Memory Programming with OpenMP, Shared Memory Programming with OpenMP MCQs with answers PDF download