
Software Programming : Java Programming QUESTIONS AND ANSWERS :: part7 : 6 to 10
Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :
6.class MyClass { public static void main(String[] args) { int k = 0; int l = 0; for (int i=0;i<=3;i++) { k++; if (i==2) break; l++; } System.out.println(k+", "+l); } } |
| The program will fail to compile |
| The program will print 3, 3 when run |
| The program will print 4, 3 when run if break is replaced by continue |
| The program will fail to compile if break is replaced by return |
| The program will fail to compile if break is simply removed. |
7.How restrictive is the default accessibility compared to public, protected, and private accessibility? |
| Less restrictive than public |
| More restrictive than public, but less restrictive than protected |
| More restrictive than protected, but less restrictive than private |
| More restrictive than private |
| Less restrictive than protected from within a package, and more restrictive than protected from outside a package. |
8.Given the following definition of a class, which fields are accessible from outside the package com.corporation.project? package com.corporation.project; public class MyClass { int i; public int j; protected int k; private int l; } Select the correct answer. |
| Field i is accessible in all classes in other packages |
| Field j is accessible in all classes in other packages |
| Field k is accessible in all classes in other packages |
| Field l is accessible in all classes in other packages |
| Field l is accessible in subclasses only in other packages. |
9.Given the following member declarations, which statement is true? int a; //(1) static int a; //(2) int f() { return a; } //(3) static int f() { return a; } //(4) |
| Declarations (1) and (3) cannot occur in the same class definition |
| Declarations (2) and (4) cannot occur in the same class definition |
| Declarations (1) and (4) cannot occur in the same class definition |
| Declarations (2) and (3) cannot occur in the same class definition |
| None of the above. |
10.Which one of the following class definitions is a valid definition of a class that cannot be extended? #96. Which one of the following class definitions is a valid definition of a class that cannot be extended? |
| class Link { } |
| abstract class Link { } |
| native class Link { } |
| static class Link { } |
| final class Link { }. |
More Java Programming QUESTIONS AND ANSWERS available in next pages
-
Health is the greatest gift, contentment is the greatest wealth -Buddha
- TNTET 2021 - Practice
- SSC CGL 2021 - Practice
- TNPSC Group 2A 2021 - Practice
- IIT JEE
- IIT JEE Q&A
- TNPSC Answer Keys
- TNPSC Group 2 Syllabus
-
TNPSC Q&A

- Online Tests - TNPSC
- Online Tests - GK
- IBPS 2020-2021
- Online Tests - Bank
- Online Tests - RRB NTPC
- Online Tests - UGC NET
- Online Tests - TANCET
- Online Aptitude Test
-
Engineering

-
Programming

-
Basic Science

-
Quiz

- Plus Two Question Papers
- SSLC Question Bank
-
Aptitude Tests

-
Logical Reasoning

-
General Knowledge-Hindi

-
Indian History MCQ

-
Indian Geography MCQ

-
Indian Civics MCQ

-
Indian Economics MCQ

-
CTET Biology MCQ

-
CTET Chemistry MCQ

-
CTET Physics Solved MCQ

-
Arithmetic Tests

- Press Release
- FAQ
- Coaching Centres
- TNPSC Group 1 Syllabus
-
TNPSC Group IV Syllabus

- TRB 2017 in English PDF

- TRB 2017 in Tamil PDF

- TET
- TNTET
