CS Midterm

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

To include a header file that you have created, utils.h, in your program, the following preprocessor directive should appear at the beginning of your program.

#include "utils.h"

What character in C will give you the remainder of an integer division? What character in C will give you the quotient of an integer division?

% /

When calling the char2int() function with a radix of 13 and the char 'E' what should be returned

-1

The following binary number uses a 14-bit 2's complement convention to represent a signed integer: 0b11 1111 1101 0111 What is this number in decimal?

-41

What flag needs to be passed to gcc to enable debugging with gdb?

-g

Match the flags passed to the gcc command in the P2 assignment to their definition.

-g Tells gcc to produce extra information that is used for debugging -o Tells gcc to interpret the next argument as the name of the file that will contain the completed executable -std=c11 Tells gcc to compile the code based on the version of C defined in ISO/IEC 9899:2011 -Wall Turns on multiple compiler warnings that can help you create a correct program

To remove a directory with the rm command what additional flag is necessary

-r

Show the 2's complement subtraction of +13 minus +25, with both numbers in binary using 8 bits. Hint: make sure that the resulting binary number corresponds to the correct answer.

00001101 00011001 -00001100

(1.67/5) Show the 2's complement addition of -35 plus +16, with both numbers in binary using 8 bits.

000100011 00010000 00010011

(1.67/5) Show the 2's complement addition of -29 plus +13, with both numbers in binary using 8 bits

00011101 00001101 00000101

What is the 8-bit binary representation of the unsigned decimal value 93? 0b

01011101

What is the 8-bit binary representation of the unsigned decimal value 97?

01100001

A C program has at least how many functions?

1

int val = 5; int x = (val >> 2) & 1 // x = ?

1

The R-S Latch can store...

1 bit of information

List some types of registers

1 bit registers, 16 bit registers.

A not gate is implemented with what?

1 p-type and 1 n-type MOS transistors.

The output of a 3-input NAND gate is 0. This is caused by these input values

1,1,1

Running the following command ./testConv i2a 2 39 will return what value?

100111

What is the 8-bit binary representation of the hexadecimal value 0x9C? 0b

10011100

What is the result of performing the following bitwise operation using 8 bits? (0b11001100 AND 0b10101101) OR (0b00010101) = 0b

10011101

What is the 16-bit binary equivalent of the hexadecimal number 0xB5FE? 0b (show all 16 bits with no spaces)

1011010111111110

What is the 16-bit binary equivalent of the hexadecimal number 0xCD1A? 0b

1100 1101 0001 1010

What is the 16-bit binary equivalent of the hexadecimal number 0xC2AF? 0b

1100001010101111

What is the 8-bit binary representation of the hexadecimal value 0xE9? 0b

11101001

What is the result of performing the following bitwise operations using 8 bits? Show the result in binary. (0b11001010) OR (0b10101100 AND 0b11100111) = 0b

11101110

What is the result of performing the following bitwise operations using 8 bits? Show the result in binary. (0b11100110 AND 0b10110111) OR (0b11010001) = 0b

11110111

A certain forest has 900 trees. You want to identify each tree with a unique bit pattern. If you were to use the minimum number of bits in order to represent all 900 trees, how many bit patterns will remain unused?

124

Use decimal numbers in your answer. There are ___ n-type transistors and ___ p-type transistors in a two input NAND gate.

2 / 2

A combination circuit has inputs A,B,C and D. It should implement the function F = AB+CD. We want a 2-level implementation using AND and OR gates. How many AND and OR gates do we need?

2 AND gates and 1 OR gate

Use decimal numbers in your answer. There are ____________ n-type transistors and _________ p-type transistors in a two input NAND gate.

2 and 2

A Multiplexer selects one of four 16-bit registers and lets its contents pass through. How many Select lines are needed for selection.

2, since with two bits we can specify four choices.

A Multiplexer selects one of four 32-bit inputs as its 32-bit output. How many Select lines are needed for selection.

2, since with two bits we can specify four choices.

unning the following command ./testConv a2i 16 and then entering FE will return what value? (enter only the integer value)

