• No results found

PRUEBAS.pdf

N/A
N/A
Protected

Academic year: 2021

Share "PRUEBAS.pdf"

Copied!
77
0
0

Loading.... (view fulltext now)

Full text

(1)

LAS PREGUNTAS QUE TIENE 0/1 YA ESTAN CORREGUIDAS

LAS PREGUNTAS QUE TIENE 0/1 YA ESTAN CORREGUIDAS

CAPÍTULO 1 CAPÍTULO 1 Pregunta 1 Pregunta 1 0 / 1 ptos. 0 / 1 ptos.

The English language is an example of The English language is an example of a programming language a programming language a natural language a natural language a machine language a machine language Pregunta 2 Pregunta 2 1 / 1 ptos. 1 / 1 ptos. A high-level language is A high-level language is

a type of programming language a type of programming language

a language spoken by the high society a language spoken by the high society

a language spoken by mountain tribes a language spoken by mountain tribes

Incorrecto

IncorrectoPregunta 3Pregunta 3 0 / 1 ptos.

0 / 1 ptos.

A compiler is A compiler is

an alternative name for a processor an alternative name for a processor

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

(2)
(3)

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

into a machine language Pregunta 4

Pregunta 4 1 / 1 ptos.

1 / 1 ptos.

Data of type

Data of type intint is is

an integral number an integral number an internal number an internal number an integer number an integer number a fractional number a fractional number Pregunta 5 Pregunta 5 1 / 1 ptos. 1 / 1 ptos.

The following string: The following string:

ThisIsTheNameOfTheVariable

ThisIsTheNameOfTheVariable

can be used as a variable name can be used as a variable name

cannot be used as a variable name cannot be used as a variable name

Pregunta 6 Pregunta 6 1 / 1 ptos.

1 / 1 ptos.

The following string: The following string:

101Dalmatians

(4)

cannot be used as a variable name cannot be used as a variable name

can be used as a variable name can be used as a variable name

Pregunta 7 Pregunta 7 1 / 1 ptos.

1 / 1 ptos.

What is the value of the

What is the value of the varvar variable after executing the following snippet of code: variable after executing the following snippet of code: int var; int var; var = 100; var = 100; var = var + 100; var = var + 100;

var = var + var;

var = var + var;

400 400 100 100 300 300 200 200 Pregunta 8 Pregunta 8 1 / 1 ptos. 1 / 1 ptos. A

A keywordkeyword is a word that is a word that

cannot be used in the meaning other than defined in the language standard cannot be used in the meaning other than defined in the language standard functions as a password needed to launch a program

(5)

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

(6)

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

(7)

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?

(8)

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 = 2;

var = var * var; var = 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 / var; var = var % var;

*/

(9)

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

(10)

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.

(11)

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.

(12)

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 = 3; j = -3; k = i * j; k += j; k /= i; 4 8 -4 8 Pregunta 17 1 / 1 ptos.

(13)

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;

(14)

j = -3; k = (i >= i) + (j <= j) + (i == j) + (i > j); 2 1 3 0 IncorrectoPregunta 20 0 / 1 ptos.

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

#include <stdio.h> 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

(15)

CAPÍTULO 3 Pregunta 1 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int main(void) { int i, j, k; i = 0; j = 0; if(j) j--; else

(16)

  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 <stdio.h> 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;

(17)

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 <stdio.h> 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

(18)

Pregunta 5 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> 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; }

(19)

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 <stdio.h> 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

(20)

Pregunta 8 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int main(void) { int i = 7, j = i - i; while(i) { i /= 2; j++; } printf("%d",j); return 0; }

(21)

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 <stdio.h> 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

(22)

Pregunta 11 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int main(void) { int i, j = 0; for(i = 0; !i ; i++) j++; printf("%d",j); return 0; }

(23)

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 <stdio.h> 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

(24)

1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 1, j = -2, k; k = (i >= 0) && (j >= 00) || (i <= 0) && (j <= 0); printf("%d",k); return 0; }

the program outputs 3

the program outputs 0

the program outputs 1

the program outputs 2

Pregunta 15 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 1, j = -2, k; k = (i >= 0) || (j >= 00) && (i <= 0) || (j <= 0); printf("%d",k); return 0; }

the program outputs 2

(25)

the program outputs 0

the program outputs 3

Pregunta 16 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

int i = 1, j = -2, k;

k = !(i >= 0) || !(j >= 00) && !(i <= 0) || !(j <= 0); printf("%d",k);

return 0; }

the program outputs 1

the program outputs 3

the program outputs 0

the program outputs 2

