14.03.2015 Views

Apostila C da UFMG - Universidade do Minho

Apostila C da UFMG - Universidade do Minho

Apostila C da UFMG - Universidade do Minho

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

int x;<br />

for ( x = 35 ; x > 0 ; x/=3)<br />

printf("%d " , x) ;<br />

a. 35 11 3 1<br />

b. 11 3 1<br />

c. 11 3 1 0<br />

d. 35 11 3<br />

e. Nenhuma <strong>da</strong>s opções anteriores<br />

9- Os extratos de código a seguir são equivalentes entre si:<br />

int x = 10;<br />

while (--x > 9)<br />

{<br />

printf("%d", x);<br />

}<br />

e<br />

int x = 10;<br />

<strong>do</strong> {<br />

printf("%d", x);<br />

} while(--x > 9);<br />

a. Ver<strong>da</strong>deiro<br />

b. Falso<br />

10- Sen<strong>do</strong> i declara<strong>do</strong> e inicializa<strong>do</strong> como:<br />

int i = 0;<br />

os seguintes extratos de código:<br />

while (i = 5)<br />

{<br />

printf("%d %d %d \n", i, i+2, i+3);<br />

i = 0;<br />

}<br />

e<br />

if (i = 5) printf ("%d %d %d \n", i, i+2, i+3);<br />

a. São idênticos sob o ponto de vista <strong>do</strong> que imprimem na tela<br />

b. Não imprimem na<strong>da</strong> na tela<br />

c. Têm sintaxe erra<strong>da</strong><br />

d. Um deles imprime 5, 7 e 9 uma única vez e o outro entra em loop, imprimin<strong>do</strong> estes valores<br />

indefini<strong>da</strong>mente<br />

e. Nenhuma <strong>da</strong>s opções anteriores<br />

11- A estrutura <strong>do</strong> switch abaixo é:<br />

switch (t)<br />

{<br />

case t < 10:<br />

printf("Hoje ta' fazen<strong>do</strong> muito frio");<br />

break;<br />

case t < 25:<br />

printf("A temperatura está agra<strong>da</strong>vel");<br />

break;<br />

default:<br />

printf("Hoje ta' quente pra chuchu");<br />

}<br />

a. Váli<strong>da</strong> na linguagem C<br />

b. Não váli<strong>da</strong> na linguagem C<br />

12- O laço for a seguir<br />

Pág. 34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!