PDA

View Full Version : Help with a few multiple choice question..

johngrit
09-04-2008, 07:47 PM
Doing a multiple choice paper, just need clarification on a few questions...
Any help would be much appreciated...I am a bit of a novice on this

1.

Consider this informal description of some instructions:

if (__________________)

document.write(aNumber is between 1 and 10 inclusive)
else
document.write(aNumber is less than 1 or greater than 10)

Which of the following Boolean conditions could be used to test correctly
the value of aNumber? You can assume that aNumber has been properly
declared and holds an integer value. (Select one option.)

A. (aNumber >= 1) || (aNumber <= 10)
B. (aNumber < 1) || (aNumber > 10)
C. (aNumber >= 1) && (aNumber <= 10)
D. (aNumber > 1) && (aNumber < 10)

2.

Consider the following compound condition:

Y AND (X AND Y)

Which of the following is equivalent to it? (Select one option.)

A. X OR Y
B. X
C. Y AND X
D Y

3.

Consider the following JavaScript program

var number;
number = window.prompt('please enter a number between 1 and 10', '0');
number = parseFloat (number);
if ((number == 1) || (number == 3) || (number == 5))
{
document.write('You have won 2 pounds')
}
else if ((number == 2) || (number != 6))
{
document.write('You have won 4 pounds')
}
else
{
document.write('You have won 8 pounds')
}

What will be displayed if you enter 6 in response to the prompt when the program is run? (Select one option.)

A. You have won 2 pounds
B. You have won 4 pounds
C. You have won 6 pounds
D. You have won 8 pounds

4.

Consider the following fragment of JavaScript

var a = 7;
var b = 4;
var c = a - b;
number = 2 * (16 - b) / 6 + (a * (9 + c) + (c - a));
document.write (number);

What will be displayed when the program is run? (Select one option.)

A. 12
B. 109
C. 44
D. 84
E. Undefined

5.

In which of the following places would you expect to find the definition of a JavaScript event handler function to respond to a button click event?
(Select one option.)

A. After the ONCLICK keyword in the button declaration.
B. In a SCRIPT section in the HEAD of the HTML page where the button is declared.
C. In a SCRIPT section in the BODY of the HTML page where the button is declared.
D. In the FORM declaration which contains the button declaration.

6.

Consider this fragment of JavaScript:

var numArray = [9 , 8 , 7 , 6 , 5];
writeArray ();

function writeArray ()
{
var numArray = [1 , 2 , 3 , 4 , 5 , 6];
for (var count = 1; count < 6; count = count + 1)
document.write(numArray[count] + ' ');
}

What will be displayed when the program is run? (Select one option.)

A. 1 2 3 4 5 6
B. 9 8 7 6 5
C. 2 3 4 5 6
D. 9 8 7 6 5 Undefined

mrhoo
09-04-2008, 08:06 PM
Try sleeping with the teacher....

johngrit
09-04-2008, 09:38 PM
I wish I could but the lecturer is a man..and i aint that way inclined :)

No ideas anyone?

Philip M
09-05-2008, 08:05 AM
I wish I could but the lecturer is a man..and i aint that way inclined :)

No ideas anyone?

Sorry, no-one on this forum is going to help you cheat. :( And it is not in your interests to do so. You cannot go through life cheating your way through your exams, you know. :eek: If you cannot answer these rather simple questions it suggests that you have made little or no effort with the course you are following. That in turn suggests that you may be better off dropping JavaScript and taking up underwater motorcycling instead. :D:D:D

johngrit
09-05-2008, 10:57 AM
Sorry was that supposed to be funny....

If you read my original post correctly..

''Doing a multiple choice paper, just need clarification on a few questions......I am a bit of a novice on this''

then you may understand why i am posting this.

I dont appreciate being accused of cheating.

Philip M
09-05-2008, 11:45 AM
Sorry was that supposed to be funny....

If you read my original post correctly..

''Doing a multiple choice paper, just need clarification on a few questions......I am a bit of a novice on this''

then you may understand why i am posting this.

I dont appreciate being accused of cheating.

Well, what word would you use for getting someone else to answer your question paper for you?

abduraooft
09-05-2008, 12:03 PM
Hi johngrit,

johngrit
09-05-2008, 12:09 PM
How many times I am not getting someone else to answer my paper as you put it..

I have the questions done, just want to make sure I have them right..

If thats wrong then ok

johngrit
09-05-2008, 12:10 PM
And just to add, there are 100 questions..

These are the ones I just wanted clarification on

Philip M
09-05-2008, 12:34 PM
How many times I am not getting someone else to answer my paper as you put it..

I have the questions done, just want to make sure I have them right..

I believe you, but others may not.

JordanW
09-05-2008, 12:56 PM
John, maybe you can tell us which answers you gave, and we can tell you whether or not you got them right and possibly help you with the one's you may not have got right?

Just a suggestion

~Jordan

johngrit
09-05-2008, 01:28 PM