Προς το περιεχόμενο

Ερωτήσεις σε συνεντεύξεις προγραμματιστών.


Γηρυόνης

Προτεινόμενες αναρτήσεις

Παιδιά αυτές είναι μερικές ερωτήσεις που βρήκα τυχαίως ενώ έψαχνα στο Διαδίκτυο. Λέγεται ότι τις ρωτάνε σε υποψήφιους προγραμματιστές εν ώρα συνέντευξης. Μερικές είναι εύκολες, μερικές είναι δύσκολες και άλλες είναι τελείως εκτός τόπου και χρόνου. Εγώ τις παραθέτω εδώ και όποιος έχει χρόνο και όρεξη ας ρίξει μία ματιά. Είναι στα αγγλικά γιατί βαριόμουνα να τις μεταφράσω. Αν θέλετε τις λύσεις θα τις καταχωρήσω σε λίγες ημέρες.<p>

The Flood, The Bridge, and The Flashlight

There are four people on one side of a river at night. There is a flood coming, and they need to get across a bridge to the other side before the flood washes it out. The flood arrives in 17 minutes. The bridge is rickety and can only support the weight of two people at a time. Since the bridge is old, pieces of it are missing, requiring a flashlight to cross without falling. The people who need to cross take varying amounts of time to cross the bridge. Each person takes one minute, two minutes, five minutes, and ten minutes, respectively, to cross. Therefore, what has to happen is that two must cross with the flashlight, and one must shuttle the flashlight back, then repeat.<p>How can all four get across the bridge in 17 minutes?<p>

The Trilogy Question

<p>There are 100 lockers in a single row numbered in order 1 through 100. You are going to "toggle" the lockers when told to. By toggle, it means to open it if it is closed, and close it if it is open. All the lockers start off closed. Begin by toggling all the lockers beginning at 1 that are multiples of one. Then toggle all the lockers beginning at 2 that are multiples of two. And so on with numbers that are multiples of 3, 4, 5, etc. all the way through 100.<p>When you are done, how many lockers are open?<p>

Microsoft Take III

You are in a boat floating in a swimming pool. You have a brick. If the brick goes to the bottom of the pool, will the water in the pool rise, lower or stay the same?<p>

Tal Moshaiov?s Question

A man dies and arrives to the gates of the next world. He sees 2 gates. One of the gates leads to Heaven and one to Hell, however they?re unmarked. At each door stands a guard. We know that the guard to Hell always lies and that the guard to Heaven always tells the truth. The man is granted with one question to ask one of the guards to figure which gate should he enter. What is the proper question?<p>

Another Microsoft Question

You have one gold bar that you are going to use to pay a guy who works for you. The gold bar has grooves to be split 6 times (making 7 pieces). Imagine it is kind of like a Kit Kat? bar. You need him to work for you for seven days and he gets paid with one section of the gold bar each day. You must pay him daily.<p>You can only break the gold bar TWICE.<p>How do you break it twice and still manage to pay him for each day?s work?<p>

Westwood Studios

This test was designed to determine speed, accuracy, and general problem solving abilities. When answering these questions, try to complete each problem swiftly and accurately. You may not use any reference materials nor a calculator, so please show all of your work.<p>Write a ?C? function to insert a structure into a circularly linked list based on a key value (ascending order). You will be given a pointer to the current head of the list and a pointer to the new entry to insert. The structure is as follows:<p>typedef struct tag {

int x;// This is the key value

int y;

int color;

struct tag *prev, *next;

} PointType;<p>

The prototype for the function is:<p>PointType *InsertPoint(PointType *head, PointType *new_entry);<p>The function should return a pointer to the head of the list. In this implementation, an empty list is defined as (head == NULL). Otherwise, the head node is the smallest key value, head->next is the node containing the next largest key value.<p>Calculate the following arithmetic problems. Assume all numbers are base 16 and 16 bit quantities (show your work).<p>C0 + 4ab

FE * 2A

FE / D

21-14<p>Assume you want to get the modulus (remainder, or % in ?C?), given x % y. You may also assume that y is always a power of 2. Show the fastest way to do this with a simple formula. Be specific about any arithmetic operations.<p>Assume you want to test variable x (x is non-zero) to see if it is a power of 2. Show the fastest way to do this with a simple formula. Be specific about any arithmetic operations.<p>How many iterations will the function Interesting_Test() be called given the following set of code? <p>void How_Many_Times(void)