Pregunta 17 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 1, j = 0, k; k = i & j; k |= !!k; printf("%d",k);

(26)

return 0; }

the program outputs 1

the program outputs 2

the program outputs 3

the program outputs 0

Pregunta 18 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 1, j = 0, k; k = !i | j; k = !k; printf("%d",k); return 0; }

the program outputs 3

the program outputs 0

the program outputs 2

(27)

Pregunta 19 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 1, j = 0, k; k = (i ^ j) + (!i ^ j) + (i ^ !j) + (!i ^ !j); printf("%d",k); return 0; }

the program outputs 3

the program outputs 2

the program outputs 1

the program outputs 0

Pregunta 20 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 0, j = 1, k; k = i << j + j << i; printf("%d",k); return 0; }

(28)

the program outputs 3

the program outputs 0

the program outputs 1

CAPÍTULO 4 Pregunta 1 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i = 3, j = i - 2; switch(i - 2) { case 1: j++; case 2: j++; case 0: j++; break; default:j = 0; } printf("%d",j); return 0; }

the program outputs 3

the program outputs 1

the program outputs 4

the program outputs 2

Pregunta 2 1 / 1 ptos.

(29)

What happens if you try to compile and run this program? #include <stdio.h> #include <stdio.h> int main(void) { int i = 3, j = i - 2; switch(i + 2) { case 1: j++; case 2: j++; default:j = 0; case 0: j++; break; } printf("%d",j); return 0; }

the program outputs 2

the program outputs 3

the program outputs 1

the program outputs 4

Pregunta 3 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i, t[5]; t[0] = 0; for(i = 1; i < 5; i++) t[i] = t[i - 1] + i; printf("%d",t[4]); return 0; }

(30)

the program outputs 9

the program outputs 8

the program outputs 10

the program outputs 11

Pregunta 4 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i, t[5]; t[4] = 0; for(i = 3; i >= 0; i--) t[i] = t[4] * i; printf("%d",t[0]); return 0; }

the program outputs 2

the program outputs -1

the program outputs 0

(31)

Pregunta 5 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int t[2]; t[0] = 1; t[1] = 0; printf("%d",t[t[t[t[t[0]]]]]); return 0; }

the program outputs 0

the program outputs -1

the program outputs 1

the program outputs 2

Pregunta 6 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i,t[3]; for(i = 2; i >=0 ; i--) t[i] = i - 1; printf("%d",t[1] - t[t[0] + t[2]]); return 0; }

(32)

the program outputs 2

the program outputs 0

the program outputs -1

the program outputs 1

Pregunta 7 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i,t[4] = { 1, 2, 4, 8 }; for(i = 0; i < 2 ; i++) t[i] = t[3 - i]; printf("%d",t[2]); return 0; }

the program outputs 2

the program outputs 1

the program outputs 8

the program outputs 4

(33)

1 / 1 ptos.

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

#include <stdio.h> int main(void) { int s,i,t[] = { 0, 1, 2, 3, 4, 5 }; s = 1; for(i = 2; i < 6 ; i += i + 1) s += t[i]; printf("%d",s); return 0; }

the program outputs 4

the program outputs 1

the program outputs 2

the program outputs 8

Pregunta 9 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

char t[] = { 'a', 'b', 'A', 'B' };

printf("%d",t[1] - t[0] + t[3] - t[2]); return 0;

}

(34)

the program outputs 8

the program outputs 4

the program outputs 1

Pregunta 10 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

float t[5] = { 1E0, 1E1, 1E2, 1E3, 1E4 }; printf("%f",t[0] + t[2] + t[3]);

return 0; }

the program outputs 1110.000000

the program outputs 1101.000000

the program outputs 1111.000000

the program outputs 1011.000000

Pregunta 11 1 / 1 ptos.

(35)

#include <stdio.h> int main(void) {

int i = 1, *j = &i, **k = &j; printf("%d",**k);

return 0; }

the program outputs NULL

the program outputs 0

the program outputs nul

the program outputs 1

Pregunta 12 1 / 1 ptos.

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

#include <stdio.h> int main(void) { char t[3]; printf("%d",sizeof(t) - sizeof(t[0])); return 0; }

the program outputs 4

the program outputs 1

(36)

the program outputs 3

Pregunta 13 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int t[6]; printf("%d",sizeof(t) / sizeof(int)); return 0; }

the program outputs 8

the program outputs 4

the program outputs 2

the program outputs 6

Pregunta 14 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int t[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, *p = t + 4; p += *p; printf("%d",*p); return 0; }

(37)

the program outputs 10

the program outputs 7

the program outputs 9

the program outputs 8

