10) Which of the following is true?
(a) A finally block is executed before the catch block but after the try block.
(b) A finally block is executed, only after the catch block is executed.
(c) A finally block is executed whether an exception is thrown or not.
(d) A finally block is executed, only if an exception occurs.
(e) None of the above.
(a) A finally block is executed before the catch block but after the try block.
(b) A finally block is executed, only after the catch block is executed.
(c) A finally block is executed whether an exception is thrown or not.
(d) A finally block is executed, only if an exception occurs.
(e) None of the above.
11) Among these expressions, which is(are) of type String?
(a) “0” (b) “ab” + “cd”
(c) ‘0’
(d) Both (A) and (B) above (e) (A), (B) and (C) above.
(a) “0” (b) “ab” + “cd”
(c) ‘0’
(d) Both (A) and (B) above (e) (A), (B) and (C) above.
12) Consider the following code fragment
Rectangle r1 = new Rectangle();
r1.setColor(Color.blue);
Rectangle r2 = r1;
r2.setColor(Color.red);
After the above piece of code is executed, what are the colors of r1 and
r2 (in this order)?
(a) Color.blue
Color.red
(b) Color.blue
Color.blue
(c) Color.red
Color.red
(d) Color.red
Color.blue
(e) None of the above.
Rectangle r1 = new Rectangle();
r1.setColor(Color.blue);
Rectangle r2 = r1;
r2.setColor(Color.red);
After the above piece of code is executed, what are the colors of r1 and
r2 (in this order)?
(a) Color.blue
Color.red
(b) Color.blue
Color.blue
(c) Color.red
Color.red
(d) Color.red
Color.blue
(e) None of the above.
13) What is the type and value of the following expression? (Notice the integer division)
-4 + 1/2 + 2*-3 + 5.0
(a) int -5 (b) double -4.5
(c) int -4
(d) double -5.0 (e) None of the above.
-4 + 1/2 + 2*-3 + 5.0
(a) int -5 (b) double -4.5
(c) int -4
(d) double -5.0 (e) None of the above.
14) What is printed by the following statement?
System.out.print(“Hello,\nworld!”);
(a) Hello, \nworld! (b) Hello, world!
(c)
(d) “Hello, \nworld!” (e) None of the above.
System.out.print(“Hello,\nworld!”);
(a) Hello, \nworld! (b) Hello, world!
(c)
(d) “Hello, \nworld!” (e) None of the above.
15) Consider the two methods (within the same class)
public static int foo(int a, String s)
{
s = “Yellow”;
a=a+2;
return a;
}
public static void bar()
{
int a=3;
String s = “Blue”;
a = foo(a,s);
System.out.println(“a=”+a+” s=”+s);
}
public static void main(String args[])
{
bar();
}
What is printed on execution of these methods?
(a) a = 3 s = Blue (b) a = 5 s = Yellow (c) a = 3 s = Yellow
(d) a = 5 s = Blue (e) none of the above.
public static int foo(int a, String s)
{
s = “Yellow”;
a=a+2;
return a;
}
public static void bar()
{
int a=3;
String s = “Blue”;
a = foo(a,s);
System.out.println(“a=”+a+” s=”+s);
}
public static void main(String args[])
{
bar();
}
What is printed on execution of these methods?
(a) a = 3 s = Blue (b) a = 5 s = Yellow (c) a = 3 s = Yellow
(d) a = 5 s = Blue (e) none of the above.
16) Which of the following variable declaration would NOT compile in a java program?
(a) int var; (b) int VAR; (c) int var1; (d) int var_1; (e) int 1_var;.
(a) int var; (b) int VAR; (c) int var1; (d) int var_1; (e) int 1_var;.
17) Consider the following class definition:
public class MyClass
{
private int value;
public void setValue(int i){ / code / }
// Other methods…
}
The method setValue assigns the value of i to the instance field value. What could you write for the implementation of setValue?
(a) value = i; (b) this.value = i; (c) value == i;
(d) Both (A) and (B) and above (e) (A), (B) and (C) above.
public class MyClass
{
private int value;
public void setValue(int i){ / code / }
// Other methods…
}
The method setValue assigns the value of i to the instance field value. What could you write for the implementation of setValue?
(a) value = i; (b) this.value = i; (c) value == i;
(d) Both (A) and (B) and above (e) (A), (B) and (C) above.
18) Which of the following is TRUE?
(a) In java, an instance field declared public generates a compilation error.
(b) int is the name of a class available in the package java.lang
(c) Instance variable names may only contain letters and digits.
(d) A class has always a constructor (possibly automatically supplied by the java compiler).
(e) The more comments in a program, the faster the program runs.
(a) In java, an instance field declared public generates a compilation error.
(b) int is the name of a class available in the package java.lang
(c) Instance variable names may only contain letters and digits.
(d) A class has always a constructor (possibly automatically supplied by the java compiler).
(e) The more comments in a program, the faster the program runs.
19) A constructor
(a) Must have the same name as the class it is declared within.
(b) Is used to create objects.
(c) May be declared private
(d) Both (A) and (B) above
(e) (a), (b) and (c) above.
(a) Must have the same name as the class it is declared within.
(b) Is used to create objects.
(c) May be declared private
(d) Both (A) and (B) above
(e) (a), (b) and (c) above.
20) Consider,
public class MyClass
{
public MyClass(){/code/}
// more code…
}
To instantiate MyClass, you would write?
(a) MyClass mc = new MyClass();
(b) MyClass mc = MyClass();
(c) MyClass mc = MyClass;
(d) MyClass mc = new MyClass;
(e) The constructor of MyClass should be defined as, public void MyClass(){/code/}.
public class MyClass
{
public MyClass(){/code/}
// more code…
}
To instantiate MyClass, you would write?
(a) MyClass mc = new MyClass();
(b) MyClass mc = MyClass();
(c) MyClass mc = MyClass;
(d) MyClass mc = new MyClass;
(e) The constructor of MyClass should be defined as, public void MyClass(){/code/}.
Top 10 Sites for your career
1. Linkedin
2. Indeed
3. Naukri
4. Monster
5. JobBait
6. Careercloud
7. Dice
8. CareerBuilder
9. Jibberjobber
10. Glassdoor
10 Tech Skills in demand
1. Machine Learning
2. Mobile Development
3. SEO/SEM Marketing
4. Data Visualization
5. Data Engineering
6. UI/UX Design
7. Cyber-security
8. Cloud Computing/AWS
9. Blockchain
10. IOT
11 Sites for Free Online Education
1. Coursera
2. edX
3. Khan Academy
4. Udemy
5. iTunesU Free Courses
6. MIT OpenCourseWare
7. Stanford Online
8. Codecademy
9. ICT iitr
10 ICT iitk
11 NPTEL
10 Sites to learn Excel for free
1. Microsoft Excel Help Center
2. Excel Exposure
3. Chandoo
4. Excel Central
5. Contextures
6. Excel Hero b.
7. Mr. Excel
8. Improve Your Excel
9. Excel Easy
10. Excel Jet
10 Sites to review your resume for free
1. Zety Resume Builder
2. Resumonk
3. Resume dot com
4. VisualCV
5. Cvmaker
6. ResumUP
7. Resume Genius
8. Resumebuilder
9. Resume Baking
10. Enhancy
10 Sites for Interview Preparation
1. Ambitionbox
2. AceThelnterview
3. Geeksforgeeks
4. Leetcode
5. Gainlo
6. Careercup
7. Codercareer
8. InterviewUp
9. InterviewBest
10. Indiabix
1. Linkedin
2. Indeed
3. Naukri
4. Monster
5. JobBait
6. Careercloud
7. Dice
8. CareerBuilder
9. Jibberjobber
10. Glassdoor
10 Tech Skills in demand
1. Machine Learning
2. Mobile Development
3. SEO/SEM Marketing
4. Data Visualization
5. Data Engineering
6. UI/UX Design
7. Cyber-security
8. Cloud Computing/AWS
9. Blockchain
10. IOT
11 Sites for Free Online Education
1. Coursera
2. edX
3. Khan Academy
4. Udemy
5. iTunesU Free Courses
6. MIT OpenCourseWare
7. Stanford Online
8. Codecademy
9. ICT iitr
10 ICT iitk
11 NPTEL
10 Sites to learn Excel for free
1. Microsoft Excel Help Center
2. Excel Exposure
3. Chandoo
4. Excel Central
5. Contextures
6. Excel Hero b.
7. Mr. Excel
8. Improve Your Excel
9. Excel Easy
10. Excel Jet
10 Sites to review your resume for free
1. Zety Resume Builder
2. Resumonk
3. Resume dot com
4. VisualCV
5. Cvmaker
6. ResumUP
7. Resume Genius
8. Resumebuilder
9. Resume Baking
10. Enhancy
10 Sites for Interview Preparation
1. Ambitionbox
2. AceThelnterview
3. Geeksforgeeks
4. Leetcode
5. Gainlo
6. Careercup
7. Codercareer
8. InterviewUp
9. InterviewBest
10. Indiabix
New C++ features in GCC 10
https://developers.redhat.com/blog/2020/09/24/new-c-features-in-gcc-10/
https://developers.redhat.com/blog/2020/09/24/new-c-features-in-gcc-10/
Red Hat Developer
New C++ features in GCC 10 | Red Hat Developer
The GNU Compiler Collection (GCC) 10.1 was released in May 2020. Like every other GCC release, this version brought many additions, improvements, bug fixes, and
Top 5 programming languages that every beginner should learn in 2020 | TechGig
https://content.techgig.com/top-5-programming-languages-that-every-beginner-should-learn-in-2020/articleshow/78279537.cms
https://content.techgig.com/top-5-programming-languages-that-every-beginner-should-learn-in-2020/articleshow/78279537.cms
TechGig
Top 5 programming languages that every beginner should learn in 2020
Programming has emerged as the most exciting field for techies. Since the pandemic started, there is an uptick in students signing up to learn programming