Está en la página 1de 21

1. What defines the structure of programming language expressions?

a) Your reserved words


b) Its syntactic rules
c) Its semantic rules

2. What does the programming process consist of?

a) Writing, compiling and verifying the source code of a program


b) Compiling the source code of a program
c) Compiling and verifying the Bytecode code of a program
3. An algorithm is:

a) An ordered set of operations to find the solution to a problem.


b) An ordered and finite set of operations to find the solution to a problem.
c) A random and finite set of operations to find the solution to a problem.

4. A compiled Java program is portable because:

a) The Bytecode code is executable by the main operating systems on the


market.
b) The Java runtime environment includes a virtual machine that interprets the
Bytecode code.
c) Theenvironment from execution interprets the code
Java, regardless of the virtual machine

5. Java is:
a) A programming language exclusively
b) A Java programming language, a development platform, a runtime
environment and a set of libraries for sophisticated program development.
c) A system for executing programs on different computer platforms

6. Java Runtime Environment (Java Runtime Environment)


a) It is a set of libraries for Java application development.
b) It is an intermediate piece between the Bytecode code and the different
operating systems on the market. Includes Java Virtual Machine
c) It is the Java Virtual Machine

7. The classic software development process consists of the following phases:

a) Coding, design, testing and validation


b) Specification, design, coding, testing and maintenance
c) Design, testing, validation and maintenance

8. During the Specification phase of an application, it is defined:


a) Functionality, technical characteristics of an application and its conditions of
use
b) The functionality and technical characteristics of an application
c) Technical characteristics and conditions of use of the application
9. The Java compiler analyzes the source code and:

a) Checks that all its elements are valid Java words and their semantics.
b) Checks that all its elements are valid words in Java
c) Checks that all its elements are valid Java words, verifies the syntactic
structure of the program and its semantics.

10. The readability of a Java program is important because:

a) Facilitates software maintenance and allows to correct bugs or modify


functionality at lower cost
b) Avoid compiler errors
c) Allows error correction, although it does not facilitate the application
maintenance process.

11. Java is a case-sensitive language.

a) False
b) True

12. The name of a Java element must comply with the rule:

a) Must begin with a letter which may be followed by more letters


b) It must begin with a letter, which may be followed by more letters or digits.
c) It must begin with a letter which may be followed by digits.

13. In Java, variable and method names must begin with a lowercase letter. If the name is
compound, each word must begin with a capital letter.

a) False
b) True

14. In Java, class names must always begin with uppercase letters. If the name is
compound, each word must begin with a capital letter.

a) False
b) True

15. A data type indicates the values that a variable can store and the range of values it
supports.

a) False
b) True

16. Which of the following expressions is correct?


a) double radius = 2;
b) double radius = 2.0;
c) double radius = 2.0;
17. The + operator is overloaded because it allows adding numbers and concatenating
character strings.

a) False
b) True
18. Indicate the value of: x = -1 + 5 * 7 - 12 / 3
a) 28
b) 30
c) 6

19. Indicate the value of: x = (-1 + 5) * 7 - (12 / 3)

a) 26
b) 30
c) 24

20. Indicate the value of: x = 3 > 2 && 6 < 10 || true

a) true
b) false

21. A class describes a type of objects with common characteristics.


a) False
b) True

22. An object is an abstract representation of a class.


a) False
b) True

23. The attributes of an object can only store Java primitive types.

a) False
b) True

24. When the constructor method of a class is executed:

a) An alias is created and the attributes of the object are initialized.


b) A memory space is allocated to the instantiated object and the attributes of
the object are initialized.
c) A memory space is allocated to the instantiated object, but the attributes of
the object are not initialized.

25. The constructor method is executed each time an object of the class is instantiated.

a) False
b) True
26. The state of an object can change during the execution of a Java program.

a) False
b) True

27. An object consists of:

a) Attributes
b) Attributes and methods
c) Attributes and constructor methods

28. A method is a function that:

a) Determines the behavior of a class


b) Determines the behavior of a class and its objects
c) Determines the behavior of an object

29. The main() method is invoked when a Java program is executed.

a) False
b) True

30. Method overloading is useful for:

a) That the same method operates with parameters of different types or that the
same method receives a different list of parameters.
b) That the same method operates with parameters of different type
c) Different methods operate with different parameter types

31. What does the following source code do?


int x=0;
boolean flag = false;

while ((x<10) || !flag) {


System.out.println(x);
x++;
}

Displays numbers from 0 to 9


Displays numbers from 1 to 10
Displays a 10
Stays in an infinite loop

32. How can I use the PI number in Java?


PI
Math.PI
PI Const.
Nothing exists, it must be declared 3.141592

33. What is the value of X and Y at the end of the program?


int x= 0;
do {
System.out.println(x);
x++;
} while (x<10);

int y= 0;
while (y<10){
System.out.println(y);
y++;
}

x=9 y=9
x=10 y=10
x=9 y=10
x=10 y=9

34. What is the result of the following program?


int i=1;
System.out.println ( i == 1 );