Pregunta 15 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int t[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, *p = t; p += 2; p += p[-1]; printf("%d",*p); return 0; }

the program outputs 7

the program outputs 1

the program outputs 5

(38)

Pregunta 16 1 / 1 ptos.

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

#include <stdio.h> int main(void) { char s[] = "\0\1\2\3\4"; printf("%c",'A' + s[3]); return 0; }

the program outputs A

the program outputs C

the program outputs B

the program outputs D

Pregunta 17 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

printf("%c","ACEGIK"[3] - 1); return 0;

}

the program outputs F

(39)

the program outputs E

the program outputs G

Pregunta 18 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> int main(void) { char s[10] = "ABCDE"; strcpy(s + 2, "ABCDE"); printf("%d", s[0] - s[2]); return 0; }

the program outputs -2

the program outputs 1

the program outputs -1

the program outputs 0

Pregunta 19 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> int main(void) {

(40)

strcat(s + 2, "CABDE"); printf("%d", s[0] - s[2]); return 0;

}

the program outputs -2

the program outputs 1

the program outputs -1

the program outputs 0

Pregunta 20 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> int main(void) { char s[10] = "ABCDE"; strcat(s + 2, "ABCDE"); printf("%d", s[0] - s[2]); return 0; }

the program outputs 0

the program outputs 1

(41)

the program outputs -1

CAPÍTULO 5 Pregunta 1 1 / 1 ptos.

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

#include <stdio.h> int main(void) { char s[10] = "ABCDE", *p = s + 3; printf("%d", p[1] - p[-1]); return 0; }

the program outputs 1

the program outputs 3

the program outputs 2

the program outputs 4

Pregunta 2 1 / 1 ptos.

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

#include <stdio.h> int main(void) { char s[] = "ABCDE", *p = s + 5; printf("%d", p[-1] - *(p - 4)); return 0; }

(42)

the program outputs 3 the program outputs 3

the program outputs 2 the program outputs 2

the program outputs 1 the program outputs 1

the program outputs 4 the program outputs 4

Pregunta 3 Pregunta 3 1 / 1 ptos.

1 / 1 ptos.

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

#include <stdio.h> #include <stdio.h> int main(void) { int main(void) { char *p = "12345", *q = p - 10; char *p = "12345", *q = p - 10; printf("%d", q[14] - q[13]); printf("%d", q[14] - q[13]); return 0; return 0; } }

the program outputs 3 the program outputs 3

the program outputs 4 the program outputs 4

the program outputs 2 the program outputs 2

the program outputs 1 the program outputs 1

Pregunta 4 Pregunta 4

(43)

1 / 1 ptos.

1 / 1 ptos.

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

#include <stdio.h> #include <stdio.h> int main(void) { int main(void) { int t[] = { 1, 2, 3, 4, 5 }, int t[] = { 1, 2, 3, 4, 5 }, *p = t;*p = t; *p++; *p++; (*p)++; (*p)++; *p++; *p++; printf("%d",p[-1]); printf("%d",p[-1]); return 0; return 0; } }

the program outputs 2 the program outputs 2

the program outputs 3 the program outputs 3

the program outputs 1 the program outputs 1

the program outputs 4 the program outputs 4

Pregunta 5 Pregunta 5 1 / 1 ptos.

1 / 1 ptos.

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

#include <stdio.h> #include <stdio.h> int main(void) { int main(void) { int t[2][2] = { 1, 2, 4, 8 }; int t[2][2] = { 1, 2, 4, 8 }; int s = 0, i, j; int s = 0, i, j; for(i = 2; i; i -= 2) for(i = 2; i; i -= 2) for(j = 1; j < 2; j += 2) for(j = 1; j < 2; j += 2) s += t[i - 1][j]; s += t[i - 1][j]; printf("%d",s); printf("%d",s); return 0; return 0; } }

the program outputs 2 the program outputs 2

(44)

the program outputs 1 the program outputs 1

the program outputs 8 the program outputs 8

the program outputs 4 the program outputs 4

Pregunta 6 Pregunta 6 1 / 1 ptos.

1 / 1 ptos.

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

#include <stdio.h> #include <stdio.h> int main(void) { int main(void) { int t[1][2][2] = { { { 1, 2 }, { 3, 4 } } }; int t[1][2][2] = { { { 1, 2 }, { 3, 4 } } }; int s = 0, i, j, k; int s = 0, i, j, k; for(i = 1; i > 0; i -= for(i = 1; i > 0; i -= 2)2) for(j = 1; j < 2; j += 2) for(j = 1; j < 2; j += 2) for(k = 0; k < 3; k += 3) for(k = 0; k < 3; k += 3) s += t[k][i - 1][j]; s += t[k][i - 1][j]; printf("%d",s); printf("%d",s); return 0; return 0; } }