{

int loop, value;<p>value = 0xABCD;<p>for (loop = 1; ((value >> 1) & 1) | (loop & 1); loop++)

{<p>Interesting_Test();

if (loop & 1)

{

value >>= 1 ;

}

}

}<p>

Write a function in assembly language (80x86, 6502, 65816, or 680x0) to compare memory against a given key value. The function will take a pointer to the beginning of a block of RAM that is WORD aligned (even), the size (8-bit quantity) of the memory block, and the key value (8-bit). The function must return TRUE (1) or FALSE (0) as to whether the block of RAM consists entirely of sequential repeating occurances of the key value. The function should be as fast as possible.<p>The prototype for the function is:

char VerifyRAMBlock(char *ram, char size, char key_value);<p>You may assume register parameters or stack parameters (please specify which you choose and what registers or stack order the calling routine should use).<p>Explain in English sentences an algorithm to solve the following problem:<p>Assume there is a program that generates data sequences of 16 bytes each. These data sequences are to be stored in a large array in RAM until all processing is complete, and then written to out to disk. A requirement of the program is that all sequences written to disk must be unique. You may assume you have the following RAM available (given n data sequences):<p>n * 16 bytes for data<p>n * 4 bytes for long pointer data<p>n * 2 extra bytes<p>1K of general purpose RAM for variables<p>You need to create a procedure that accepts and stores a single data sequence. Remember, it must not store duplicates, it must not use more than the given amount of RAM, and it must be as fast as possible. Explain (in English) how this routine would work, what data structure would contain the unique data sequences, and how to write them to disk.<p>What is wrong with the following code? Please indicate where there are problems and what the corrections should be.<p>

/* This function takes an integer (16 bit) and a pointer to an allocated character array

and converts the integer to a hex string. The string is of the form 0x1234 where 1234

are hex digits. You may assume the character string is at least 7 bytes long. If i is

zero, the string must be "0x0". Otherwise, leading zeros should be removed. */<p>void itoh(int I, char *s)

{<p>int nibble, loop;<p>*s++ = ?0?;

*s++ = ?x?;<p>/* Is the number 0? */

if (i ==0)

{

*s++ = 0;

}

else

{

/* Go through the number nibble by nibble, starting with the most

significant */

for (loop = 3; loop > 0; loop--)

{

/* Get the nibble by shifting the number over by 12, 8, or 4 */

nibble = (i>>(loop<<4))& 0x000F;<p>/* Is the number in decimal range? */

if (nibble <= 10)<p>/* Convert the number to the character 0 ? 9 */

if (nibble || (*(s-2) != 'x'))

*s++ = '0' + nibble;

else

;

else

*s++ = 'A' + (nibble ? 10);

}

}

*s = '0'; /* null terminate it */

}<p>

Mike Reed?s Question

Assume you have eight (8) balls. The balls are identical in appearance (shape, size and color). All balls are also identical in weight except for one (1), which is slightly heavier than the other seven (7). If all you have to measure the balls is a balance, what is the fewest number of comparisons you can make to find the heavier ball?<p>

Josh Jensen?s Question

You need to reverse the order of bits in an 8-bit element (a byte). For example:<p>11001110<p>would convert to:<p>01110011<p>What is the absolute fastest way to find the reversed order any 8-bit byte?<p>

Gary Strawn?s Question

Gary doesn?t use this question anymore. It only applies to the old x86 processors. The new processors use multiple pipelines and this would not actually be the fastest method for such a processor. But I still like this question anyway. One just has to remember that it only applies to the older-type processors.<p>Suppose you need to swap the values stored in two registers. Assuming the processor does not have a swap command, what is the fastest way to transpose the values in the two registers?<p>

Mike Moore?s Question

You have two lengths of rope. Both ropes take exactly sixty (60) seconds to burn. But the speed at which they will burn varies along their lengths. The sections at which they vary are different for each length. The portions where the ropes burn fast and slow are not given. Despite the varying speed at which they burn, they both burn for exactly sixty (60) seconds before they are totally consumed.<p>Using nothing but the ropes, a lighter and a vessel of water (to extinguish the ropes) how can you determine when exactly fifteen (15) seconds has elapsed?<p>

