0
Alien head

programming languages Online Quiz - 252

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

we can not override a synchronized method as non-synchronized method.

  1. True

  2. False


Correct Option: B

static methods cannot be overridden to non-static methods.

  1. True

  2. False


Correct Option: A

Note the code below and select the correct answer: #include main() { printf ("hello world"); }

  1. Will not compile

  2. Will compile without error or warning and run ok

  3. Will compile without error or warning but not run

  4. Will compile with warning but run ok


Correct Option: D

Note the following code and then select the correct answer: #include main() { int i; printf ("enter integer: "); scanf ("%d",&i); printf ("You have entered: %f ", i); return (0); }

  1. Will not compile

  2. Will compile with warnings, but run

  3. Will compile without warning, but not run

  4. Will give an output of 1


Correct Option: C

Code: #include #include #include main() { int i=0, j=0; clrscr(); for (i=0; i<=5;i++) { for (j=0; j

  1. True

  2. False


Correct Option: A

The code below will go into infinite loop: #include #include #include main() { int i=0, j=0; clrscr(); for (i=0; i<5;i++) { for (j=i; j<=0; j--) { printf ("1\t"); } printf("\n"); } getch(); return (0); }

  1. True

  2. False


Correct Option: B

The code above will go into an infinite loop.

  1. True

  2. False


Correct Option: B

The output of the above code is 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

  1. True

  2. False


Correct Option: A

See the code below and select the correct answer: #include #include #include main() { clrscr(); int i; printf ("enter integer: "); scanf ("%d",&i); printf ("You have entered: %d ", i); getch(); return (0); }

  1. Will not compile

  2. Will compile with warning, and run

  3. Will compile but not run

  4. Will provide an output 1


Correct Option: A

See the code below and select the correct answer: #include main() { int i; printf ("enter integer: "); scanf ("%d",&i); printf ("You have entered: %f ", i); return (0); }

  1. Will not compile

  2. Will compile but not run

  3. Will give an output of 1

  4. Will give an output of 1.000000


Correct Option: B

Look at the code below and select the correct answer:#include main(){printf ("hello world");}

  1. Will not compile

  2. Will compile without error but not run

  3. Will compile with warnings but run ok

  4. Will compile with warnings, but not run


Correct Option: C

1) Class A has a Class D 2)Methods in Class A use public methods in Class B 3)Methods in class C use public methods in class A 4)Methods in class A use variables in class C. What is most likely true?

  1. Class D has low Cohesion

  2. Class B has weak encapsulation

  3. Class A has weak encapsulation

  4. Class B has strong encapsulation


Correct Option: B

State which stament is true?

  1. Cohesionn is the OO principle most closely associated with hiding implementation details

  2. Cohesion is the OO principle most closely associated with making sure that classes know about other classes only through their APIs

  3. None of these

  4. Cohesion is the OO principle most closely associated with making sure that a class is designed witha single well focussed principle


Correct Option: D

Select the true statement from the below choices

  1. Interface can extend one or more interfaces

  2. Interface can extend one or more class

  3. Interface cannot implement a class or interface

  4. All of the above


Correct Option: A

A local variable with the same name as an instance variable

  1. shadowing

  2. Coupling

  3. Cohesion

  4. None of the above


Correct Option: A

What is true from the following?

  1. "X extends Y" is correct if and only if X is a class and Y is an interface

  2. "X extends Y" is correct if and only if X and Y are either both classes or both interfaces

  3. "X extends Y" is correct if and only if X is an interface and Y is a class

  4. None of these


Correct Option: B

If a constructor uses super, it must use it in the first line; otherwise, the compiler will complain.

  1. True

  2. False


Correct Option: A

The access modifier of default constructor is not same as class modifier

  1. True

  2. False


Correct Option: A

constructors can be overloaded but can't be overridden and constructors cannot be inherited.

  1. True

  2. False


Correct Option: A

If you write a class with no constructors; the compiler will automatically supplies a no-argument(default)constructors

  1. True

  2. False


Correct Option: A
+ View questions