the program outputs 2 the program outputs 2

the program outputs 1 the program outputs 1

the program outputs 3 the program outputs 3

the program outputs 4 the program outputs 4

(45)

Pregunta 7 1 / 1 ptos.

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

#include <stdio.h> #include <stdlib.h> int main(void) {

int *p = (int *)malloc(2 * sizeof(int)); *p = 2; *(p + 1) = *(p) - 1; *p = p[1]; printf("%d",*p); free(p); return 0; }

the program outputs 4

the program outputs 3

the program outputs 1

the program outputs 2

Pregunta 8 1 / 1 ptos.

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

#include <stdio.h> #include <stdlib.h> int main(void) {

int t[] = { 8, 4, 2, 1 };

int *p = (int *)malloc(sizeof(t)); int i; for(i = 0; i < 4; i++) p[3 - i] = t[i]; printf("%d",*(p + 2)); free(p); return 0; }

(46)

the program outputs 3

the program outputs 1

the program outputs 2

the program outputs 4

Pregunta 9 1 / 1 ptos.

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

#include <stdio.h> #include <stdlib.h> int main(void) {

int i,j;

int **p = (int **)malloc(2 * sizeof(int *)); p[0] = (int *)malloc(2 * sizeof(int));

p[1] = p[0]; for(i = 0; i < 2; i++) for(j = 0; j < 2; j++) p[i][j] = i + j; printf("%d",p[0][0]); return 0; }

the program outputs 4

the program outputs 3

(47)

the program outputs 2

Pregunta 10 1 / 1 ptos.

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

#include <stdio.h> #include <stdlib.h> int main(void) {

int i,j;

int **p = (int **)malloc(2 * sizeof(int *)); p[0] = (int *)malloc(2 * sizeof(int));

p[1] = (int *)malloc(2 * sizeof(int)); for(i = 0; i < 2; i++) for(j = 0; j < 2; j++) p[i][j] = i + j; printf("%d",p[0][0]); return 0; }

the program outputs 2

the program outputs 3

the program outputs 1

the program outputs 0

Pregunta 11 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

int *t[10]; int (*u)[10];

(48)

return 0; }

the program outputs 16

the program outputs 0

the program outputs 4

the program outputs 1

Pregunta 12 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int *(t[10]); int *u[10]; printf("%d",sizeof(t) != sizeof(u)); return 0; }

the program outputs 1

the program outputs 2

the program outputs 0

(49)

Pregunta 13 1 / 1 ptos.

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

#include <stdio.h> struct S { int S; }; int main(void) { struct S S; S.S = sizeof(struct S) / sizeof(S); printf("%d",S.S); return 0; }

the program outputs 4

the program outputs 1

the program outputs 2

the program outputs 3

Pregunta 14 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> struct Q { char S[3]; }; struct S { struct Q Q; }; int main(void) { struct S S = { '\0', '\0','\0' }; S.Q.S[0] = 'A'; S.Q.S[1] = 'B';

(50)

  printf("%d",strlen(S.Q.S)); return 0;

}

the program outputs 2

the program outputs 4

the program outputs 3

the program outputs 1

Pregunta 15 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> struct Q { char S[3]; }; struct S { struct Q Q; }; int main(void) { struct S S = { '\0', '\0','\0' }; S.Q.S[0] = 'A'; S.Q.S[2] = 'B'; printf("%d",strlen(S.Q.S)); return 0; }

the program outputs 1

(51)

the program outputs 3

the program outputs 2

Pregunta 16 1 / 1 ptos.

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

#include <stdio.h> struct Q { int a,b,c; }; struct S { int a,b,c; struct Q Q; }; int main(void) { struct Q Q = { 3,2,1 }; struct S S = { 4,5,6 }; S.Q = Q; printf("%d",S.b - S.Q.b); return 0; }

the program outputs 4

the program outputs 1

the program outputs 3

the program outputs 2

Pregunta 17 1 / 1 ptos.

(52)

What happens if you try to compile and run this program? #include <stdio.h> #include <stdlib.h> 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)); x->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 <stdio.h> #include <stdlib.h> 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));

(53)

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 <stdio.h> 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

(54)

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 <stdio.h> 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.

(55)

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 <stdio.h> int f(void) { } int main(void) { int i; i = f(); printf("%d",i); return 0; }

the compilation fails

(56)

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 <stdio.h> 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.

(57)

#include <stdio.h> 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 <stdio.h> int f(int i) { return ++i; } int main(void) { int i = 0; i = f(f(i)); printf("%d",i); return 0; }