Bonus Question

Suppose you have a round cake. It has a square portion cut from it. The cake is so masterfully created that it is impossible to determine how many layers it contains. You must divide it into two equal portions (equal amounts of frosting, cake, etc.). What is the proper way to do this with only one cut?<p>

Darren Eggett?s Question

You have 3 light switches in one room and 3 incandescent light bulbs in another room. What?s the fewest number of trips between rooms you can make to determine which switch controls which light?<p> Αυτές είναι... Εγώ πάντως δεν μπόρεσα να τις βρω όλες.<p>[ 24-01-2002: Το μήνυμα επεξεργάστηκε από: Γηριόνης ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

  • Απαντ. 44
  • Δημ.
  • Τελ. απάντηση

-------------------------------

Tal Moshaiov?s Question

-------------------------------<p>Einai gnosto auto...<p>Lisi : "ama rotiso ton allo flouro ti tha mou pei?" <p>-------------------------------

Mike Reed?s Question

-------------------------------

Kanoume to exis: vazoume tis mises apo ti mia meria kai tis alles mises apo tin alli. Pernoume tis pio varies kai tis xanaxorizoume se sti mesi... (diadiki anazitisi :&gt wink.gif" border="0 <p>-------------------------------

Josh Jensen?s Question

-------------------------------

Na vroume to simpliroma tou:<p> 1....111

-????????

simpliroma<p>-------------------------------

Gary Strawn?s Question

-------------------------------

Isxei mono gia aritmitikes times.<p>Esto x,y

x = x+y

y = x-y

x = x-y<p>mas to valane sto tei auto... 2 atoma to kaname<p>-------------------------------

Darren Eggett?s Question

-------------------------------<p>kai auto gnosto...<p>anoigeis ton proto diakopti gia arketi ora. meta ton kleineis kai anoigeis ton deutero. pigeneis sto allo domatio. an einai anoikti einai o 2os. An oxi kai eiani zesti tote o protos (kalo??) allios eiani o tritos!<p>

Westwood Studios <---- to paragamisan autoi!<p>mipos mporei kapoios na metafrasei at 2 prota sta ellinika ? smile.gif" border="0

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Ναι δίκαιο έχεις τα πιο πολλά είναι γνωστά. Αυτό με τους φρουρούς, τις λάμπες και τις μπίλιες τα είχα ξαναακούσει. Ο γρίφος του Josh Jensen λέει να αντιστρέψεις έναν αριθμό όχι να βρεις το συμπλήρωμά του. Π.χ. αν ο αριθμός είναι 1101 τότε ο αντιστρέψιμος είναι 1011.<p> Για το πρώτο λέει ότι στη μία όχθη του ποταμού είναι τέσσερα άτομα. Είναι νύχτα και έχουνε μόνο ένα φακό. Θέλουνε να περάσουνε απένταντι αλλά η γέφυρα κρατάει μόνο δύο άτομα κάθε φορά. Δεδομένου ότι του πρώτου του παίρνει 1 λεπτό, του δεύτερου 2, τρίτου 5 και τέταρτου 10 πώς γίνεται να περάσουνε απέναντι σε 17 λεπτά;<p> Ο δεύτερος λέει ότι έχεις 100 ντουλάπια. Όταν σου πούνε πρέπει να ανοίξεις όσα είναι κλειστά και να κλείσεις όσα είναι ανοιχτά. Αρχίζεις από το 1 και τα πολλαπλάσιά του. Μετά πας στο 2 και τα πολλαπλάσιά, στο 3, στο 4... και συνεχίζεις μέχρι το 100. Όταν αρχίζεις όλα είναι κλειστά. Όταν τελειώσεις πόσα θα είναι ανοιχτά;<p>[ 25-01-2002: Το μήνυμα επεξεργάστηκε από: Γηριόνης ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Αυτό με τις μπίλιες μάλλον εννόεις οτι πέρνεις αυτές που ζυγίζουν λιγότερο...Αν και δε νομίζω να είναι έτσι...Αυτό είναι το προφανές και το πιο χρονοβόρο.<p>Επίσης αυτο με την μπάρα χρυσού, την κόβουμε 2 φορές έτσι ώστε να έχουμε

1, 2 και 4 κομμάτια (7 σύνολο)<p>1 μέρα του δίνουμε το 1

2 του πέρνουμε το 1, δίνουμε 2

3 μέρα του δίνουμε το 1

πιστεύω καταλάβατε πως πάει.<p>Αυτο με τις λάμπες και τους φρουρούς όντως γνωστό.

Αυτό με την γέφυρα κάπου το έχω ξαναδεί. Προσπάθησα να το βγάλω τώρα αλλά λιγότερο απο 19 λεπτά δεν ξέρω :-\<p>Θα σας πω και εγώ ένα που μου είπανε κάποτε σε μια διαδρομή μετά τα μεσάνυχτα με το τρένο για Σαλόνικα...και είχαμε φρικάρει όλοι γιατι μπήκαμε βαθειά στην ψυχολογία του γρίφου.<p>Σε ένα μοναστήρι, βγαίνει ο αρχι-μοναχός και λέει σε όλους τους άλλους που τους έχει μαζέψει στην αυλή.<p>-Το κακό θα χτυπήσει το μοναστήρι μας αύριο το πρωί με το να βάλει ένα ανάγλυφο σημάδι στο μέτωπο κάποιου. Όποιος αντιληφθεί ότι έχει το σημάδι, πρέπει να αυτοκτονήσει ΑΜΕΣΩΣ!. Το κακό θα χτυπήσει ΤΟΥΛΑΧΙΣΤΟΝ ένα! (μπορεί να χτυπήσει και όλους)<p>Δεδομένουν ότι υπάρχει όρκος σιωπής στο μοναστήρι και δεδομένου ότι δεν υπάρχουν καθρεύτες, τα ερωτήματα είναι 2.<p>1.πως ήταν σίγουρος 100% κάποιος ότι έχει το σημάδι

και

2.πόση ώρα θα διαρκούσε το κακό? (Πέθαιναν όλοι όσοι το έιχαν)<p> smile.gif" border="0

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Cue epidh mou fenetai oti to jerw auto pou les, mou fenetai oti pareleipses na peis oti oi monaxoi synantiountai oloi mazi mono mia fora thn hmera sto meshmeriano geuma kai kathontai se ena orthogonio trapezi o enas apenanti apo ton allon.<p>Apo oti thimamai h lysh einai oti otan kathetai kapoios apo mia pleura tou trapeziou blepei tous apenanti tou. An dei oti kapoios apo tous apenanti tou exei to shmadi tote ejekolouthei kai thn epomenh mera na kathetai apo ekeinh thn meria tou trapeziou. An pali dei oti kanenas den exei shmadi tote thn epomenh mera allazei pleura kai kathetai apo thn allh. Sto telos profanos tha meinei monos apo thn mia pleura aftos pou exei to shmadi.<p>Den thimamai an einai akribws etsi giati exw merikous mhnes pou to exw akousei.

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Αυτό με τους μοναχούς πρώτη φορά το ακούω. Αυτό με τις μπίλιες ρωτάει ποιός είναι ο μικρότερος αριθμός συγκρίσεων που μπορείς να κάνεις και όχι ο πιο χρονοβόρος.<p> Αυτό με τη γέφυρα είναι στην ουσία απλό. Ας πούμε ότι ο Α κάνει 1 λεπτό, ο Β 2, ο Γ 5 και ο Δ 10. Περνάνε ο Α και ο Β (2 λεπτά σύνολο). Ο Α πάει πίσω με το φακό (3 λεπτά σύνολο). Δίνει το φακό στο Δ και περνάνε ο Δ και ο Γ (10 λεπτά και 3 από πρίν 13). Δίνουνε το φακό στο Β και περνάει απέναντι (2 λεπτά και 13 από πριν 15). Α και Β περνάνε τελευταίοι (2 λεπτά και 15 από πριν = 17).<p>[ 25-01-2002: Το μήνυμα επεξεργάστηκε από: Γηριόνης ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

ivas:<p>Καταρχήν είναι μοναχοί (αλλά δε θα τα χαλάσουμε εδώ tongue.gif" border="0 )

Δε ξέχασα να αναφέρω κάτι.

Δε κάθονται σε κανένα τράπέζι,

απλά το άλλο πρωι βγαίνουν όλοι στην αυλή και ξεκινάει η όλη φάση.<p>Ωραίος Γηριόνη wink.gif" border="0

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Γηριόνης:<p>

Westwood Studios

This test was designed to determine speed, accuracy, and general problem solving abilities. When answering these questions, try to complete each problem swiftly and accurately. You may not use any reference materials nor a calculator, so please show all of your work.<p>Calculate the following arithmetic problems. Assume all numbers are base 16 and 16 bit quantities (show your work).<p>C0 + 4ab

FE * 2A

FE / D

21-14<p><hr></blockquote>

καλα αυτό παραείναι εύκολο

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>

Assume you want to get the modulus (remainder, or % in ?C?), given x % y. You may also assume that y is always a power of 2. Show the fastest way to do this with a simple formula. Be specific about any arithmetic operations.

<hr></blockquote><p>Λοιπόν<p>unsigned int rem(unsigned int x, unsigned int y)

{

int n=0;

int tmp;<p>y>>=1;

while (y)

{

n++;

y>>=1;

}<p>return (x-(1<<n));

}<p>Ολισθήσεις προσθέσεις και αφαιρέσεις μόνο. Για 16 bit αριθμός στην χειρότερη περίπτωση θα γίνουν 15 προσθέσεις, 1 αφαίρεση και 17 shifts.<p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>

Assume you want to test variable x (x is non-zero) to see if it is a power of 2. Show the fastest way to do this with a simple formula. Be specific about any arithmetic operations.

<hr></blockquote><p>short int checkX(unsigned int x)

{

int n=0;

while (n<=1)

{

x>>=1;

n+=(x & 1);

}<p>return (n>1)?0:1

}<p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>

How many iterations will the function Interesting_Test() be called given the following set of code? <p>void How_Many_Times(void)

{

int loop, value;<p>value = 0xABCD;<p>for (loop = 1; ((value >> 1) & 1) | (loop & 1); loop++)

{<p>Interesting_Test();

if (loop & 1)

{

value>>= 1 ;

}

}

}

<hr></blockquote><p>Θα τρέξει σίγουρα την πρώτη φορα γιατί το loop & 1 είναι TRUE

ABCDh=1010 1011 1100 1101b

To if είναι true άρα το value θα γίνει 55E6

55E6=0101 0101 1110 0110. ʼρα θα τρέξει πάλι μετα το shift και η τιμή θα παραμείνει ίδια.

Τώρα το value είναι 3 οπότε πάλι θα τρέξει. Το value θα γίνει τώρα 2ΑF3.

Μέχρι τώρα η Interesting_Test(); εχει κληθεί 3 φορές. <p>Τώρα το loop είναι 4, και πάλι θα μπεί μεσα στο for, οπότε έχουμε 4η κλήση. Στην επόμενη έχουμε 5 κλήση και το value γίνεται 1579. ʼρα 5η κλήση.

Τώρα στην επόμενη το loop είναι 6, και το ((value>>1) & 1) κάνει μηδεν , οπότε τελειώσαμε. Συνολικά 5 κλήσεις.<p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>

Write a function in assembly language (80x86, 6502, 65816, or 680x0) to compare memory against a given key value. The function will take a pointer to the beginning of a block of RAM that is WORD aligned (even), the size (8-bit quantity) of the memory block, and the key value (8-bit). The function must return TRUE (1) or FALSE (0) as to whether the block of RAM consists entirely of sequential repeating occurances of the key value. The function should be as fast as possible.<p>The prototype for the function is:

char VerifyRAMBlock(char *ram, char size, char key_value);<p>

You may assume register parameters or stack parameters (please specify which you choose and what registers or stack order the calling routine should use).<p><hr></blockquote><p>80x86 assembly<p>Ας υποθέσουμε οτι οι παράμετροι περνιούνται μέσω της στίβας.<p>_checkRam proc FAR<p>PUSH BP

MOV BP,SP χρησιμοποιούμε τον ΒP για δείκτη στις παραμέτρους

PUSH ..... κάνουμε PUSH όλους τους καταχωρητές<p>MOV BΧ, [bP+4] αποθηκευση της διευθυνσης στον ΒΧ

MOV CX, [bP+6] ...

MOV DX, [bP+8] ...<p>START:

DCR CX αν τελειωσε το κομμάτι μνήμης τέλος

JZ SUCC <p>MOV AX,[bX]

CMP DX

JNZ ERR<p>INR AX

JMP START<p>SUCC:

MVI AX,1

JMP EXIT<p>ERR:

MVI AX,0<p>EXIT:

POP .....

RET<p>

<p>Αυριο τα υπόλοιπα. Εχω εξεταστική γαμώτο και εσεις με πορώνετε. grin.gif" border="0 <p>[ 25-01-2002: Το μήνυμα επεξεργάστηκε από: bandito ]<p>[ 25-01-2002: Το μήνυμα επεξεργάστηκε από: bandito ]</p>
Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>

Josh Jensen?s Question<p>You need to reverse the order of bits in an 8-bit element (a byte). For example:<p>11001110<p>would convert to:<p>01110011<p>What is the absolute fastest way to find the reversed order any 8-bit byte?<p><hr></blockquote><p>Δεν μπορώ να καταλάβω τι εννοεί σε αυτό. Μα φυσικά απο άποψη ταχύτητας ο πιο γρήγορος τρόπος είναι ενα look-up table με έτοιμες αντιστοιχίες.<p>Αν τώρα εννοεί αλγοριθμικά, θα μπορούσε να είναι το παρακάτω<p>unsigned int reverse(unsigned int byte)

int pos=8;

unsigned int rev;<p>while (pos)

{

rev|=((byte & 1)<<pos);

pos--;

byte>>=1;

}

return rev;

}<p>1 call για την συναρτηση, 8 or, 8 and, 8 αφαιρέσεις, 16 ολισθήσεις, 8 συγκρίσεις και 3 ανάθεσεις.

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Eίναι σωστή η πρώτη σου σκέψη. Εννοεί ένα table look-up. Επίσης αυτό μπορεί να γίνει στη Java (δε λέω αλγοριθμικώς γιατί είναι έτοιμες οι μέθοδοι που χρησιμοποιούμε) με<p><blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr><pre>

protected StringBuffer reverse(String reversable)

{

StringBuffer reversed = new StringBuffer();<p> char [] reverse = reversable.toCharArray();

for (int i=reverse.length-1; i>=0; i--)

reversed.append(reverse);<p> return reversed;

}

</pre><hr></blockquote><p>[ 26-01-2002: Το μήνυμα επεξεργάστηκε από: Γηριόνης ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Και κάτι για όσους ασχολούντε με Java (και όχι μόνο).<p>

What are different types of variables, including integral data types.

 

1. Int, floating point data types, and character data types.

2. Floating point data types, and character data types.

3. None of the above<p>

You can perform a variety of mathematical Operations in Java, include:

<p>1. Basic arithmetic, Boolean algebra and bitwise operations on binary numbers.

2. Boolean algebra and bitwise operations on binary numbers.

3. Bitwize operations on binary numbers.

4. None of the above<p>

Sometimes you will need to convert one data type to another. What is this called?

<p>1. Typing

2. Casting

3. Hiding

4. All of the above<p>

The Math class contains a large number of math functions. Which belong to the group?

<p>1. sine, cosine, negative

2. random, positive

3. cosine, exponent, log, max, abs, asine, atan, ceil,min,pow,random,rint

4. None of the above<p>

What command line is used to print out to the screen.

<p>1. system.pintln.out

2. cout

3. jout

4. System.out.println<p>

The switch(variable) statement with the case options is used for:

<p>1. Checking one option

2. Multiple decisions

3. Switching to another mode.

4. None of the above<p>

All the case values for a switch are enclosed between the braces for the switch statement and they can appear in any order.

<p>1. True

2. False<p>

There is not a case value for each possible choice in the switch, and they must all be unique.

<p>1. True

2. False<p>

The default case is optional in a switch statement.

<p>1. True

2. False<p>

What does initialize mean?

<p>1. To begin.

2. To assign a value as a starting point to a variable.

3. To assign a value as an ending point to a variable.

4. To end.

5. None of the above<p>

What does this statement do: int num = 1 + (int)(99.*Math.random());

<p>1. Sets a number to the value of 1.

2. Uses the math.h library to set the number to 99.

3. Sets num to work as a random value from 1 to 100.

4. None of the above<p>

if (expression) statement;

<p>1. Expression can not be any that produces a value true or false

2. If the value of expression is true, the statement on the line after the if is executed, otherwise it is ignored.

3. None of the above<p>

Modulus operator symbol % is used in what circumstances?

<p>1. where you may want division with decimal values.

2. where you may want division to return an integer value only.

3. where you may want the remainder by division.<p>

What goes inside the parentheses in this line: g.setColor( );

<p>1. Color.blue

2. color

3. green.Color

4. Color.BLUE<p>

Explain: public void paint(Graphics g) g.fillOval(27,65,100,50);

<p>1. Graphics opens an oval down 27 and over 65 to 100 down and 50 over.

2. Paint will fill the whole screen with an oval.

3. Paint allows graphics commands to draw designs like an oval.

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

bandito:<p>Ολισθήσεις προσθέσεις και αφαιρέσεις μόνο. Για 16 bit αριθμός στην χειρότερη περίπτωση θα γίνουν 15 προσθέσεις, 1 αφαίρεση και 17 shifts.<p>to shift einai i aritmitiki olistisi? [rotisa m@l@k** ? ]

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Dvs:

<strong>bandito:<p>Ολισθήσεις προσθέσεις και αφαιρέσεις μόνο. Για 16 bit αριθμός στην χειρότερη περίπτωση θα γίνουν 15 προσθέσεις, 1 αφαίρεση και 17 shifts.<p>to shift einai i aritmitiki olistisi? [rotisa m@l@k** ? ]</strong><hr></blockquote><p>

Να, γι'αυτο δεν θέλω να χρησιμοποιώ ελληνικούς όρους. Γιατί γίνεται μπάχαλο (στην Αγγλία οι γιατροί λένε Cardiology ή science that examines heart diseases?). Τέσπα. Shift, είναι ολίσθηση κατα ένα bit δεξιά ή αριστερά. Αν πχ έχουμε τον αριθμό 10011101 μετά απο μια δεξιά ολίσθηση θα έχουμε 01001110. Είναι αρκετά γρήγορη πράξη για τον υπολογιστή (1 κύκλος ρολογιού μόνο για κάθε 1 bit).<p>Γηριόνη, να το πάρει το ποτάμι για την Java?<p>[ 26-01-2002: Το μήνυμα επεξεργάστηκε από: bandito ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Ο δεύτερος λέει ότι έχεις 100 ντουλάπια. Όταν σου πούνε πρέπει να ανοίξεις όσα είναι κλειστά και να κλείσεις όσα είναι ανοιχτά. Αρχίζεις από το 1 και τα πολλαπλάσιά του. Μετά πας στο 2 και τα πολλαπλάσιά, στο 3, στο 4... και συνεχίζεις μέχρι το 100. Όταν αρχίζεις όλα είναι κλειστά. Όταν τελειώσεις πόσα θα είναι ανοιχτά<p>

στο 4... --> pou stamatame?

An stamatame sto 9 mipos psaxoume gia tous protous aritmous? (protos aritmos einai o aritmos pou diaireitai me to 1 kai ton auto tou mono!, px 7)

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

The trilogy question:<p>Αφού τα ντουλάπια ξεκινάνε όλα κλειστά, κάθε 2 φορές που περνάμε το ντουλάπι θα είναι πάλι κλειστό. ʼρα ψάχνουμε να βρούμε τους αριθμούς εκείνους απο το 1 εως το 100, που έχουν περιττό αριθμό διαιρετών. Προφανώς για να έχουν περιττό αριθμό διαιρετών, πρέπει ένας να επαναλαμβάνεται άρα τα μόνα ντουλάπια που θα μείνουν ανοιχτά είναι αυτά που έχουν ακέραια ρίζα.

Τα ντουλάπια που θα μείνουν ανοικτά είναι τα 100, 81, 64, 49, 36, 25,16,9,4,1 ήτοι 10 τον αριθμό.<p>[ 26-01-2002: Το μήνυμα επεξεργάστηκε από: bandito ]<p>[ 26-01-2002: Το μήνυμα επεξεργάστηκε από: bandito ]</p>

Συνδέστε για να σχολιάσετε
Κοινοποίηση σε άλλες σελίδες

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.


  • Δημιουργία νέου...