answer.
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
sergiy2304 [10]
2 years ago
4

Write C expressions that evaluate to 1 when the following conditions are true and to 0 when they are false. Assume x is of type

int. Any bit of x equals 1. Any bit of x equals 0. Any bit in the least significant byte of x equals 1. Any bit in the most significant byte of x equals 0. Your code should follow the bit-level integer coding rules (page 128), with the additional restriction that you may not use equality (==) or inequality (!=) tests.

Computers and Technology
1 answer:
Bess [88]2 years ago
3 0

Answer:

Check the explanation

Explanation:

#include <stdio.h>

#include <stdlib.h>

//function to print a message

static void printMessage(char *msg)

{

printf("%s\n", msg);

}

//perform option A

int perform_A(int x)

{

//return true if any bit of x is equal to 1

return !!x;

}

//perform option A

int perform_B(int x)

{

//return true if any bit of x is equal to 0

return !x;

}

//perform option C

int perform_C(int x)

{

//return true if least significant bit is 1

return !!(x & 0xFF);

}

//perform option D

int perform_D(int x)

{

//return true if most significant bit is 0

return !!(~x & 0xFF);

}

//the main function

int main(void)

{

//set the integer

int input = sizeof(int) << 3;

//declare the test values

int onebitis1 = ~0;

int onebitis0 = 0;

int onebitLeast1 = 0xFF;

int onebitMost0 = 0xFF << (input - 8);

(perform_A(onebitis1)) && (printf("A return True\n"));

(perform_B(onebitis0)) && (printf("B returns True\12"));

(perform_C(onebitLeast1)) && (printf("C returns True\n"));

(perform_D(onebitMost0)) && (printf("D returns True\n"));

//to wait for a key press

getchar();

return 0;

}

Kindly check the attached image below to see the output.

You might be interested in
A layer 2 switch is used to switch incoming frames from a 1000base-t port to a port connected to a 100base-t network. which meth
fredd [130]
<span>Shared memory buffering would work best. This would give the ports the best allocation of resources, using only those that are the most active and best allocated for the size of the frames being transmitted in the current traffic. In addition, any port can store these frames, instead of being specifically allocated as per other types of memory buffering.</span>
7 0
2 years ago
Consider the following method, which is intended to return an array of integers that contains the elements of the parameter arr
Gennadij [26K]

Code:

public static int[] reverse(int [] arr){

Int [] newArr = new int[arr.length];

for (int k = 0; k<arr.length;k++){

/*Missing statement */

}

return newArr;

Answer:

Replace the comment with:

newArr[k] = arr[arr.length-k];

Explanation:

Required

Complete the code

In the given code:

The first line of the given code defines the method

public static int[] reverse(int [] arr){

The next line declares array newArr withe same length as array arr

Int [] newArr = new int[arr.length];

The next line iterates through the elements of array arr

for (int k = 0; k<arr.length;k++){

The /* Missing statement */ is then replaced with:

newArr[k] = arr[arr.length-k];

The above statement gets the elements of array arr in reversed order.

This is so because, as the iteration iterates through array arr in ascending order, arr.length-k gets the element in reversed order

6 0
2 years ago
You are a technical consultant for many businesses in your community. One of your clients, a small law firm, has a single Active
stellarik [79]

COMPLETE QUESTION:

You are a technical consultant for many businesses in your community. One of your clients, a small law firm, has a single Active Directory domain. They have two servers running Windows Server 2012 R2. Both servers are configured as domain controllers while also serving as file and printer servers.This client is calling you on a regular basis because users are deleting or damaging their files. You must visit the client's site and restore the files from backup. Your client has asked you to create an alternate solution. What should you do?

Answer:

Use the Windows VSS to create shadow copies on important data

Explanation:

Volume Snapshot Service (VSS) is a service available to Windows Operating Systems which allows safe backup of open files as well as locked ones. It does this by taking a snapshot the state of the drive, this snapshot information will be provided to the backup application whenever needed. It is important to mention that this service is only available on files which are in the NTFS format

8 0
2 years ago
In Linux, the most popular remote access tool is OpenSSH. Which software performs the same remote command line (CLI) access from
maxonik [38]

Answer:

Putty

Explanation:

PuTTY is an SSH and telnet client for Windows and Unix platform. PuTTY is an open source terminal emulator, serial console and network file transfer application. It does not only support SSH and telnet, it also supports other network protocols like SCP, rlogin, and raw socket connection.

To make use of the SSH client on windows, you need to first download and then install the PuTTY software.

6 0
2 years ago
Which role is delegated to personnel of the IT department and is responsible for maintaining the integrity and security of the d
enyata [817]

Correct question.

Which role is delegated to personnel of the IT department and how is responsible for maintaining the integrity and security of the data?

Answer:

<u>data custodian</u>

<u>Explanation:</u>

Remember, every organization generates data, and large organizations generate even larger data.

Hence, the role of a data custodian in an organization requires He implements measures to protect the organization's data, store and backup the data, as well as granting access to the data to authorized persons when needed.

3 0
2 years ago
Other questions:
  • In three to five sentences, describe whether or not files should be deleted from your computer.
    13·2 answers
  • HELP ASAP U GET BRAINLIEST
    15·2 answers
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • When does the narrator of "EPIC 2015" say the "road to 2015" began?
    10·2 answers
  • Sean is forecasting the time and cost of developing a customized software program by looking at the number of inputs, outputs, i
    8·1 answer
  • Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*..\.\*2*1). Hint: Initialize a
    5·1 answer
  • In this challenge, write a function to add two floating point numbers. Determine the integer floor of the sum. The floor is the
    8·1 answer
  • (Java) Which of the following code segments correctly declare a Strings and gives it a value of "fortran".
    12·1 answer
  • Which of the following best describes the protocols used on the Internet?
    12·1 answer
  • Is cheque money? give reason​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!