SDP10_Final_Exam_Part2

Beschreibung

final_part2_sdp10
Good Guy Beket
Quiz von Good Guy Beket, aktualisiert more than 1 year ago
Good Guy Beket
Erstellt von Good Guy Beket vor fast 6 Jahre
648
7

Zusammenfassung der Ressource

Frage 1

Frage
Consider the following code. Assume the compiler is performing no optimization. Which of the following strategies would improve the speed of this code the most in the case where it returns true?
Antworten
  • Unroll the loop
  • Pull the (x % i)==0 into a function isDivisibleBy
  • Declare int sx = (int)sqrt(x) and change i < sqrt(x) to i < s
  • Move the check for (x % 2) != 0 to before the loop

Frage 2

Frage
By default, OpenMp _____ assigns loop iterations to threads. When the parallel for block is entered, it assigns each thread the set of loop iterations it is to execute?
Antworten
  • static
  • runtime
  • dynamic
  • auto

Frage 3

Frage
OpenMP assigns one iteration to each thread. When the thread finishes, it will be assigned the next iteration that hasn’t been executed yet.
Antworten
  • runtime
  • dynamic
  • static
  • auto

Frage 4

Frage
This is an example of? (IMAGE) /*set elements of array to 0*/ void clear_array (int *desc, int n){ int i; for (i = 0; i<n; i++) dest[i] = 0; } /*set elements of array to 0, Unrolled X4*/ ... ...
Antworten
  • Loop Unrolling
  • Loop fission
  • none
  • Loop fusion

Frage 5

Frage
This is an example of? (IMAGE) /*convert string to lowercase: slow*/ void lower1 (char *s) { int i; for (i = 0; i < strlen(s); i++) if (s{i} >= 'A' && s[i] <= 'Z') s[i] -= ('A' - 'a'); } /*Convert string to lowercase: faster*/ void lower2(char *s) { ... ... }
Antworten
  • Loop fission
  • Code motion
  • Loop unrolling
  • Loop blocking

Frage 6

Frage
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Antworten
  • Given a strong symbol and multiple weak symbols, choose the strong symbol.
  • Given multiple weak symbols, chose any of the weak symbols
  • Multiple strong symbols are not allowed.
  • None of these

Frage 7

Frage
In C, on a 34-bit x86 machine, the expression (1<<31) results in a negative integer
Antworten
  • True
  • False

Frage 8

Frage
Which of the following move operations is the following instruction an example of: movl (%edx), %eax ?
Antworten
  • memory to immediate
  • register to memory
  • memory to register
  • error, can't move memory to memory

Frage 9

Frage
What is the value of the following C expression? x = 0xBC and y = 0x35 (x & !y)
Antworten
  • 0x1200
  • 0xFFFF
  • 0x0001
  • 0x0000

Frage 10

Frage
In general, which of the following is slowest?
Antworten
  • moving from one register to another
  • comparing two numbers to decide where to jump
  • doing division
  • accessing memory

Frage 11

Frage
Good software design includes writing procedures for code you might otherwise repeat in-line. Pulling code into procedures can help some branch predictors; how else can it improve your program’s performance and/or your compiler’s ability to optimize your code?
Antworten
  • more opportunities for loop unrolling
  • less chance of compiler having to worry about aliasing and side effects
  • more opportunities for pipeline-level parallelism
  • better instruction cache hit rate

Frage 12

Frage
This is an example of?
Antworten
  • Parrallel processing
  • Serial processing
  • none of the above
  • Linear processing

Frage 13

Frage
This is an example of?
Antworten
  • Parallel processing
  • Serial processing
  • none of the above
  • Linear processing

Frage 14

Frage
The code ( a && b ) || (!a && !b) implements —
Antworten
  • Equality
  • MUX
  • Adder
  • Set membership

Frage 15

Frage
Consider the following code fragment (IMAGE) int a; int b; int main(int argc, char * argv[]){ int x; int y; … /* some code*/ }
Antworten
  • The value of &y is closer to the value of &x than to the value &
  • The values of &a and &b are closer to each other then the values &x and &y
  • The values of *a and *b are closer to each other than the values of *x and *y
  • The value of *y is closer to the value of *x than to the value of *a

Frage 16

Frage
Compare the size of int and int*
Antworten
  • each one of the above depends on the computer
  • int has fewer bits
  • int* has fewer bits
  • they have the same number of bits

Frage 17

Frage
In C, if x is an integer variable, the expression “x << 3” computes x * 8 but does not change the value of x.
Antworten
  • true
  • false

Frage 18

Frage
Using a base address [Eb]%edx=0x1000, and index register [ei]%ecx=0x02, compute the effective address for (IMAGE) : movl 8(%edx,%ecx, 4), %eax)
Antworten
  • 0x1032
  • 0x1016
  • 0x1064
  • 0x1010

Frage 19

Frage
Using a base address [Eb]%edx=0x1000, and index register [ei]%ecx=0x03, compute the effective address for (IMAGE): movl 8(%edx, %ecx, 4), %eax
Antworten
  • 0x1032
  • 0x1016
  • 0x1064
  • 0x1014

Frage 20