true
false
undefined
"i == 1"

35. What is printed on the screen?


int x = 10;
int y = 3;

System.out.println(x%y);

3
2
1
0

36. It is necessary to use the break statement in a switch structure for the program to
compile.

Yes, it is strictly necessary


No, it is not necessary
Yes, if there are conditions that cannot be met.
Yes, but only in switches that handle integers.
37. Is it mandatory to use the default statement in a switch structure?
Yes, always.
Yes if no value meets the condition.
Yes, but only for integer values.
No, it is not mandatory.

38. What is the result of the following program?

int k=3;
int m=2;
System.out.println ((m <= 99) & (k < m));

true
false
24
0111011

39. What is the value displayed on the screen?

int x = 5;
int y = 5;

y /= ++x;
System.out.println(y);

6
5
1
0
40. What does the following program do?

String sWord = "word";

int inc = 0;
int des = sWord.length()-1;
boolean bError = false;

while ((inc<des) && (!bError)){


if (sWord.charAt(inc)==sWord.charAt(des)){
inc++;
des--;
} else {
bError = true;
}
}

Count the letters in one word


Calculates if there are repeated letters in a word.
Calculates if a word is a palindrome
The program does not compile

41. What does the following line of code do?

z = x++ + y;

It is not correct, it does not compile.


Add the value of X+Y to Z and then increment X by one.
Increments the value of X by one and adds it to Y to assign it to Z.
Add one to X and assign it to Z, then add y to Z.

42. What does the following source code show on the screen?
int x=1;

switch (x) {
case 1:
System.out.println("One");
case 2:
System.out.println("Two");
case 3:
System.out.println("Three");
default:
System.out.println("Another number");
}

One
Two
Other number
One Two Three Other number

43. What makes our function a mystery?


public static double misterio(double x,int y) {
return (x*y)/100;
}

Calculate the 10 part of X over Y


Calculate the 2 decimal places of the value of X
Calculates the percentage Y over the value of X
None of the three is correct

44. What is the precision of a short data type?


8 bit
16 bit
32 bit
64 bit

45. What is the final value of y?


int x = 0;
int y = 0;

while (x<10) {
y += x;
x++;
}

System.out.println(y);

0
10
11
45

46. What is the result of the operation?

int x=1;
System.out.println(++x*4+1);

6
5
9
7

47. What type of structure does the following code represent?

while (counter < 20) {


System.out.println("Line number " + counter);
counter++;
}

Sequential Structure
Repetitive Structure
Selective Structure
None of the above three.

48. What is the result of the following operation?

System.out.println(12&13);

true
false
12
13
49. What is the result of the following operation?

System.out.println(5>>>1);
6
true
4
2

50. What type of structure does the following code represent?

int x,counter;
counter = 10;
x = counter +1:
System.out.println("The value is " + x);

Selective Structure
Sequential Structure
Repetitive Structure
None of the above three.

51. Is Java an object-oriented language?

Yes
No
Depends on Use
Compiler Dependent

52. What is the value displayed on the screen?


int x=10;
int y=0;

while (y<x) {
x += y;
}

System.out.println(y);

0
1
10
None, enters infinite loop

53. What type of structure does the following code represent?

if (counter<34) {
System.out.println("Counter is less than 24");
}

Sequential Structure
Repetitive Structure
Selective Structure
None of the above three.

54. What does the following code statement do?

x += 2;

Assigns the value of 2 to the variable x


Add 2 to the value of the variable x
Subtract 2 units from the value of x
None of the three options is valid

55. What is the value of x?

double x = Math.pow(2, 2);

4
"4"
4.0
Any of the three is valid

56. What is the result of the following program?

int i=1;
int j=2;
int k=3;
int m=2;
System.out.println ((j >= i) || (k == m));

true
false
undefined
Gives compilation error

57. What does the following source code do?

import java.applet.Applet;
import java.awt.Graphics;

public class MyPrimerApplet extends Applet {


public void paint(Graphics g){
g.drawString("Hello World",40,80);
}
}

Paint in console the text "Hello World".


Generates an Applet with the text "Hello World".
Creates a window containing the text "Hello World".
None of the above answers is correct

58. What is the result of the operation?

System.out.println(2+6>>>2);

8
5
4
2

59. By which company was Java developed?

Microsoft
Oracle
SUN Microsystems
Fujitsu

60. What is the result of the following program?

int k=3;
int m=2;
System.out.println ( !( k > m) );

3
true
2
False

61. In the precedence of operators which comes before


*/%
+-
++expression
<<
62. What does the following source code print on the screen?

int x = 10;
int y = 3;

x %= y;
System.out.println(y);

4
3
2
1
63. What does the following code statement do?

total -= --counter;

It does not compile, it is erroneous.


Decrement counter to total and then subtract one from counter.
Subtract one from the counter and then subtract it from the total.
Decrements one to the counter and then assigns it to total.

64. What would be displayed on the screen?

System.out.println("Hello World");

"Hello World"
"Hello World"
"Hello" and on another line "World".
"Hello" a tabulator and "World".

