0

programming languages Online Quiz - 128

Description: programming languages Online Quiz - 128
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which of the following statements are true?

  1. Methods cannot be overriden to be more private

  2. static methods cannot be overloaded

  3. private methods cannot be overloaded

  4. An overloaded method cannot throw exceptions not checked in the base class


Correct Option: A

Which of the following will output -4.0

  1. System.out.println(Math.floor(-4.7));

  2. System.out.println(Math.round(-4.7));

  3. System.out.println(Math.ceil(-4.7));

  4. System.out.println(Math.min(-4.7));


Correct Option: C

String s=new String("Bicycle"); int iBegin=1; char iEnd=3; System.out.println(s.substring(iBegin,iEnd));

  1. Bic

  2. ic

  3. icy

  4. error: no method matching substring(int,char)


Correct Option: B

What is the result of the following operation? System.out.println(4 | 3);

  1. 6

  2. 0

  3. 1

  4. 7


Correct Option: D

Given the following declarations String s1=new String("Hello") String s2=new String("there"); String s3=new String(); Which of the following are legal operations?

  1. s3=s1 + s2

  2. s3=s1 - s2

  3. s3=s1 & s2

  4. s3=s1 && s2


Correct Option: A

What gets printed when the following code is compiled and run. Select the one correct answer. public class test { public static void main(String args[]) { int i = 1; do { i--; } while (i > 2); System.out.println(i); } }

  1. 0

  2. 1

  3. 2

  4. -1


Correct Option: A
  1. This() is used to invoke a constructor of the same class. super() cannot invoke a superclass constructor.

  2. Super() is used to invoke a constructor of the same class. This() is used to invoke a superclass constructor.

  3. This() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

  4. None of the above.


Correct Option: C

Identify the steps to integrate validator framework in struts? a)Copy validation.xml and validation rules.xml to web-inf directory b)Add errors in resource bundle c)Include validation plug-ins in struts- config.xml d)Add validation plug-ins in web.xml and struts-config.xml e)Add validation plug ins in web.xml f)Include the required form in tag in validation.xml g)include required fields in tag in validation.xml

  1. a,f,g,b

  2. a,g,b

  3. a,b,c,d,e,f

  4. c,a,f,g,b

  5. e,a,f,g,b

  6. d,a,f,g,b


Correct Option: D
  1. Javascript

  2. struts validator

  3. cannot validate

  4. dynamic rows cannot be done in JSP


Correct Option: A

How you will display validation fail errors on jsp page?

  1. none

  2. both


Correct Option: C
  1. (abs (sqrt 8))

  2. (modulo (ceiling (sqrt 8)) 2)

  3. (max (floor (sqrt 8)) (round (sqrt 8)))

  4. (min (truncate (sqrt 8)) (abs (sqrt 8)))


Correct Option: C

(define myList (list 1 2 3 4 5 6 7 8 9)) (- (+ (list-ref mylist 2) (cadr mylist)) (list-ref (cddr mylist) 2)) Output of the above code will be:

  1. 1

  2. -1

  3. 5

  4. 0


Correct Option: D

Which of the following codes will NOT give an error? (i) (display '(1 2 3)) (ii) (display (* (exp 5 2) 2)) (iii) (display (* (expt 5 2) 2)) (iv) (display (+ 5 (display (* 4 2))))

  1. (i) & (ii)

  2. (i) & (iii)

  3. (i) only

  4. (i), (iii) & (iv)


Correct Option: B

3.What is output of following? (define a 97) (integer->char (exact->inexact a))

  1. #\97

  2. #\b

  3. #\a

  4. Compile time error


Correct Option: D

(modulo -15 4) the output will be:

  1. 3

  2. -3

  3. 1

  4. -1


Correct Option: C

(define list1 (list 1 2 3)) (define list2 (list 4 5 6)) (define list3 (list)) (append list3 list1 list2) what will be the output if we display list3?

  1. ((1 2 3 4 5 6))

  2. (1 2 3 4 5 6)

  3. ()

  4. (4 5 6 1 2 3)


Correct Option: C
- Hide questions