circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





EQ Archive

 

Test Your EQ — Issue #145

Each month, Test Your EQ presents some basic engineering problems for you to test your Engineering Quotient. What's your EQ?


Problem 1—In the figure below, the J and K inputs of all the flip-flops are held at logic high. What is the frequency of the output signal if the clock is 10kHz?

Answer

Problem 2—What key piece of information is missing from the CP/M filesystem?

Answer


Problem 3—
In nanotechnology, the basic gate is a 3 input "majority" gate whose output is the majority of all the inputs as shown below. How would you realize AND and OR boolean functions using this gate?

Answer

 

Problem 4—The original single-sided, single-density 8" floppy disk used by CP/M uses what format, and what is its storage capacity?

Answer

Problem 5— Would the following code work? If yes, what would be the output?


#include <stdio.h>

main() {
    int n=5, f=10;
    printf ("\nn=%*d", f, n);
}

Answer

 

Problem 6— What does the circuit below do?

 


Answer

 

Problem 7—A circular disc can rotate clockwise and back. Use minimum hardware to build a circuit to indicate the direction of rotation.


Answer

Problem 8—Suppose you have some 3-bit data, say, grayscale values for which 000 = black and 111 = white. You have a display device that takes 8-bit data, and you want to extend the bit width of your data to match?

If you just pad the data with zeros, you get the value 11100000 for white, which is not full white for the 8-bit display — that would be 11111111. What can you do?

Answer

Problem 9—The following Perl subroutine is an example of what kind of coding style?


# Argument list is a column number (negative values select
# columns from the right), followed by a list of strings
# containing :-delimited fields
# Returns the sorted list of strings
sub sortbycol {
    my $n = shift;
    map $_->[1],
        sort {$a->[0] cmp $b->[0]}
            map [(split /:/, $_)[$n], $_], @_;
}

Answer

Problem 10—This Perl subroutine is an example of what other transform?


# Argument list is a list of strings to be sorted.
# Returns the list of strings sorted by their last words.
sub sortbylast {
    map +(split ' ', $_, 2)[1],
        sort
            map +(split ' ')[-1] . ' ' . $_, @_;
}

Answer

Problem 11—What is the purpose of the + signs in the previous question's code?

Answer

 

Problem 12—Both of these functions return a pointer to the string "Hello World!":

   char* functionA (void)
   {
     char temp[25];
     strcpy (temp, "Hello World!");
     return &temp;
   }

   char* functionB (void)
   {
     char* temp;
     temp = (char *) malloc (25);
     strcpy (temp, "Hello World!");
     return temp;
   }
Which of these functions is robust and why ?

Answer

Published: August-2002
Previous Month

For more TEST YOUR EQ questions visit our online magazine at www.chipcenter.com/circuitcellar.
 

E-mail eq@circuitcellar.com with questions or comments.