65. What is the value displayed on the screen?

int x = 0;
int y = 0;

while (x<5) {
y +=x;
x++;

System.out.println(y);

10
5
0
The program does not compile

66. What is the precision of an int data type?

8 bit
16 bit
32 bit
64 bit

67. How can I raise a number to a power?

Math.poten
Operator ** Operator
Math.pow
Operator ^
68. What is displayed on the screen?

for (int x=0;x<10;x++)


System.out.println(x);

Numbers 1 to 9
The numbers from 0 to 9
Numbers from 1 to 10
The program does not compile

69. What is the result of the following program?

int j=2;
System.out.println ( j == 3 );

true
false
undefined
"j == 3"

70. Which of the list is not a data type in Java?

byte
float
double
single

71. What is the value displayed on the screen?


int x = 5;
int y = 5;

y *= x++;
System.out.println(x);

25
30
6
35

72. What is the precision of a long data type?

8 bit
16 bit
32 bit
64 bit

73. What does the following code do?


counter += x;

Add the value of x to counter


Assign x to the counter value
Adds one to the value of x and assigns it to the counter
None of the above three is correct

74. What is the result of the following operation?

System.out.println(4<<<1);

5
8
true
3

75. Does source code One and source code Two do the same thing?

/* Code One*/
int x= 0;
do {
System.out.println(x);
x++;
} while (x<10);

/* Code Two */
int y= 0;
while (y<10){
System.out.println(y);
y++;
}

No, the first one shows from 1 to 10 and the second one from 0 to 9.
Yes, both show 0 to 9
No, the first one shows from 0 to 9 and the second one from 1 to 10.
Yes, both show from 1 to 10

76. What value is displayed?

int counter;
int x = 3;

counter += x;
System.out.println(counter);

3
1
0
The program does not compile

77. How do I calculate the percent of a number in Java?


Operator % Operator % Operator % Operator % Operator % Operator % Operator % Operator %
Operator
Math.percentage
Math.percent
It must be calculated by hand

78. What is the value displayed on the screen?


int x = 5;
int y = 5;

y *= x++;
System.out.println(y);

25
30
6
35

79. A string is for defining variables or type constants:

whole
decimals
character
all of the above

80. To display messages on the screen is used:

System.out.println
system.out.printer
System.out.prin
All are correct

81. The double applies to type data:

whole
decimals
character
none of the above

82. The assignment of a variable is applied with ==

yes
no
both with correct
none of the above
83. Do you use the if when you have 2 possible answers?

yes
no
both with correct
none of the above

84. The name of the class must be different from the package
yes
no
it does not matter
none of the above

85. The call of a library is made using the:


import
scanner
string
none of the above

86. What is the structure that allows to initialize the program?


public class
void main
system. out
all of the above

87. The libraries are called within:


package
public class
void main
none of the above

88. How to capture what is typed on the screen


scanner
integer
printf
if

89. Which prints the following code:


A message.
A calculation.
A figure.
A Diagram

90. The following program prints:

A menu.
A list of items.
A receipt.
A shopping list.

91. The following program prints:

This.key1 and This.key2.


Key1 and Key2.
setKey1 and setKey2.
DoubleKey.

92. It is a set of data and a set of operations that are performed on that data, what kind of
data you are talking about:

TDA.
Class.
Instance.
Object.
93. It is the action performed by an object when a message is passed or in response to a
change of state.
Behavior.
Execution.
Diffusion.
Instantiate.

94. The following example is from :

Set.
UML.
Abstraction.
Data entry.

95. There are two types of constructors, these are:

Set and Get.


String and Double.
Public and Private.
Without arguments and with arguments.

96. Communication occurs in the same way between an object and the objects it contains,
when objects need to interact, they do so through:

Sending codes.
Sending messages.
Sending coordinates.
Sending information.

97. Because object-oriented programming relies on them, these three pillars are like a
tower of bricks; remove the last brick and the whole thing falls apart. What are these
three pillars:
Abstraction, interface and encapsulation.
Interface, inheritance and abstraction.
Inheritance, polymorphism and encapsulation.
Abstraction, interface and polymorphism.

98. They are the external and visible characteristics of a class:

Attributes.
Class.
Methods.
Variables.

99. Java's predecessor program?

Directx
OpenGl
C++

100. Is a class or method abstract if it is declared with the reserved word?

new
abstract
public
private

101. What is a chain?

It is a class that cannot be instantiated.


Sequence of characters delimited by double quotation marks
It is an abstract method
These are characters without double quotation marks

102. What is polymorphism based on?

In declaring methods in a class


On creating classes and methods in a program
In using the same method for different objects
In using a method for a single object

103. What do you understand by inheritance in Java?


Occurs when creating several methods in a class
It is the action of creating classes derived from a class b
Occurs when creating a method with no return
Occurs when defining variables in a class

104. When creating a class derived from a base class, is it inherited?


Only the methods
Only the variables
Variables and methods
Inherits nothing

También podría gustarte