Monday, June 3, 2013

Java MCQ Test – 2

Que.1. Which of the following is not a return type?
A.    boolean
B.    void
C.    public
D.    Button

Right Answer: C

Que.2. If result = 2+3*5, what is the value and type of result variable?
A.    17, byte
B.    25, byte
C.    17, int
D.    25, int

Right Answer: C

Que.3. The inner class can access private members of the outer class.
A.    False
B.    True

Right Answer: A

Que.4. What is the data type for the number 9.6352?
A.    float
B.    double
C.    Float
D.    Double

Right Answer: B

Que.5. Which of the following statements is true?
A.    The default char data type is a space (“ ”) character.
B.    The default integer data type is int and real data type is float.
C.    The default integer data type is long and real data type is float.
D.    The default integer data type is int and real data type is double.

Right Answer: D

Que.6. What is the meaning of the return data type void?
A.    An empty memory space is returned so that the developers can utilize it.
B.    void returns no data type.
C.    void is not supported in Java.
D.    None of the above.

Right Answer: B


Que.7. What are the interfaces defined by java.lang?
A.    Cloneble
B.    Comparable
C.    Runnable
D.    a,b and c

Right Answer: D

Que.8. Does Java support multiple inheritance?
A.    No
B.    Yes

Right Answer: A

Que.9. Assume that the value 3929.92 is of type float. How to assign this value after declaring the variable interest of type float?
A.    interest = 3929.92
B.    interest = (Float)3929.92
C.    interest = 3929.92(float)
D.    interest = 3929.92f

Right Answer: D

Que.10. ____________ allow primitive data types to be accessed as objects.
A.    Both B and D.
B.    Serialized class.
C.    Primitive class.
D.    Wrapper class.

Right Answer: A

Que.11. What is the value of number after the following code fragment execution?
int number  = 0; int number2 = 12; while (number < number2) { number = number + 1; }
A.    5
B.    12
C.    21
D.    13

Right Answer: B

Que.12. Java beans have no types.
A.    True
B.    False

Right Answer: C

Que.13. __________ are utilized to control the access to an object especially in multi threaded programming.
A.    Asynchronized methods.
B.    Serialized methods.
C.    Synchronized methods.
D.    Both A and C

Right Answer: A

Que.14. What are the two parts of a value of type double?
A.    Significant, Digits, Exponent
B.    Length, Denominator
C.    Mode, Numerator

Right Answer: A

Que.15. Given the following code snippet;
int salaries[]; int index = 0; salaries = new int salaries[4]; while (index < 4) { salaries[index] =  10000; index++; } What is the value of salaries[3]?
A.    40000
B.    50000
C.    15000
D.    10000

Right Answer: D

Que.16. Which of the following statements about the Java language is true?
A.    Both procedural and OOP are supported in Java.
B.    Java supports only procedural approach towards programming.
C.    Java supports only OOP approach.
D.    None of the above.

Right Answer: A

Que.17. A lower precision can be assigned to higher precision value in Java. For exa. A byte data can be assigned to int type.
A.    True.
B.    False.

Right Answer: A

Que.18.
public class returnData
{
[returnType] getData (byte a, double z)
{
return (short)a/z * 10;
}
}
What is valid reurnType for getData?
A.    Int
B.    Byte
C.    Short
D.    Double
Right Answer: D

Que.19. After the following code fragment, what is the value in fname?
String str; int fname; str = “Foolish boy.”; fname = str.indexOf(“fool”);
A.    0
B.    2
C.    -1
D.    4

Right Answer: C

Que.20. __________ can be used to control the order of certain data structure and collection of objects too.
A.    Serial Comparators.
B.    Natural Comparators.
C.    Comparators.
D.    All of above.

Right Answer: C


JavaScript MCQ Test - 2

Que.1. Which of the following statements are false for Java Script?
A.    Variables names are not case sensitive.
B.    Variable names must begin with a letter or the underscore character.
C.    Var is used to declare a variable.
D.    Both b and c above.