254

What is the result of 0x2591 | 0x00FF in hex

25FF

A decoder with n inputs can have no more than _____ outputs.

2^n

Mux consists of ____ inputs and _____ select lines.

2^n / n

At any time there are exactly ______ transistors in a open state in a 2 input AND gate.

3

Given the following truth table with A and B as input and X and Y as outputs, how many AND and OR gates would we need to implement a circuit in logic with no optimizations that will produce the truth table.

3 AND, 2 OR

A 16 input mux has _____ select lines.

4

The minimum number of transistors required to implement a two input NAND gate is

4

A combination circuit has inputs A,B,C. It should implement the function F = ABC+A'B'C+A'BC', and the function G = ABC + A'B'C'. We want a 2-level implementation using AND and OR gates. How many AND and OR gates do we need, assuming the circuit is implemented directly as specified without any minimization? (NOT Gates are needed, but not counted).

4 AND, 2 OR

In a number system with base 64 what weight does the character at position 2 have with positions starting from 0 (position X in this figure: _ _ _ X _ _ ) More than one answer may apply.

4096 64^2

We have a PLA with inputs A,B,C and outputs D,E,F described by this truth table: If we minimize this PLA table, how many product terms we will finally have?

5

The ascii codes of characters "Z" and "z" are, when specified in hexadecimal

5A and 7A

The minimum number of transistors required to implement a two input OR gate is

6

What is the result of performing the following bitwise operations? Show the result in hexadecimal. (0xAB9 ^ 0xEF5) | (0x62D) = 0x

66D

What is the hexadecimal equivalent of the binary number 0b11110101100? 0x

7AC

A fictitious alphabet has 410 symbols. If you wanted to assign a unique bit pattern to each symbol, what is the minimum number of bits you will need to represent all 410 symbols?

9

A school has 408 students. If you wanted to assign a unique bit pattern to each student, what is the minimum number of bits you will need in order to represent all 408 students?

9

What is the hexadecimal representation of the binary number 0b100111111101? 0x

9FD

A + AB = ...

A

AB + BA' = ...

A

(A'B')' equals...

A + B

What is the result of performing the following bitwise operations? Show the result in hexadecimal. (0x8D7 | 0xBCA) ^ (0x16F) = 0x

AB0

What is the range of signed integers you can represent with 11 bits using two's complement?

Answer 1:-1024 Answer 2:1023

What is the range of unsigned integers you can represent using 7 bits? Minimum (in decimal): Maximum (in decimal):

Answer 1:0 Answer 2:127

What does 64 look like as an unsigned number in binary with 8 bits? 0b What does 64- 1 look like as an unsigned number in binary with 8 bits? 0b

Answer 1:01000000 Answer 2:00111111

What is the binary representations of the signed decimal integer -56? Use 7-bit 2's complement convention. Result = 0b (enter exactly 7 bits)

Answer 1:1001000

Use the man command to answer the following. gcc is a compiler for what languages? C, C++ When gcc is invoked what does is normally do? __________ What does the -g flag specify? ________(You may want to google searching a man file to find the -g option (does this way of searching look similar to another program you have just seen?))

C, C++ Preprocessing, compilation, assembly and linking produce debugging information

What is the result of performing the following bitwise operations? Show the result in hexadecimal. (0x81F | 0x5C4) ^ (0x1A2) = 0x

C7D

A _________ is helpful in identifying the opcode of an instruction.

Decoder

Which circuit has N inputs and up to 2^N outputs. This circuit also has the property that given any combination of values as input, only one of the circuits outputs will have the value 1.

Decoder

Which circuit has the property that only one of its outputs is guaranteed to be1?

Decoder

