1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bagirrra123 [75]
2 years ago
6

What is the output for the following program?

Computers and Technology
1 answer:
murzikaleks [220]2 years ago
6 0

Answer:

13

Explanation:

int numA = 4;

whilie (numA < 12){

  numA += 3;

}

System.out.print(numA);

numA          numA < 12

  4                   true <em>⇒ numA increases by 3, loop continues </em>

  7                   true <em>⇒ numA increases by 3, loop continues </em>

  10                 true<em> ⇒ numA increases by 3, loop continues</em>

  13                 false <em>⇒ loop stops, program them prints out value of numA </em>

You might be interested in
Create a function (prob3_6) that will do the following: Input a positive scalar integer x. If x is odd, multiply it by 3 and add
aniked [119]

Answer:

Following are the program in python language

def prob3_6(k): #function definition

  c = 0 #variable declaration

  while k != 1: #iterating the while loop

      print(k) #print k

      if k % 2 == 0:#check if condition  

          k= k // 2 #divisible by 2

      else: #else condition

          k = k * 3 + 1  

      c = c + 1

  print(k) #print k

  print c #print count

prob3_6(3)#function call

Output:

3

10

5

16

8

4

2

1

7

Explanation:

Following are the description of program

  • Create a function "prob3_6" in this function we passing an integer parameter of type "int" named "k".
  • Inside that function we declared a variable "c" of type "int" that is used for counting purpose .
  • After that we iterated the while for print the value of when it is not equal to 1 .
  • We check if condition when k gives 0 on modulus then k is divisible by 2 otherwise else block will be executed in the else part we multiply by 3 to k and add 1 to the k variable .
  • Finally print "k" and "c"

5 0
3 years ago
Web services can exchange information between two different systems only if the operating systems and programming languages upon
stich3 [128]
Because if im talking to someone in english but they are from china and communicating to me in chinese then thas what itll do
4 0
2 years ago
Write a program that (a) generates a vector with 20 random integer elements with integers between -29 and 30, (b) replaces all t
Ghella [55]

Answer:

import random

randomlist = []

for i in range(0,20):

n = random.randint(-29,30)

if n < 0 :

n = 100

randomlist.append(n)

print(randomlist)

Explanation:

The random module is first imported as it takes care of random. Number generation.

An empty list called randomliay is created to hold the generated random integers.

Using a for loop, we specify the range of random numbers we want.

Inside the for loop ; we attach our generated random integer which will be in the range (-29 to 30) in a variable n

For each n value generated, if the value is less than 0( it is negative, since all the values are integers), replace the value with 100.

5 0
2 years ago
Object-oriented systems have three general types of cohesion: _____, _____, and _____. A. method, class, inheritance B. method,
Verdich [7]

Answer:

D. method, class, generalization/specialization

Explanation:

The Cohesion is said to be the level to what an element of a module is related to others. Generally, the cohesion can be understood as an internal adhesive that holds together the modules. If the software is good then it is going to have high cohesion. Method and class are type of cohesion, as they hold the modules together. And generalization/specialization also is a general type of cohesion as generalization tracks the common features among the class, and binds them into one superclass. However, the specialization means creating subclasses out of the classes, and which is the meaning of the specialization. In an ideal situation, there should be high cohesion or single responsibility. However, in the case of inheritance, there can be multiple responsibilities. And hence composition like a generalization, specialization, association, aggregation are used to make use of the composition for reuse rather than inheritance. Have you seen language supporting multiple inheritances. You will never see it though there is some way. And its never allowed to ensure high cohesion. And hence three general types of cohesion are method, class and generalization/specialization. And this is option D.

4 0
2 years ago
What is the meaning of ethics? Check all of the boxes that apply
suter [353]

Answer:

behavior that is good for everyone

following the rules

behaving in a way that would be easy to defend

Explanation:

6 0
3 years ago
Other questions:
  • Name size of machine screw that is used to secure switches and receptacles to device boxes
    13·1 answer
  • A technology company only hires applicants who are under the age of 30. This company could face possibly _________ consequences
    9·2 answers
  • What is an effective way to assess user requests for additional features and functions
    10·1 answer
  • Object-oriented programs employ a group of techniques for handling errors called ________ handling.
    12·1 answer
  • An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to access t
    12·2 answers
  • If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have? A. Two B. One C. Four D. Thr
    12·1 answer
  • To display data in a certain manner, like alphabetical order, is called
    5·2 answers
  • Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.
    9·1 answer
  • (PLEASE HELP)
    5·1 answer
  • Fun with Characters
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!