SDP10_Final_Exam_Part2

Descrição

final_part2_sdp10
Good Guy Beket
Quiz por Good Guy Beket, atualizado more than 1 year ago
Good Guy Beket
Criado por Good Guy Beket quase 6 anos atrás
648
7

Resumo de Recurso

Questão 1

Questão
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?
Responda
  • 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

Questão 2

Questão
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?
Responda
  • static
  • runtime
  • dynamic
  • auto

Questão 3

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

Questão 4

Questão
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*/ ... ...
Responda
  • Loop Unrolling
  • Loop fission
  • none
  • Loop fusion

Questão 5

Questão
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) { ... ... }
Responda
  • Loop fission
  • Code motion
  • Loop unrolling
  • Loop blocking

Questão 6

Questão
In given two C modules which rule will Unix linker use to resolve multiple symbol definition?
Responda
  • 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

Questão 7

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

Questão 8

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

Questão 9

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

Questão 10

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

Questão 11

Questão
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?
Responda
  • 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

Questão 12

Questão
This is an example of?
Responda
  • Parrallel processing
  • Serial processing
  • none of the above
  • Linear processing

Questão 13

Questão
This is an example of?
Responda
  • Parallel processing
  • Serial processing
  • none of the above
  • Linear processing

Questão 14

Questão
The code ( a && b ) || (!a && !b) implements —
Responda
  • Equality
  • MUX
  • Adder
  • Set membership

Questão 15

Questão
Consider the following code fragment (IMAGE) int a; int b; int main(int argc, char * argv[]){ int x; int y; … /* some code*/ }
Responda
  • 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

Questão 16

Questão
Compare the size of int and int*
Responda
  • each one of the above depends on the computer
  • int has fewer bits
  • int* has fewer bits
  • they have the same number of bits

Questão 17

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

Questão 18

Questão
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)
Responda
  • 0x1032
  • 0x1016
  • 0x1064
  • 0x1010

Questão 19

Questão
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
Responda
  • 0x1032
  • 0x1016
  • 0x1064
  • 0x1014

Questão 20

Questão
What value ends up in EAX after the following code is executed?
Responda
  • 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)

Questão 21

Questão
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?
Responda
  • 1 and 2 only
  • 1 only
  • 2 only
  • 2 and 3 only

Questão 22

Questão
Which of the following code snippets is fastest ? Assume n is very large(more than ten thousand)
Responda
  • 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];

Questão 23

Questão
Which of the following code snippets is fastest? Assume n is very large (more than ten thousand).
Responda
  • 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

Questão 24

Questão
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?
Responda
  • 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

Questão 25

Questão
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?
Responda
  • 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

Questão 26

Questão
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?
Responda
  • 0x02345
  • 0x22244
  • 0x12354
  • 0x12040

Questão 27

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

Questão 28

Questão
This is an example of?
Responda
  • Hybrid system
  • shared memory UMA
  • Distributed memory architecture
  • Shared memory NUMA

Questão 29

Questão
This is an example of? (IMAGE)
Responda
  • None
  • Loop unrolling
  • Loop fusion
  • Loop fission

Questão 30

Questão
This is an example of?
Responda
  • Loop fission
  • Loop fusion
  • None
  • Loop unrolling

Questão 31

Questão
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:
Responda
  • Static linker
  • Dynamic linker
  • Both
  • None

Questão 32

Questão
... 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.
Responda
  • Side effect
  • Code motion
  • Loop unrollin
  • Memory aliasing

Questão 33

Questão
... construct encloses code, forming a parallel region.
Responda
  • Parallel
  • Serial

Questão 34

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

Questão 35

Questão
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?
Responda
  • static
  • dynamic
  • runtime
  • auto

Questão 36

Questão
The _______ directive causes threads encountering the barrier to wait until all the other threads in the same team have encountered the barrier.
Responda
  • single
  • barrier
  • nowait
  • private

Semelhante

AÇÃO PENAL
julianodanielp
Como Transformar Mapas Mentais em Suporte
Alessandra S.
Vocabulário Jurídico
Alessandra S.
Resumo de Biologia - Ciclos da Vida e Evolução
Larissa Guimarães
Direito Constitucional
GoConqr suporte .
Revisão Para oENEM 2016
GoConqr suporte .
BIOLOGIA - SEMANA 1
Camila Tais
Direito Constitucional - Direitos e Garantias Fundamentais
aline.costaa
SIMULADÃO EA-HSG TRADIÇÕES, USOS, COSTUMES E LINGUAGEM DO MAR
isac rodrigues
Guia - Projeto de Pesquisa e ABNT
Joana Meira
Princípios Fundamentais
Lavs Agah