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
irina [24]
3 years ago
12

Given the following sequence of Java code: int var1 = 0b0001; int var2 = 0b1111; int results1 = var1 & var2; int results2 =

var1 | var2; int results3 = var1 ^ var2; int printit = results1 + results2 + results3; What are the values for results1, results2, results3 and printit after executing the code?
Computers and Technology
1 answer:
marusya05 [52]3 years ago
4 0

Answer:

results1 = 1

results2 = 15

results3 = 14

printit = 30

Explanation:

public class HelloWorld{

    public static void main(String []args){

       int var1 = 0b0001;

       int var2 = 0b1111;

       int results1 = var1 & var2;

       int results2 = var1 | var2;

       int results3 = var1 ^ var2;

       int printit = results1 + results2 + results3;

       System.out.printf("%d %d %d %d", results1, results2, results3, printit);

    }

}

Output:

$javac HelloWorld.java

$java -Xmx128M -Xms16M HelloWorld

1 15 14 30

In this program we are performing binary operations with logical gates and binary numbers, to understand the result see each binary operation:

  • var1 & var2: refers to the AND gate, since 0001 & 1111 is 0001 our result as an integer is 1
  • var1 | var2: refers to the OR gate, since 0001 | 1111 is 1111 our result as an integer is 15
  • var1 ^ var2: refers to the XOR gate, since 0001 ^ 1111 is 1110 our result as an integer is 14
  • results1 + results2 + results3: refers to the sum of 3 integers, 1+15+14 equal 30
You might be interested in
Just five types of pointing device,list
posledela

Answer:

five types of pointing devices

Explanation:

Ponting devices

Pointing means point something and the pointing devices are the input /peripheral devices those are used to point the pointer on the screen. We do move cursor on the screen to open the files or any icon.

There are many types of pointing devices but these are quite common which are given below

  1. Computer mouse
  2. Finger on touch screen.
  3. Joystick.
  4. Leap Motion.
  5. Light pen (pen)

1.Mouse

Mouse is most common type of input device that is used for pointing the data on the screen. We press it with our hands and keep pointing the things.

There are three types of mouse

  1. optical mouse
  2. wireless mouse
  3. trackball mouse.

2. Finger on touch screen

In this type of movement the fingers are input devices those we use to see the movement of pointer on the screen and this is most common in this century.

3.Joystick.

Joystick is another input device to point the cursor but it is mostly used in games. Children can use it smartly so it is inculcated in games usually.

4. Leap Motion

The Leap Motion (LM) controller is a latest 3D sensing device for hand posture interaction with a computer. It is having the capability sense the location of the fingers of the hands, as well as the palm position.

5.Light Pen

this is another pointing device which is mostly used to highlight and select the data on the screen.

Note: All of these above pointing devices are most common used now a days. These devices are having new  conventions day by day for the ease of user. This era is basically the era of IT ,so the use of computer must be so easy and conventional for the user so, the innovations and improvement in such devices is made side by side.

3 0
3 years ago
Addison or Charli
Blizzard [7]

Answer:

1. Mum

2.Bro my sisters are more annoying

3.cat

Explanation:

yuh

3 0
3 years ago
Read 2 more answers
What happens when a computer gets a virus?
Volgvan
You will start to get ad pop-ups like crazy, and your computer will be a lot slower. I'd recommend that you be careful downloading things, make sure it's the right thing you're downloading. Some people make false websites. Also the best thing to do is get a usb drive and store everything you want to keep and reset your computer to factory in your settings.
3 0
3 years ago
Read 2 more answers
In response to an alert regarding a possible security incident, you are analyzing the logs for a web application. In the process
SOVA2 [1]

The type of attack was most likely attempted against the application is an  XSS attack.

<h3>Why is the above an  XSS attack?</h3>

This attack is known to be an example of an XSS attack as it is one that is often recorded by the log of a web server's log.

Conclusively, Note that in this attack, if you see the HTML encoding, one can say that is mainly an XSS attack but when you see SQL or XML statements in the string, then it is another.

Learn more about attack from

brainly.com/question/76529

#SPJ1

4 0
2 years ago
What are pixels that are the exact same between multiple friends called
erastova [34]

Answer:

The answer is temporal redundancy

Explanation:

Computer Definition. Pixels in two video frames that have the same values in the same location. Exploiting temporal redundancy is one of the primary techniques in video compression (see interframe coding). Contrast with spatial redundancy.

7 0
3 years ago
Other questions:
  • According to many experts how often should files be backed up
    12·2 answers
  • The __________ level focuses on developing the ability and vision to perform complex, multidisciplinary activities and the skill
    9·1 answer
  • WRITE A JAVA PROGRAM TO PRINT THE PATTERN<br> 13579<br> 2468<br> 357<br> 46<br> 5
    12·1 answer
  • You have been asked to install a WLAN for a small business. You centrally locate the WAP in a large room that contains about 15
    5·1 answer
  • Question # 4
    5·1 answer
  • What is a frame injection attack in a wireless network?
    13·2 answers
  • If you need to change the typeface of a document, which menu will you choose?
    6·1 answer
  • Computers are used because they :
    9·2 answers
  • How many basic elements of QBASIC are there
    14·1 answer
  • For robot arms the first three axes are called
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!