Write an if/else statement that assigns 0 to x when y is equal to 10; otherwise it should assign1 to x.

Answers

Answer 1
Answer:

Answer:

if(y==10)

{

     x=0;   // assigning 0 to x if y equals 10.

}

else

{

   x=1;   // assigning 1 to x otherwise.

}

Explanation:

In the if statement i have used equal operator == which returns true if value to it's right is equal to value to it's left otherwise false.By using this operator checking value of y and if it is 10 assigning 0 to x and if it is false assigning 1 to x.


Related Questions

Which of the following people was a member of FFA?O Kenny ChesneyO Tim McGrawO Alan JacksonO Billy Currington
On a piano, each key has a frequency, and each subsequent key (black or white) is a known amount higher. Ex: The A key above middle C key has a frequency of 440 Hz. Each subsequent key (black or white) has a frequency of 440 * rn, where n is the number of keys from that A key, and r is 2(1/12). Given an initial frequency, output that frequency and the next 3 higher key frequencies. If the input is 440, the output is: 440 493.883 523.251 554.365.Note: Include one statement to compute r = 2(1/12) using the pow function, then use r in the formula fn = f0 * rn. (You'll have three statements using that formula, different only in the value for n).
How many rules are contained in the css code?a.1b.2c.3d.4​
/* Q1. (20 points)Create a stored procedure sp_Q1 that takes two country names like 'Japan' or 'USA'as two inputs and returns two independent sets of rows: (1) all suppliers in the input countries, and (2) products supplied by these suppliers. The returned suppliers should contain SupplierID, CompanyName, Phone, and Country. The returned products require their ProductID, ProductName, UnitPrice, SupplierID, and must sorted by SupplierID.You should include 'go' to indicate the end of script that creates the procedure and you must include a simple testing script to call your sp_Q1 using 'UK' and 'Canada' as its two inputs\.\**For your reference only: A sample solution shows this procedure can be created in11 to 13 lines of code. Depending on logic and implementation or coding style, yoursolution could be shorter or longer\.\*/
Selector Next we will write a function that will help us select an output for the chatbot, based on the input it got. The overall goal of this function is to take a list of words that we got as input, a list of words to check for if they appear in the input outputs to return if something from the list to check is in the input list. Define a function, called selector. This function should have the following inputs, outputs and internal procedures: Input(s) input_list - list of string check_list - list of string return_list - list of string Output(s): output - string, or None Procedure(s): Initialize output to None Loop through each element in input_list Use a conditional to check if the current element is in check_list If it is, assign output as the returned value of calling the random.choice function on return_list Also, break out of the loop At the end of the function, return output Note that if we don't find any words from input_list that are in check_list, output will be returned as None.

Which of the following sorting algorithms is described by this text? "Take the item at index 1 and see if it is in order compared to the item at index 0. If it is not, then swap the two items. Next take the item at index 2 and compare it to the items at the lower indexes. Move items in the lower indexes to a higher one until you find the proper location to place the value so that it is in the correct order. Continue this process with all remaining indexes."a. Insertion sort
b. Heap sort
c. Merge sort
d. Quick sort
e. Selection sort

Answers

Answer:

a. Insertion sort

Explanation:

Insertion Sort is a sorting algorithm that places the input element at its suitable place in each pass.

Insertion sort is based on the idea that one element from the input elements is consumed in each iteration to find its correct position.

C programmig : Output all combinations of character variables a, b, and c, using this ordering:abc acb bac bca cab cbaSo if a = 'x', b = 'y', and c = 'z', then the output is: xyz xzy yxz yzx zxy zyxYour code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3'.

Answers

Answer:

// Here is code in C.

#include "stdio.h"

// create function to print all the combinations

void print_combi(char a,char b,char c)

{

// print all combinations of three characters

   printf("%c%c%c %c%c%c %c%c%c %c%c%c %c%c%c %c%c%c\n",a,b,c,a,c,b,b,a,c,b,c,a,c,a,b,c,b,a);

}

// driver function

int main(void)

{

// create 3 char variable and initialize

char a='x',b='y',c='z';

// call the function

print_combi(a,b,c);

printf("\n");

// initialize with different character

a='1',b='2',c='3';

// call the function

print_combi(a,b,c);

printf("\n");

// initialize with different character

a='#',b='$',c='%';

// call the function

print_combi(a,b,c);

printf("\n");

return 0;

}

Explanation:

Create three char variables a, b, c. First initialize them with x, y, z. then call  the function print_combi() with three parameters . this function will print all the combinations of those characters.We can test the function with different values of all the three char variables.

Output:

xyz xzy yxz yzx zxy zyx

123 132 213 231 312 321

#$% #%$ $#% $%# %#$ %$#

A C program to find all combinations of character variables:

void main ()

{

       char f;

       char s;

       char t;

       f = 'x';

       s = 'y';

       t = 'z';

       System.out.print("" + f + s + t + " " + f + t + s + " " + s +f + t +

       " " + s + t + f + " " + t + f + s + " " + t + s + f);

  }

}

