Mudanças entre as edições de "PRG29002-2015-2-Aval1B"
Ir para navegação
Ir para pesquisar
m (moveu Professores:FGHIJ para PRG29002-2015-2-Aval1B) |
|||
(11 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 73: | Linha 73: | ||
printf("Valor de soma = %d e i= %d\n", soma,i); | printf("Valor de soma = %d e i= %d\n", soma,i); | ||
} | } | ||
+ | </syntaxhighlight> | ||
− | + | soma=_______ | |
− | + | i=_____ | |
− | |||
− | |||
=Questão 4= | =Questão 4= | ||
Linha 100: | Linha 99: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | soma=______ | ||
x=_____ | x=_____ | ||
+ | |||
+ | =Questão 5= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | /* indicar o valor impresso das variáveis */ | ||
+ | #include <stdio.h> | ||
+ | |||
+ | main () | ||
+ | { | ||
+ | int i,x,soma=0; | ||
+ | |||
+ | for (x=0,i=0;i<5;i++) { | ||
+ | switch(i) { | ||
+ | case 3: | ||
+ | soma += i; | ||
+ | break; | ||
+ | case 1: | ||
+ | i++; | ||
+ | case 4: | ||
+ | soma = i++; | ||
+ | default: | ||
+ | soma=0; | ||
+ | break; | ||
+ | } | ||
+ | x = x + i; | ||
+ | } | ||
+ | printf("Valor de soma = %d x=%d\n", soma,x); | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | x=_____ | ||
+ | |||
+ | soma=_______ | ||
+ | |||
+ | =Questão 6= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | /* indicar o valor impresso das variáveis */ | ||
+ | #include <stdio.h> | ||
+ | |||
+ | main () | ||
+ | { | ||
+ | int i,j,soma=12; | ||
+ | |||
+ | for (i=0;i<2;i++) { | ||
+ | j=1; | ||
+ | while(j<3) { | ||
+ | soma = soma + 1; | ||
+ | j++; | ||
+ | if(j==2) break; | ||
+ | } | ||
+ | } | ||
+ | printf("Valor de soma = %d\n", soma); | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | j=_____ | ||
+ | |||
+ | soma=_____ | ||
+ | |||
+ | =Questão 7= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | /* indicar o valor impresso das variáveis */ | ||
+ | #include <stdio.h> | ||
+ | |||
+ | int x=3; | ||
+ | |||
+ | int alfa() | ||
+ | { | ||
+ | x=x+1; | ||
+ | return x; | ||
+ | } | ||
+ | |||
+ | main () | ||
+ | { | ||
+ | int x=10,y; | ||
+ | |||
+ | y=alfa()+1+x; | ||
+ | printf("Valor de x = %d y= %d \n", x,y); | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | x=____ | ||
+ | |||
+ | y=____ | ||
+ | |||
+ | |||
+ | =Questão 8= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | /* indicar o valor impresso das variáveis */ | ||
+ | #include <stdio.h> | ||
+ | |||
+ | int alfa(int i) | ||
+ | { | ||
+ | if (i!=2) return 0; else return 1; | ||
+ | } | ||
+ | |||
+ | main () | ||
+ | { | ||
+ | int j=0, soma=1; | ||
+ | |||
+ | do { | ||
+ | soma = alfa(j) + alfa(j+1) + soma; | ||
+ | j++; | ||
+ | } while (j<2); | ||
+ | printf("Valor de soma = %d\n", soma); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | </syntaxhighlight> | ||
soma=______ | soma=______ | ||
+ | |||
+ | |||
+ | =Questão 9= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | #include <stdio.h> | ||
+ | |||
+ | int beta (char x) | ||
+ | { | ||
+ | switch (x) { | ||
+ | case '!': return 1; | ||
+ | case 'B': return 2; | ||
+ | default: return 3; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int alfa(int x) | ||
+ | { | ||
+ | char z; | ||
+ | int w; | ||
+ | |||
+ | if(!(x==2)) z='A'; else z='!'; | ||
+ | if ((w=beta(z))==1) | ||
+ | return w+1; | ||
+ | else | ||
+ | return w; | ||
+ | } | ||
+ | main() | ||
+ | { | ||
+ | printf("valor = %d\n", alfa(2)+2); | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Valor impresso no printf = _________ | ||
+ | |||
+ | =Questão 10= | ||
+ | |||
+ | <syntaxhighlight lang=c> | ||
+ | #include <stdio.h> | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | int i,j,k,soma=2, delta=1; | ||
+ | |||
+ | j=0; | ||
+ | for (i=0;i<2;i++) { | ||
+ | for (;j<2;j++) { | ||
+ | if (j==0) | ||
+ | continue; | ||
+ | soma = soma + 1; | ||
+ | delta = delta + soma * 2; | ||
+ | |||
+ | } | ||
+ | } | ||
+ | printf("Valor de delta é %d\n",delta); | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | soma = ______ | ||
+ | |||
+ | delta = _______ |
Edição atual tal como às 13h25min de 19 de novembro de 2015
Nome:_____________________________________________
Questão 1
#include <stdio.h>
main ()
{
int x,y,z;
x=2;
y=6;
y=y%x;
z = ( ( x-1 || y>5 ) && !0 ) * 12;
printf ("z=%d\n",z);
}
Z = ______
Questão 2
#include <stdio.h>
main ()
{
int x,y;
x=8;
y=2;
if (x>5 && !(y==1)){
y=x+y;
x++;
if (x>30) y++;
else y--;
y=y+4;
if (y>2) {
if (y==0)
x=0;
else
x=9;
x=x+1;
}
x=x*2;
} else {
y=y*3;
x=y+2;
}
printf("x= %d e y=%d\n",x,y);
}
X=____
y=____
Questão 3
/* indicar o valor impresso das variáveis */
#include <stdio.h>
main ()
{
int i,soma=1;
for (i=4;i>=0;i=i-1)
soma = soma + i;
printf("Valor de soma = %d e i= %d\n", soma,i);
}
soma=_______
i=_____
Questão 4
/* indicar o valor impresso das variáveis */
#include <stdio.h>
main ()
{
int i,j,x=2,soma=2;
for (i=0;i<2;i++) {
for (j=0;j<3;j++)
x=j+i;
soma = soma + i;
}
printf("Valor de soma = %d x=%d i=%d j=%d\n", soma,x,i,j);
}
soma=______
x=_____
Questão 5
/* indicar o valor impresso das variáveis */
#include <stdio.h>
main ()
{
int i,x,soma=0;
for (x=0,i=0;i<5;i++) {
switch(i) {
case 3:
soma += i;
break;
case 1:
i++;
case 4:
soma = i++;
default:
soma=0;
break;
}
x = x + i;
}
printf("Valor de soma = %d x=%d\n", soma,x);
}
x=_____
soma=_______
Questão 6
/* indicar o valor impresso das variáveis */
#include <stdio.h>
main ()
{
int i,j,soma=12;
for (i=0;i<2;i++) {
j=1;
while(j<3) {
soma = soma + 1;
j++;
if(j==2) break;
}
}
printf("Valor de soma = %d\n", soma);
}
j=_____
soma=_____
Questão 7
/* indicar o valor impresso das variáveis */
#include <stdio.h>
int x=3;
int alfa()
{
x=x+1;
return x;
}
main ()
{
int x=10,y;
y=alfa()+1+x;
printf("Valor de x = %d y= %d \n", x,y);
}
x=____
y=____
Questão 8
/* indicar o valor impresso das variáveis */
#include <stdio.h>
int alfa(int i)
{
if (i!=2) return 0; else return 1;
}
main ()
{
int j=0, soma=1;
do {
soma = alfa(j) + alfa(j+1) + soma;
j++;
} while (j<2);
printf("Valor de soma = %d\n", soma);
}
soma=______
Questão 9
#include <stdio.h>
int beta (char x)
{
switch (x) {
case '!': return 1;
case 'B': return 2;
default: return 3;
}
}
int alfa(int x)
{
char z;
int w;
if(!(x==2)) z='A'; else z='!';
if ((w=beta(z))==1)
return w+1;
else
return w;
}
main()
{
printf("valor = %d\n", alfa(2)+2);
}
Valor impresso no printf = _________
Questão 10
#include <stdio.h>
main()
{
int i,j,k,soma=2, delta=1;
j=0;
for (i=0;i<2;i++) {
for (;j<2;j++) {
if (j==0)
continue;
soma = soma + 1;
delta = delta + soma * 2;
}
}
printf("Valor de delta é %d\n",delta);
}
soma = ______
delta = _______