Frage
What value ends up in EAX after the following code is executed?
Antworten
  • 48 (decimal) or 00110000 (binary) or 0x30 (hex)
  • 50 (decimal) or 00110010 (binary) or 0x32 (hex)
  • 46 (decimal) or 00101110 (binary) or 0x2E (hex)
  • 52 (decimal) or 00110100 (binary) or 0x34 (hex)

Frage 21

Frage
Two computers A and B with a cache in the CPU chip differ only in that A has an L2 cache and B does not. Which of the following are possible?
Antworten
  • 1 and 2 only
  • 1 only
  • 2 only
  • 2 and 3 only

Frage 22

Frage
Which of the following code snippets is fastest ? Assume n is very large(more than ten thousand)
Antworten
  • for(k=0; k<n; k+=16) for(l=0; l<n; l+=16) for(j=0;j<16;j+=1) for(i=0;i<16;i+=1) a[i+l][j+k] = b[j+k][i+l];
  • two or more of the above are equivalently the fastest
  • for(j=0;j<n;j+=1) for(i=0;i<n;i+=1) a[i][j] = b[j][i];
  • for(i=0;i<n;i+=1) for(j=0;j<n;j+=1) a[i][j] = b[j][i];

Frage 23

Frage
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Antworten
  • for(i=0;i<n;i+=1) for(j=0;j<n;j+=1) a[i][j] = b[j][i];
  • for(j=0;j<n;j+=1) for(i=0;i<n;i+=1) a[i][j] = b[j][i
  • for(k=0; k<n; k+=16) for(l=0; l<n; l+=16) for(j=0;j<16;j+=1) for(i=0;i<16;i+=1) a[i+l][j+k] = b[i+l][j+k];
  • two or more of the above are equivalently the fastest

Frage 24

Frage
Good software design includes writing procedures for code you might otherwise repeat in-line. Pulling code into procedures involves call/return overhead; how else can it HURT your program's performance and/or your compiler's ability to optimize your code?
Antworten
  • more chance of compiler having to worry about aliasing and side effects
  • fewer opportunities for pipeline-level parallelism
  • worse instruction cache hit rate
  • fewer opportunities for loop unrolling

Frage 25

Frage
Good software design includes writing procedures for code you might otherwise repeat in-line. Pulling code into procedures can help some branch predictors; how else can it IMPROVE your program’s performance and/or your compiler’s ability to optimize your code?
Antworten
  • more opportunities for loop unrollin
  • less chance of compiler having to worry about aliasing and side effects
  • more opportunities for pipeline-level parallelism
  • better instruction cache hit rate

Frage 26

Frage
Consider a direct-mapped cache with 256 sets and 16 byte blocks. In this cache the address 0x12345 maps to the same set as which of the following addresses?
Antworten
  • 0x02345
  • 0x22244
  • 0x12354
  • 0x12040

Frage 27

Frage
Parallel processing mechanisms to achieve parallelism in uniprocessor system are:
Antworten
  • All of the above
  • Multiple function units
  • Parallelism and pipelining within CPU
  • Multiprogramming and time sharing

Frage 28

Frage
This is an example of?
Antworten
  • Hybrid system
  • shared memory UMA
  • Distributed memory architecture
  • Shared memory NUMA

Frage 29

Frage
This is an example of? (IMAGE)
Antworten
  • None
  • Loop unrolling
  • Loop fusion
  • Loop fission

Frage 30

Frage
This is an example of?
Antworten
  • Loop fission
  • Loop fusion
  • None
  • Loop unrolling

Frage 31

Frage
Program take as input a collection of relocatable object files and command-line arguments and generate as output a fully linked executable object file that can be loaded and run:
Antworten
  • Static linker
  • Dynamic linker
  • Both
  • None

Frage 32

Frage
... involve identifying a computation that is performed multiple times (e.g., within a loop), but such that the result of the computation will not change.
Antworten
  • Side effect
  • Code motion
  • Loop unrollin
  • Memory aliasing

Frage 33

Frage
... construct encloses code, forming a parallel region.
Antworten
  • Parallel
  • Serial

Frage 34

Frage
... is the default schedule type. Upon entering the loop, each thread independently decides which chunk of the loop they will process.
Antworten
  • static
  • dynamic
  • runtime
  • guided

Frage 35

Frage
By default, OpenMP _____ assigns loop iterations to threads. When the parallel for block is entered, it assigns each thread the set of loop iterations it is to execute?
Antworten
  • static
  • dynamic
  • runtime
  • auto

Frage 36

Frage
The _______ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Antworten
  • single
  • barrier
  • nowait
  • private
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

BWL-Theorie: Bücher der Buchhaltung
Julian 1108
Kalter Krieg
Anina Hagi
Stilmittel mit Wirkung & Beispiel
Antonia C
GPSY ALPS
hf.meyer
Vetie - Biochemie
Fioras Hu
Vetie - Histo & Embryo II 2017
Fioras Hu
BAS 2 - Lernquiz
B G
Vetie Pharma Datum unbekannt Karteikarten
Alina Stumpf
Steop Hist Fragen
Adrienne Tschaudi
Innere Pferd Vetie
Anne Käfer
Milchkunde 2019 - Vetie
Peter Christian Ponn