PRUEBAS.pdf

April 30, 2019 | Author: Alber Mauricio | Category: Computer Science, Software, Notation, Computer Architecture, Digital & Social Media
Share Embed Donate


Short Description

Download PRUEBAS.pdf...

Description

LAS PREGUNTAS QUE TIENE 0/1 YA ESTAN CORREGUIDAS CAPÍTULO 1

Pregunta 1 0 / 1 ptos.

The English language is an example of a programming language

a natural language

a machine language

Pregunta 2 1 / 1 ptos.

A high-level language is a type of programming language

a language spoken by the high society

a language spoken by mountain tribes

IncorrectoPregunta Incorrecto Pregunta 3 0 / 1 ptos.

A compiler is an alternative name for a processor

a computer program designed to translate programs from a machine language into a high-level language

a computer program designed to translate programs from a high-level language into a machine language

Pregunta 4 1 / 1 ptos.

Data of type int is an integral number

an internal number

an integer number

a fractional number

Pregunta 5 1 / 1 ptos.

The following string: ThisIsTheNameOfTheVariable

can be used as a variable name

cannot be used as a variable name

Pregunta 6 1 / 1 ptos.

The following string: 101Dalmatians

cannot be used as a variable name

can be used as a variable name

Pregunta 7 1 / 1 ptos.

What is the value of the var variable after executing the following snippet of code: int var var var

var; = 100; = var + 100; = var + var;

400

100

300

200

Pregunta 8 1 / 1 ptos.

A keyword is a word that cannot be used in the meaning other than defined in the language standard functions as a password needed to launch a program

is the most important word in a program

Pregunta 9 1 / 1 ptos.

A comment placed anywhere inside the code is a syntactic equivalent of a space

a keyword

a number

Pregunta 10 1 / 1 ptos.

Every variable has the following attributes: type, name, value

variability, stability, readability

header, footer, setter

CAPÍTULO 2

Pregunta 1 1 / 1 ptos.

Which of the following strings is a proper integer number (in the “C” language sense)?

123456

123,456

123.456

123_456

IncorrectoPregunta 2 0 / 1 ptos.

What is the value of the following integer literal? 08

8 1000 the literal is invalid 10

Pregunta 3 1 / 1 ptos.

What is the value of the following integer literal? 0x8

10 8

the literal is invalid 1000

Pregunta 4 1 / 1 ptos.

Which of the following strings is a valid variable name? Monte_Carlo Monte Carlo Monte-Carlo Monte@Carlo

Pregunta 5 1 / 1 ptos.

Which of the following strings is an invalid variable name?  _0_ 0_  ___  _0 Pregunta 6 1 / 1 ptos.

Is the following declaration valid? int var, var;

No

Yes

IncorrectoPregunta 7 0 / 1 ptos.

What is the value of the var variable at the end of the following snippet? int var var var var var

var; = 2; = var = var = var = var

* + / %

var; var; var; var;

16 8 0 1

IncorrectoPregunta 8 0 / 1 ptos.

What is the value of the var variable at the end of the following snippet? int var; var = 2; var = var var = var /* var = var var = var */

1

* var; + var; / var; % var;

8 16 0

Pregunta 9 1 / 1 ptos.

Which of the following strings is a proper floating-point number (in the ”C” language sense)? 123,456 123.456 123456 123_456

IncorrectoPregunta 10 0 / 1 ptos.

What is the value of the following floating-point literal? 8765E-2

8.765 87.65 876.5 0.8765

IncorrectoPregunta 11 0 / 1 ptos.

What is the value of the x variable at the end of the following snippet? int x; x = 1 / 2;

0 0.5 2 1

IncorrectoPregunta 12 0 / 1 ptos.