What is the speedup of going from a 1-issue processor to a 2-issue processor? use your code from part a for both 1-issue and 2-issue, and assume that 1,000,000 iterations of the loop are executed. as in part b, assume that the processor has perfect branch predictions, and that a 2-issue processor can fetch any two instructions in the same cycle?

Answers

I think it is sped up by around 0.6 GHz

9-1. Assume that an average SNMP response message is 100 bytes long. Assume that a manager sends 400 SNMP Get commands each second. a) What percentage of a 100 Mbps LAN link’s capacity would the resulting response traffic represent? Answer : b) What percentage of a 1 Mbps WAN link would the response messages represent? c) What are the management implications of your answers?

Answers

Answer:

a) 0.32%

b) 32%

c) Mbps WAN link is of more benefit

Explanation:

Average SNMP response message = 100 bytes

Avere message for each second when manager sends 400 SNMP

: 400 SNMP per second * 100 bytes = 40000 bytes per second = 40000Bps

To convert byte to bits, We have 1 byte = 8 bits

Therefore, 40000Bps = 40000 * 8 = 320 Kbps

a) Calculating the percentage of a 100 Mbps LAN link’s capacity

100 Mbps = 100000Kbps

320 Kbps is what percent of 100000Kbps = (320)/(100000) * 100 = 0.32%

So the resulting response traffic would represent 0.32% of a 100 Mbps LAN link’s capacity.

b) Calculating the percentage of a 1Mbps LAN link’s capacity

1Mbps = 1000Kbps

320 Kbps is what percent of 1000Kbps = (320)/(1000) * 100 = 32%

So the resulting response messages would represent 32% of a 1Mbps LAN link’s capacity.

c) When we are using the 1 Mbps WAN link, we use 32% of its speed to response the message as opposed to 100 Mbps LAN link that uses just 0.32%. This means the  1 Mbps WAN link uses more bandwith than the 100 Mbps LAN link. Therefore the management implication is that it is better to use the  1 Mbps WAN link has it has more benefits.

Challenge: Tic-Tac-Toe (Report a problem) Detecting mouse clicks For this step of the challenge you will complete Tile's handleMouseClick method. The handleMouseClick method has two parameters: x and y which represent the coordinates of where the user clicked the mouse. When a user clicks inside a tile, that tile's handleMouseClick method should call that tile's onClick method. To check if the mouse click is inside of the tile, you will need an if statement that checks if: - the mouse click is on, or right of, the left edge of the tile - the mouse click is on, or left of, the right edge of the tile - the mouse click is on, or below, the upper edge of the tile - the mouse click is on, or above, the lower edge of the tile

Answers

Answer:

var playerTurn;

var NUM_COLS;

var NUM_ROWS;

var SYMBOLS;

var tiles = [];

var checkWin = function()

{    };

var Tile = function(x, y)

{

 this.x = x;

 this.y = y;

 this.size = width/NUM_COLS;

 this.label = "";

};

Tile.prototype.draw = function()

{

   fill(214, 247, 202);

   strokeWeight(2);

   rect(this.x, this.y, this.size, this.size, 10);

   textSize(100);

   textAlign(CENTER, CENTER);

   fill(0, 0, 0);

   text(this.label, this.x+this.size/2, this.y+this.size/2);

};

Tile.prototype.empty = function()

{

   return this.label === "";

};

Tile.prototype.onClick = function()

{

   // If the tile is not empty, exit the function

   // Put the player's symbol on the tile

   // Change the turn

};

Tile.prototype.handleMouseClick = function(x, y)

{

   // Check for mouse clicks inside the tile

};

for (var i = 0; i < NUM_COLS; i++)

{

   for (var j = 0; j < NUM_ROWS; j++)

  {

       tiles.push(new Tile(i * (width/NUM_COLS-1), j * (height/NUM_ROWS-1)));

   }

}

var drawTiles = function()

{

   for (var i in tiles)

  {

       tiles[i].draw();

   }

};

mouseReleased = function()

  {

   for (var i in tiles)

       {

       tiles[i].handleMouseClick(mouseX, mouseY);

       }

 };

draw = function()

{

   background(143, 143, 143);

   drawTiles();

};

Explanation:

Your friend sees an error message during Windows startup about a corrupted bootmgr file. He has another computer with a matching configuration and decides to copy the bootmgr file from the working computer to the computer with the problem. However, your friend is having problems finding the bootmgr file and asks for your help. What is your best response?

Answers

Answer:

He should remove any removable devices from the PC , change the boot device to USB or CD drive and insert the installation disk or a created ISO USB file to install

Explanation:

Other Questions