JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
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.
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.
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.
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;.
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.
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.
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.
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/}.
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