(58)

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 <stdio.h> 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.

(59)

#include <stdio.h> 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 <stdio.h> int i = 0; void f(void) { int i = 1; } int main(void) { f(); printf("%d",i); return 0; }

(60)

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 <stdio.h> 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.

(61)

What happens if you try to compile and run this program? #include <stdio.h> 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 <stdio.h> int i = 0;

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

(62)

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 <stdio.h> 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

(63)

Pregunta 13 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int f(int t[\]) { return t[0\] + t[2\]; } int main(void) { int i,a[\] = { -2,-1,0,1,2 };

(64)

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 <stdio.h> 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

(65)

the program outputs 0

Pregunta 16 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int f(char t[\]) { return t[1\] - t[0\]; } int main(void) { int i = 2; i -= f("ABDGK" + 1);

(66)

  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 <stdio.h> 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

(67)

the program outputs 1

Pregunta 19 1 / 1 ptos.

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

#include <stdio.h> #include <string.h> 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 <stdio.h> #include <string.h> void f(char *s,int i) {

*(s + i) = '\0'; }

(68)

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 0.5 / 1 ptos.

The following string:

JohnDoe

is a valid file name in

MS Windows systems Unix/Linux systems

Pregunta 2 1 / 1 ptos.

Unix/Linux systems treat the following names

JohnDoe johndoe

(69)

as different file names

as identical file names

IPregunta 3 0 / 1 ptos.

The following string:

HomeDir/HomeFile

is a valid file name in:

MS Windows systems Unix/Linux systems

Pregunta 4 0 / 1 ptos.

The following string:

D:\USERDIR\johndoe.txt

is a valid file name in

MS Windows systems Unix/Linux systems

Pregunta 5 1 / 1 ptos.

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

(70)

the compilation fails

the program outputs 0

Pregunta 6 1 / 1 ptos.

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

#include <stdio.h> 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 <stdio.h> int main(void) { FILE *f; f = fopen("file","wb"); printf("%d",f != NULL); fclose(f); return 0; }

(71)

the program outputs 1

the compilation or execution fails

the program outputs 0

Pregunta 8 1 / 1 ptos.

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

#include <stdio.h> 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 1 / 1 ptos.

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

#include <stdio.h> int main(void) { int i; i = fprintf(stderr,"Hello!"); printf("%d",i == EOF); return 0; }

the program outputs 2 to the stdout stream

(72)

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 <stdio.h> 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 <stdio.h> int main(void) { FILE *f = fopen("file","w"); int i = fprintf(f,"Hello!"); printf("%d",i != EOF); return 0; }

the compilation or execution fails

(73)

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 <stdio.h> 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 <stdio.h> int main(void) { FILE *f = fopen("file","w"); int i = fputs("Hello!",f); printf("%d",i != EOF); return 0; }

(74)

the compilation or execution fails

the program outputs 2

the program outputs 0

Pregunta 14 1 / 1 ptos.

What happens if you try to compile and run this program assuming that fopen() succeeds?

#include <stdio.h> 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

Pregunta 15 1 / 1 ptos.

What happens if you try to compile and run this program assuming that fopen() succeeds?

#include <stdio.h> int main(void) {

char s[20];

FILE *f = fopen("file","w"); int i = fputs("12A",f);

(75)

  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 <stdio.h> 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

(76)

Pregunta 17 1 / 1 ptos. What happens if you try to compile and run this program assuming that fopen() succeeds?

#include <stdio.h> 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 <stdio.h> 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; }

(77)

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 <stdio.h> 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 1 / 1 ptos.

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

#include <stdio.h> int main(void) {

References

Related documents

However, only a relatively recent stream of literature focuses on the active knowledge protection strategies of MNCs to prevent their knowledge from spilling over host country

As the stormwater management authority for Cook County, the District will continue to address flooding on multiple fronts through the administration of the Small

The two feeding-related risk factors observed in the finisher unit, liquid feeding and more than two meals offered daily, may have a common mechanistic background in predisposing

Advanced surgical techniques in oral plastic surgery are presented in two comprehensive courses designed to enhance your esthetic results around teeth and implants.. You will

The FSC logo, the initials ‘FSC’ and the name ‘Forest Stewardship Council’ are registered trademarks, and therefore a trademark symbol must accompany the.. trademarks in

We discussed many examples of this interaction, for different types of institutions (such as political and legal institutions, regulation, and the welfare state) and

Supreme Court held that an insurance company may not be required to provide a contemporaneous defense for a claim if the facts that determine the existence of coverage will not

[r]