Right Answer: A

Que.2. To insert a JavaScript into an HTML page, which tag is used?
A.    <script=’java’>
B.    <javascript>
C.    <script>
D.    <js>

Right Answer: C

Que.3. Javascript is an object oriented language?
A.    False
B.    True

Right Answer: B

Que.4. What language defines the behavior of a web page?
A.    HTML
B.    CSS
C.    XML
D.    Java Script

Right Answer: D

Que.5. Which of the ways below is incorrect of installing a date?
A.    new Date(dateString)
B.    new Date()
C.    new Date(seconds)
D.    new Date(year, month, day, hours, minutes, seconds, milliseconds)

Right Answer: C

Que.6. C-style block-level scoping is not supported in Java script
A.    False
B.    True

Right Answer: B

Que.7. Which of the following statements are true for Java script?
A.    JavaScript is case sensitive.
B.    JavaScript statements can be grouped together in blocks.
C.    semicolon at the end of statements is mendetory.
D.    Both a and b above.

Right Answer: D

Que.8. Which of the following is the tainted property of a window object in Java Script?
A.    Pathname
B.    Protocol
C.    Defaultstatus
D.    Host

Right Answer: C

Que.9. JavaScript ignores extra spaces.
A.    True
B.    False

Right Answer: A

Que.10. If we don’t want the script to write page content, under which HTML tag should the JS tag be placed?
A.    <body>
B.    <head>
C.    Any of a and b above
D.    Both b and c above.

Right Answer: A

Que.11. Why so Java and Java Script have similar name?
A.    Java Script is a stripped – down version of Java.
B.    The syntax of JavaScript is loosely based on Java syntax.
C.    They both support Object Oriented Programming.
D.    None of the above.

Right Answer: B

Que.12. Which of the following method is used to evaluate a string of Java Script code in the context of the specified object?
A.    Eval
B.    ParseDouble
C.    ParseObject
D.    Eflot

Right Answer: A

Que.13. Which is the correct way to write a JavaScript array?
A.    var txt = new Array(1:”arr”,2:”kim”,3:”jim”)
B.    var txt = new Array:1=(“arr”)2=(“kim”)3=(“jim”)
C.    var txt = new Array(“arr”,”kim”,”jim”)
D.    var txt = new Array=” arr ”,”kim”,”jim”
Right Answer: C

Que.14. What is negative infinity in Java script?
A.    Any of the below.
B.    number in JavaScript, derived by dividing number by negative number.
C.    number in JavaScript, derived by dividing number by zero.
D.    number in JavaScript, derived by dividing negative number by zero.

Right Answer: A

Que.15. Which of the following is not a valid JavaScript variable name?
A.    2java
B.    _java_and_java_names
C.    Javaandjava
D.    None of the above.

Right Answer: A

Que.16. ___________ JavaScript is also called client-side JavaScript.
A.    Microsoft
B.    Navigator
C.    LiveWire
D.    Native

Right Answer: B

Que.17. How to append a value to an array of Java Script?
A.    arr[arr.lenght] = value
B.    arr[arr.lenght+1] = new Arrays()
C.    arr[arr.lenght-1] = value
D.    arr[arr.lenght*1] = value

Right Answer: A

Que.18. Java script can be used for Storing the form’s content to a database file on the server.
A.    False
B.    True.

Right Answer: A

Que.19. Which of the following is used to capture all click events in window?
A.    window.captureEvents(Event.CLICK);
B.    window.routeEvents(Event.CLICK);
C.    window.handleEvents(Event.CLICK);
D.    window.raiseEvents(Event.CLICK);

Right Answer: A

Que.20. What is the event that fires when the form elements: <button>.<textarea> loses the focus?
A.    Onclick
B.    Ondblclick
C.    Onfocus
D.    Onblur

Right Answer: D