We indicate complement of a variable by a prime ('). If F' = (A+B').(C+D'), then we have (applying DeMorgan's theorem)

F = A'B + C'D

We indicate complement of a variable by a prime ('). If F' = (A+B').(C+D), then we have (applying DeMorgan's theorem)

F = A'B + C'D'

ANDing a value with a mask can result in the output having more bits set to '1' than the original value.

False

Calling char_to_int() with the radix 10 and the char 'A' will return the integer 10.

False

Have you studied Boolean algebra? If A is TRUE, B is FALSE, then A AND B is

False

It is likely that a program written in a (low level) language for one ISA will also run on a computer having a different ISA.

False

P is false Q is true What is the value of the expression P and (Q and not Q)

False

P is false What is the value of the expression P and not P

False

P is true Q is true What is the value of the expression P and (Q and not Q)

False

P is true What is the value of the expression P and not P

False

You can successfully turn in a file called Numconv.c to the checkin server.

False

Sequential logic circuits are used to implement...

Finite State Machines

Addressing modes and data types are elements of the

ISA

What do the circles on input and/or output lines on a AND gate represent?

Inputs or outputs being inverted

A block of combination logic called "shift left 2" most likely would do this:

Inserts two zeros on the right hand side and everything else is shifted two bits to the left.

Most computers/microprocessors are constructed out of...

MOS transistors

What is the range of signed integers you can represent with 8 bits using two's complement?

Min: -128 Max: 127

What is the range of signed integers you can represent with 6 bits using two's complement?

Min: -32 Max: 31

What is the range of signed integers you can represent with 7 bits using two's complement?

Min: -64 Max: 63

What is the range of unsigned integers you can represent using 10 bits?

Min: 0 Max: 1023

What is the range of unsigned integers you can represent using 11 bits?

Min: 0 Max: 2047

What is the range of unsigned integers you can represent using 7 bits?

Min: 0 Max: 127

A 1 bit adder has ________ gates than a 1 bit multiplier. (Hint build the truth tables for each device)

More

Use the man command to answer this question. less is a program similar to ______ , but it has many more features. Less does not have to read the entire input file before starting, so with large input files it starts up _____than text editorslike vi.

More Faster

Boolean algebraic precedence

NOT (') → AND (.) → OR (+)

If the 2 inputs of a 2 input nand gate are connected together, then the function of the nand gate is that of a?

NOT gate

Is the following number positive or negative (assuming it has been represented using the two's complement convention in 7 bits). 0b1001110

Negative

Is the following number positive or negative (assuming it has been represented using the two's complement convention in 7 bits). 0b1010010

Negative

When called with two files with identical content the diff command will output?

Nothing

P-type transistors act in exactly the _____ way of n-type.

Opposite

Full Adder

PLA that implements a specific truth table

Is the following number positive or negative (assuming it has been represented using the two's complement convention in 7 bits). 0b0100110

Positive

Is the following number positive or negative (assuming it has been represented using the two's complement convention in 7 bits). 0b0110100

Positive

Is the following number positive or negative (assuming it has been represented using the two's complement convention in 7 bits). 0b0111011

Positive

A R-S latch is cleared by setting the _______ signal to _______.

R / 0

Which of the following conditions are allowed in an RS latch? (Multiple answers may apply)

R is asserted, S is negated R is asserted, S is asserted R is negated, S is asserted

(4.17/5) What is the range of unsigned integers that can be stored using 10 bits? What is the range for signed integers represented in 1's and 2's complement, with the same number of bits?

Range of unsigned integers: 0 to 1023 Range of signed integers: -512 to 511 (1's complement) Range of signed integers: -512 to 511 (2's complement)

Inside gdb hitting the return/enter key will do what?

Re-run the last command

A Full Adder has inputs Ai=1, Bi=1, and carry-in Ci=1. What would be the sum bit Si and the carry-out bit Cout?

Si=1, Cout=1

Register

Stores a number of bits, taken together as a unit.

What does the -std=c11 flag do?

Tells gcc to compile the code based on the version of C defined in ISO/IEC 9899:2011

What does the o flag do?

Tells gcc to interpret the next argument as the name of the file that will contain the completed executable

What does the g flag do?

Tells gcc to produce extra info for debugging

addressability

The number of bits stored in each addressable location in memory

The output of an exclusive-OR gate is 1 whenever

The two inputs are different.

By default in gdb the command list followed by a line number or function name will show 10 lines your source file surrounding that line / function. The command set listsize <desired size> can be used to change the default number of lines shown.

True

Calling int_to_char() with radix 10 and the value 10 is an error.

True

Given the statements int x; int *pi; pi is a variable that holds the address of an int (pi's type is a pointer to an int). If pi is initialized to the address of the int x, by the statement pi = &x; using the * operator on pi will give us access to the value of the int x that pi is pointing to and we can set x to 42 with the following statement *pi = 42;

True

In gdb typing help will bring up a list of general help topics. Typing help <topic name> will then bring up a list of sub-topics related to the chosen topic.

True

P is false What is the value of the expression P or not P

True

P is true Q is false What is the value of the expression P and (Q or not Q)

True

P is true What is the value of the expression P or not P

True

The bitwise OR operator can be used to set bits to '1' and the bitwise AND operator can be used to set bits to '0'.

True

The difference between the next command and the step command is next will execute the next line of code without stepping into a function that line may contain, while step will execute the line of code and step into a function if the line contains one.

True

True or False: It is possible to have a register that only stores 1 bit.

True

What does the -Wall flag do?

Turns on multiple compiler warnings that can help you create a correct program

Which output signal is asserted for all possible values for Input1 (most significant) and Input0 (least significant) in binary order 00, 01, 10, 11?

X, Z, W, Y

An analog value can be

a measurement of the length of a rod

Address

a unique identifier for a memory cell

2^2-by-3-bit memory

address space of 4 locations, and addressability of 3 bits.

Sequential Logic Circuits

base decisions on state and previous inputs

In gdb to set a break point at a specific line in your file what command would you use?

break <line number>

Obtain the minimized boolean expression for this combinational function F(a,b,c) using a Karnaugh map.The function is 1 for these input combinations:a,b,c = 000, 010, 100, 101, 110.

c' + ab'

When the write enable input is not asserted, the gated D latch ______ its output.

can not change

The translation between a higher-level language such as C and assembly language (the ISA) is usually done by the ...

compiler

N-type transistor

connected to Ground; pulls voltage down when input is 1.

P-type transistor

connected to Power; voltage UP when input is 0

Master-Slave Flip Flop

current state remains intact, while next state is produced by combinational logic.

open circuit

gate of n-type is supplied with 0 volts

closed circuit

gate of n-type is supplied with 2.9 volts

To use GDB to debug the file testConv what command could you use? (Multiple answers may apply)

gdb then return, once inside gdb: file testConv gdb testConv

In gdb what command can be used to show information on the breakpoints that are set in the file you are debugging?

info breakpoints

You can implement NOR of A and B by (hint: build the truth tables)

inverting A and B and using an AND gate

storage elements

output of storage element is an internal input to the combinational logic circuit.

Inside gdb to run a file called testConv that has already been loaded, with the the following arguments: i2c 10 9 what command would you need?

run i2c 10 9

Mux function

select one of the inputs and connect it to the output

address space

total # of uniquely identifiable locations

A 2-to-4 decoder has two inputs A and B and outputs W, X, Y, Z. When A=1, B=0, Y is selected. When is W selected?

when A=0, B=0

A decoder has two inputs A and B and outputs D0, D1, D2, D3. When A=0, B=0, D0 is selected. When is D3 selected?

when A=1, B=1

What is the output of the following C statement? printf("x%x", 15);

xf

Match the bitwise operator to the operation. | & ^ ~ << >>

| OR & AND ^ XOR ~ NOT / Complement << Left Shift >> Right Shift

Match the following characters to their purpose in a Linux file system.

~ home directory . current directory .. parent directory


संबंधित स्टडी सेट्स

Ch. 13 arterial blood collection

View Set

Interpersonal Communication Final

View Set

Lecture 13 LaunchPad Assignment BIO 2170

View Set

NURSING Fundamentals. Chapter 26 & 27.

View Set

Cyber Security Chapter 7-11 flash cards

View Set

Chapter 14: Infection, Infectious Diseases, and Epidemiology

View Set