What is the value of the x variable at the end of the following snippet? int x; x = 1 / 2 * 3; /***

2 1.5 0 1

Pregunta 13 1 / 1 ptos.

What is the value of the x variable at the end of the following snippet?

float x; x = 1. / 2 * 3; /***

2 1.5 0 1

IncorrectoPregunta 14 0 / 1 ptos.

What is the value of the  k variable at the end of the following snippet? int i,j,k; i = 4; j = 5; --i; k = i * j;

15 18 16 12

Pregunta 15 1 / 1 ptos.

What is the value of the k variable at the end of the following snippet?

int i,j,k; i = 4; j = 5; ++j; k = i * j;

24 18 21 28

IncorrectoPregunta 16 0 / 1 ptos.

What is the value of the k variable at the end of the following snippet? int i,j,k; i j k k k

= 3; = -3; = i * j; += j; /= i;

4 8 -4 8

Pregunta 17 1 / 1 ptos.

What is the value of the c variable at the end of the following snippet?

char c; c = '\';

the assignment is invalid and causes a compilation error  \0  \ '

IncorrectoPregunta 18 0 / 1 ptos.

What is the value of the c variable at the end of the following snippet? char c; c = 'a'; c -= ' ';

the assignment is invalid and causes a compilation error  \0 A a

Pregunta 19 1 / 1 ptos.

What is the value of the k variable at the end of the following snippet? int i,j,k; i = 3;

j = -3; k = (i >= i) + (j j);

2 1 3 0

IncorrectoPregunta 20 0 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i,j,k; i = 2; j = -2; if(i) i--; if(j) j++; k = i * j; printf("%d",k); return 0; }

1 -2 -1 2

CAPÍTULO 3

Pregunta 1 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j, k; i = -1; j = 1; if(i) j--; if(j) i++; k = i * j; printf("%d",k); return 0; }

the program outputs2

the program outputs 0

the program outputs -1

the program outputs 1

Pregunta 2 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j, k; i = 0; j = 0; if(j) j--; else

 

i++; if(i) i--; else j++;

k = i + j; printf("%d",k); return 0; }

the program outputs 1

the program outputs -1

the program outputs 0

the program outputs 2

Pregunta 3 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j, k; i = 2; j = 3; if(j) j--; else if(i) i++; else j++; if(j) i--; else if(j) j++; else j = 0;

k = i + j; printf("%d",k); return 0; }

the program outputs 1

the program outputs 2

the program outputs 3

the program outputs 0

Pregunta 4 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { double x = -.1; int i = x; printf("%d",i); return 0; }

the program outputs 0.100000

the program outputs 0

the program outputs -0.100000

the program outputs -1

Pregunta 5 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { float x,y; int i,j; x = 1.5; y = 2.0; i = 2; j = 3; x = x * y + i / j; printf("%f",x); return 0; }

the program outputs 1.000000

the program outputs 2.000000

the program outputs 0.000000

the program outputs 3.000000

Pregunta 6 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { float x,y; int i,j; x = 1.5; y = 2.0; i = 2; j = 4; x = x * y + (float)i / j; printf("%f",x); return 0; }

the program outputs 3.000000

the program outputs 4.000000

the program outputs 2.000000

the program outputs 3.500000

Pregunta 7 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i; i = 1; while(i < 16) i *= 2; printf("%d",i); return 0; }

the program outputs 16

the program outputs 4

the program outputs 8

the program outputs 32

Pregunta 8 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j; i = 1; j = 1; while(i < 16) { i += 4; j++; } printf("%d",j); return 0; }

the program outputs 4

the program outputs 5

the program outputs 6

the program outputs 7

Pregunta 9 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i = 7, j = i - i; while(i) { i /= 2; j++; } printf("%d",j); return 0; }

the program outputs 0

the program outputs 2

the program outputs 3

the program outputs 1

Pregunta 10 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i = 7, j = i - i; while(!i) { i /= 2; j++; } printf("%d",j); return 0; }

the program outputs 3

the program outputs 0

the program outputs 2

the program outputs 1

Pregunta 11 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j = 1; for(i = 11; i > 0; i /= 3) j++; printf("%d",j); return 0; }

the program outputs 2

the program outputs 4

the program outputs 5

the program outputs 3

Pregunta 12 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i, j = 0; for(i = 0; !i ; i++) j++; printf("%d",j); return 0; }

the program outputs 0

the program outputs 1

the program outputs 2

the program outputs 3

Pregunta 13 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i = 1, j = -2; for(;;) { i *= 3; j++; if(i > 30) break; } printf("%d",j); return 0; }

the program outputs 1

the program outputs 0

the program outputs 3

the program outputs 2

Pregunta 14

1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i = 1, j = -2, k; k = (i >= 0) && (j >= 00) || (i = 00) && (i = 00) && !(i a = 2; x->b = y; y->a = 4; y->b = x; printf("%d",x->b->b->b->a); free(x); free(y); return 0; }

the program outputs 4

the program outputs 2

the program outputs 1

the program outputs 3

Pregunta 18 1 / 1 ptos.

What happens if you try to compile and run this program? #include #include struct S { int a; struct S *b; }; int main(void) { struct S *x = (struct S*) malloc(sizeof(struct S)); struct S *y = (struct S*) malloc(sizeof(struct S));

struct S *p; x->a = 2; x->b = y; y->a = 4; y->b = x; p = x; p = p->b->b->b->b; printf("%d",p->a); return 0; }

the program outputs 3

the program outputs 4

the program outputs 1

the program outputs 2

Pregunta 19 1 / 1 ptos.

What happens if you try to compile and run this program? #include struct S { int a[2]; }; int main(void) { struct S S[2]; int i; for(i = 0; i < 2; i++) S[i].a[1-i] = 4 * !i; printf("%d",S[0].a[1]); return 0; }

the program outputs 1

the program outputs 4

the program outputs 3

the program outputs 2

Pregunta 20 1 / 1 ptos.

What happens if you try to compile and run this program? #include struct S { char *p; }; int main(void) { char *p = "abcd"; struct S S[2]; int i; for(i = 0; i < 2; i++) S[i].p = p + i; printf("%c",S[1].p[0]); return 0; }

the program outputs c

the program outputs b

the program outputs d

the program outputs a CAPÍTULO 6

Pregunta 1 1 / 1 ptos.

What happens if you try to compile and run this program? void f(void) { } int main(void) { int i; i = f(); printf("%d",i); return 0; }

the program outputs nul

the program outputs 0

the program outputs NULL

compilation fails

Pregunta 2 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(void) { } int main(void) { int i; i = f(); printf("%d",i); return 0; }

the compilation fails

the program outputs 0

the program outputs NULL

the program outputs an unpredictable value

Pregunta 3 1 / 1 ptos.

What happens if you try to compile and run this program? #include void f(int i) { i++; } int main(void) { int i = 1; f(i); printf("%d",i); return 0; }

the program outputs 1

the compilation fails

the program outputs an unpredictable value

the program outputs 2

Pregunta 4 1 / 1 ptos.

What happens if you try to compile and run this program?

#include int f(int i) { ++i; return i; } int main(void) { int i = 1; i = f(i); printf("%d",i); return 0; }

the compilation fails

the program outputs 1

the program outputs an unpredictable value

the program outputs 2

Pregunta 5 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(int i) { return ++i; } int main(void) { int i = 0; i = f(f(i)); printf("%d",i); return 0; }

the program outputs 2

the program outputs 0

the compilation fails

the program outputs 1

Pregunta 6 1 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { int i = 0; { int i = 1; main.i = i; } printf("%d",i); return 0; }

the program outputs 0

the program outputs 2

compilations fails

the program outputs 1

Pregunta 7 1 / 1 ptos.

What happens if you try to compile and run this program?

#include int i = 0; void f(void) { int i = 1; } int main(void) { int i = 2; f(); printf("%d",i); return 0; }

the compilation fails

the program outputs 0

the program outputs 2

the program outputs 1

Pregunta 8 1 / 1 ptos.

What happens if you try to compile and run this program? #include int i = 0; void f(void) { int i = 1; } int main(void) { f(); printf("%d",i); return 0; }

the compilation fails

the program outputs 2

the program outputs 0

the program outputs 1

Pregunta 9 1 / 1 ptos.

What happens if you try to compile and run this program? #include int i = 1; int *f(void) { return &i; } int main(void) { int i = 0; i = *f(); printf("%d",i); return 0; }

the program outputs 0

the program outputs 2

the compilation fails

the program outputs 1

Pregunta 10 1 / 1 ptos.

What happens if you try to compile and run this program? #include int i = 2; int *f(void) { return &i; } int main(void) { int *i; i = f(); printf("%d",++(*i)); return 0; }

the compilation fails

the program outputs 1

the program outputs 2

the program outputs 3

Pregunta 11 1 / 1 ptos.

What happens if you try to compile and run this program? #include int i = 0; int *f(int *i) { (*i)++; return i; } int main(void) { int i = 1; i = *f(&i); printf("%d",i); return 0; }

the compilation fails

the program outputs 2

the program outputs 1

the program outputs 0

Pregunta 12 1 / 1 ptos.

What happens if you try to compile and run this program? #include struct S { int S; }; int f(struct S s) { return --s.S; } int main(void) { int i; struct S S = { 2 }; i = f(S); printf("%d",i); return 0; }

the program outputs 2

the program outputs 0

the program outputs 1

the compilation fails

Pregunta 13 1 / 1 ptos.

What happens if you try to compile and run this program? #include struct S { int S; }; int f(struct S *s) { return --s.S; } int main(void) { int i; struct S S = { 2 }; i = f(S); printf("%d",i); return 0; }

the program outputs 2

the program outputs 0

compilation fails

the program outputs 1

Pregunta 14 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(int t[\]) { return t[0\] + t[2\]; } int main(void) { int i,a[\] = { -2,-1,0,1,2 };

i = f(a + 2); printf("%d",i); return 0; }

the program outputs 1

the program outputs 2

the compilation fails

the program outputs 0

Pregunta 15 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(int t[\][\]) { return t[0\][0\] + t[1\][0\]; } int main(void) { int i,a[2\][2\] = { {-2,-1},{1,2} }; i = f(a + 2); printf("%d",i); return 0; }

the program outputs 2

the program outputs 1

the compilation fails

the program outputs 0

Pregunta 16 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(int t[2\][\]) { return t[0\][0\] + t[1\][0\]; } int main(void) { int i,a[2\][2\] = { {-2,-1},{1,2} }; i = f(a + 2); printf("%d",i); return 0; }

the compilation fails

the program outputs 2

the program outputs 0

the program outputs 1

IncorrectoPregunta 17 0 / 1 ptos.

What happens if you try to compile and run this program? #include int f(char t[\]) { return t[1\] - t[0\]; } int main(void) { int i = 2; i -= f("ABDGK" + 1);

 

printf("%d",i); return 0; }

the program outputs 0

the program outputs 2

the compilation fails

the program outputs 1

Pregunta 18 1 / 1 ptos.

What happens if you try to compile and run this program? #include int f(char t[\]) { return t[0\] - t[-1\]; } int main(void) { int i = 2; i -= f("ABDGK" + 1); printf("%d",i); return 0; }

the program outputs 2

the compilation fails

the program outputs 0

the program outputs 1

Pregunta 19 1 / 1 ptos.

What happens if you try to compile and run this program? #include #include void f(char *s,int i) { *(s + i) = '\0'; } int main(void) { char a[\] = { 'a','b','c','d' }; f(a[1\],1); printf("%d",strlen(a)); return 0; }

the program outputs 2

the program outputs 0

the program outputs 1

the compilation fails

Sin responderPregunta 20 0 / 1 ptos.

What happens if you try to compile and run this program? #include #include void f(char *s,int i) { *(s + i) = '\0'; } int main(void) {

char a[\] = { 'a','b','c','d' }; f(a+1,1); printf("%d",strlen(a)); return 0; }

the program outputs 2

the program outputs 1

the compilation fails

the program outputs 0

CAPÍTULO 7 Pregunta 1 The following string:

0.5 / 1 ptos.

JohnDoe

is a valid file name in MS Windows systems Unix/Linux systems

Pregunta 2 Unix/Linux systems treat the following names JohnDoe johndoe

1 / 1 ptos.

as different file names as identical file names

IPregunta 3 The following string:

0 / 1 ptos.

HomeDir/HomeFile

is a valid file name in: MS Windows systems Unix/Linux systems

Pregunta 4 The following string:

0 / 1 ptos.

D:\USERDIR\johndoe.txt

is a valid file name in MS Windows systems Unix/Linux systems

Pregunta 5 What happens if you try to compile and run this program? int main(void) { FILE *f; f = fopen("file","wb"); printf("%d",f != NULL); fclose(f); return 0; }

the program outputs 1 the execution fails

1 / 1 ptos.

the compilation fails the program outputs 0

Pregunta 6 What happens if you try to compile and run this program?

1 / 1 ptos.

#include int main(void) { FILE f; f = fopen("file","wb"); printf("%d",f != NULL); fclose(f); return 0; }

the program outputs 1 the compilation fails the program outputs 0 the execution fails

Pregunta 7 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f; f = fopen("file","wb"); printf("%d",f != NULL); fclose(f); return 0; }

the program outputs 2

the program outputs 1 the compilation or execution fails the program outputs 0

Pregunta 8 What happens if you try to compile and run this program?

1 / 1 ptos.

#include int main(void) { int i; i = fprintf(stdin,"Hello!"); printf("%d",i == EOF); return 0; }

the program outputs 1 the program outputs 0 the compilation or execution fails the program outputs 2

Pregunta 9 What happens if you try to compile and run this program? #include int main(void) { int i; i = fprintf(stderr,"Hello!"); printf("%d",i == EOF); return 0; }

the program outputs 2 to the stdout stream the program outputs 1 to the stdout stream

1 / 1 ptos.

the program outputs 0 to the stdout stream the compilation or execution fails

IncorrectoPregunta 10 0 / 1 ptos.

What happens if you try to compile and run this program? #include int main(void) { FILE *f; int i = fprintf(f,"Hello!"); printf("%d",i == EOF); return 0; }

the program outputs 1 the program outputs 2 the program outputs 0 the compilation or execution fails

Pregunta 11 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i = fprintf(f,"Hello!"); printf("%d",i != EOF); return 0; }

the compilation or execution fails the program outputs 1

the program outputs 2 the program outputs 0

Pregunta 12 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i = fputs(f,"Hello!"); printf("%d",i != EOF); fclose(f); return 0; }

the program outputs 1 the program outputs 2 the program outputs 0 the compilation or execution fails

Pregunta 13 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i = fputs("Hello!",f); printf("%d",i != EOF); return 0; }

the program outputs 1

the compilation or execution fails the program outputs 2 the program outputs 0

1 / 1 ptos. Pregunta 14 What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { char s[20]; FILE *f = fopen("file","w"); int i = fputs("12A",f); fclose(f); f = fopen("file","r"); fgets(s,2,f); puts(s); fclose(f); return 0; }

the program outputs 12 the program outputs 1 the program outputs 12A the compilation or execution fails

1 / 1 ptos. Pregunta 15 What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { char s[20]; FILE *f = fopen("file","w"); int i = fputs("12A",f);

 

fclose(f); f = fopen("file","r"); fgets(s,20,f); puts(s); fclose(f); return 0; }

the program outputs 12A the program outputs 1 the compilation or execution fails the program outputs 12

Pregunta 16 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i; fputs("12A",f); fclose(f); f = fopen("file","r"); fseek(f,0,SEEK_END); i = ftell(f); fclose(f); printf("%d",i); return 0; }

the program outputs 2 the compilation or execution fails the program outputs 3 the program outputs 1

Pregunta 17 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i; fputs("12A",f); fclose(f); f = fopen("file","r"); fseek(f); i = ftell(f,0,SEEK_END); fclose(f); printf("%d",i); return 0; }

the program outputs 1 the program outputs 2 the program outputs 3 the compilation or execution fails

Pregunta 18 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); int i; fputs("12A",f); fclose(f); f = fopen("file","r"); fscanf(f,"%d",&i); fclose(f); printf("%d",i); return 0; }

the program outputs 12A the program outputs 1 the compilation or execution fails the program outputs 12

Pregunta 19 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds? #include int main(void) { FILE *f = fopen("file","w"); char c; fputs("12A",f); fclose(f); f = fopen("file","r"); fscanf(f,"%c",&c); fclose(f); printf("%c",c); return 0; }

the program outputs 12A the program outputs 12 the compilation or execution fails the program outputs 1

Pregunta 20 What happens if you try to compile and run this program? #include int main(void) { FILE *f = fopen("file","w");

1 / 1 ptos.

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF