6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Home / My courses / UGRD-CS6203C-2233T / PRELIM EXAM / PRELIM EXAM
Started on Monday, 19 June 2023, 8:37 AM
State Finished
Completed on Monday, 19 June 2023, 8:47 AM
Time taken 9 mins 51 secs
Marks 42.00/50.00
Grade 84.00 out of 100.00
Question 1
Incorrect
Mark 0.00 out of 1.00
Modulus operator (%) can be applied to which of these?
a. None of These
b. Integers
c. Both A and B
d. Floating - point numbers
Your answer is incorrect.
Question 2
Incorrect
Mark 0.00 out of 1.00
Which one is true about a constructor ?
a. A constructor is used to create objects
b. A constructor must have the same name as the class it is declared within
c. All of the above
d. A constructor may be declared private
Your answer is incorrect.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 1/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 3
Correct
Mark 1.00 out of 1.00
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
Your answer is correct.
Question 4
Incorrect
Mark 0.00 out of 1.00
A constructor
a. Is used to create objects.
b. May be declared private
c. (a), (b) and (c) above.
d. Must have the same name as the class it is declared within.
Your answer is incorrect.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 2/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 5
Correct
Mark 1.00 out of 1.00
Which polymorphism behavior do you see in below class?
class Paint {
// all methods have same name
public void Color(int x) {}
public void Color(int x, int y) {}
public void Color(int x, int y, int z) {}
a. Run time polymorphism
b. Method overriding
c. Constructor overloading
d. Method overloading
Your answer is correct.
Question 6
Incorrect
Mark 0.00 out of 1.00
Which of these is returned by operator '&' ?
a. Character
b. Integer
c. Boolean
d. Float
Your answer is incorrect.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 3/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 7
Correct
Mark 1.00 out of 1.00
The default value of a static integer variable of a class in Java is,
a. Null
b. 1
c. 0
d. Garbage value
Your answer is correct.
Question 8
Correct
Mark 1.00 out of 1.00
What is the output of the following program: public class testmeth { static int i = 1; public static void main(String args[]) {
System.out.println(i+” , “); m(i); System.out.println(i); } public void m(int i) { i += 2; } }
a. 1,3
b. 1 , 0
c. 1 , 1
d. 3 , 1
Your answer is correct.
Question 9
Correct
Mark 1.00 out of 1.00
Which statement transfers execution to different parts of your code based on the value of an expression?
a. Nested-if
b. If
c. Switch
d. if-else-if
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 4/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 10
Correct
Mark 1.00 out of 1.00
Which one of the following is not true?
a. Abstract methods should be implemented in the derived class.
b. An abstract class cannot have non-abstract methods.
c. A class containing abstract methods is called an abstract class.
d. A class must be qualified as ‘abstract’ class, if it contains one abstract method.
Your answer is correct.
Question 11
Correct
Mark 1.00 out of 1.00
Which of the following are not Java modifiers?
a. friendly
b. public
c. transient
d. private
Your answer is correct.
Question 12
Correct
Mark 1.00 out of 1.00
Which of the following are not Java keywords ?
a. double
b. then
c. case
d. switch
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 5/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 13
Correct
Mark 1.00 out of 1.00
What is byte code in Java?
a. Code generated by a Java compiler
b. Code generated by a Java Virtual Machine
c. Name of Java source code file
d. Block of code written inside a class
Your answer is correct.
Question 14
Correct
Mark 1.00 out of 1.00
Which of the following is not true?
a. An interface is a solution for multiple inheritance in java.
b. An interface can implement another interface.
c. An interface can extend another interface.
d. A class which is implementing an interface must implement all the methods of the interface.
Your answer is correct.
Question 15
Correct
Mark 1.00 out of 1.00
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
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 6/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 16
Correct
Mark 1.00 out of 1.00
What do you call the languages that support classes but not polymorphism?
a. Object-based language
b. If classes are supported, polymorphism will always be supported
c. Class based language
d. Procedure Oriented language
Your answer is correct.
Question 17
Correct
Mark 1.00 out of 1.00
Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed?
a. Static variables
b. Local variables
c. Class Variables
d. Instance variables
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Which provides runtime environment for java byte code to be executed?
a. JVM
b. JAVAC
c. JRE
d. JDH
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 7/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 19
Correct
Mark 1.00 out of 1.00
Division operator has ____ precedence over multiplication operator
a. Least
b. Highest
c. Equal
d. None of These
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
In Java code, the line that begins with /* and ends with */ is known as?
a. Both A & B
b. None of these
c. Multiline comment
d. Single line comment
Your answer is correct.
Question 21
Correct
Mark 1.00 out of 1.00
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;
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 8/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 22
Incorrect
Mark 0.00 out of 1.00
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.red Color.red
b. Color.blue Color.red
c. Color.red Color.blue
d. Color.blue Color.blue
Your answer is incorrect.
Question 23
Correct
Mark 1.00 out of 1.00
Which of the following is TRUE?
a. In java, an instance field declared public generates a compilation error.
b. Instance variable names may only contain letters and digits.
c. int is the name of a class available in the package java.lang
d. A class has always a constructor (possibly automatically supplied by the java compiler).
Your answer is correct.
Question 24
Correct
Mark 1.00 out of 1.00
Which symbol is used to contain the values of automatically initialized arrays?
a. Braces
b. Brackets Brackets
c. Comma
d. Parentheses
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 9/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 25
Correct
Mark 1.00 out of 1.00
Java language was initially called as ________
a. J++
b. Pine
c. Sumatra
d. Oak
Your answer is correct.
Question 26
Correct
Mark 1.00 out of 1.00
Which statement is not true in java language?
a. A private member of a class cannot be accessed by the methods of the same class.
b. A public member of a class can be accessed in all the packages.
c. A protected member of a class can be accessed from its derived class.
d. A private member of a class cannot be accessed from its derived class.
Your answer is correct.
Question 27
Correct
Mark 1.00 out of 1.00
Among these expressions, which is(are) of type String?
a. "0"
b. '0'
c. "ab" + "cd"
d. Both (A) and (B) above
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 10/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 28
Correct
Mark 1.00 out of 1.00
Multiple inheritance means,
a. more classes inheriting from more super classes
b. more classes inheriting from one super class
c. None of the above
d. one class inheriting from more super classes
Your answer is correct.
Question 29
Correct
Mark 1.00 out of 1.00
Which among the following can’t be used for polymorphism?
a. Predefined operator overloading
b. Constructor overloading
c. Static member functions
d. Member functions overloading
Your answer is correct.
Question 30
Correct
Mark 1.00 out of 1.00
Which one is a template for creating different objects ?
a. Interface
b. A class
c. Method
d. An Array
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 11/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 31
Correct
Mark 1.00 out of 1.00
Which of the following is true?
a. A finally block is executed, only after the catch block is executed.
b. A finally block is executed before the catch block but after the try block.
c. A finally block is executed, only if an exception occurs.
d. A finally block is executed whether an exception is thrown or not.
Your answer is correct.
Question 32
Correct
Mark 1.00 out of 1.00
In java control statements break, continue, return, try-catch-finally and assert belongs to?
a. Transfer statements
b. Selection statements
c. Loop Statements
d. Pause Statement
Your answer is correct.
Question 33
Correct
Mark 1.00 out of 1.00
Which of these have highest precedence?
a. *
b. >>
c. ++
d. ()
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 12/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 34
Incorrect
Mark 0.00 out of 1.00
Which of these is not a bitwise operator?
a. |=' Operator
b. <=' Operator
c. &' Operator
d. &=' Operator
Your answer is incorrect.
Question 35
Correct
Mark 1.00 out of 1.00
The fields in an interface are implicitly specified as,
a. static only
b. protected
c. both static and final
d. private
Your answer is correct.
Question 36
Correct
Mark 1.00 out of 1.00
What is byte code in Java?
a. Code generated by a Java Virtual Machine
b. Code generated by a Java compiler
c. Name of Java source code file
d. Block of code written inside a class
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 13/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 37
Correct
Mark 1.00 out of 1.00
Which of the following could be written with little knowledge of java?
a. Java Server Pages
b. Common Gateway Interface
c. Java Servlets
d. Java Community Program
Your answer is correct.
Question 38
Correct
Mark 1.00 out of 1.00
What is the full form of JVM ?
a. Java Verified Machine
b. Java Very Large Machine
c. Java Very Small Machine
d. Java Virtual Machine
Your answer is correct.
Question 39
Correct
Mark 1.00 out of 1.00
Data type long literals are appended by _____
a. Long
b. Uppercase L
c. Lowercase L
d. Both A and B
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 14/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 40
Incorrect
Mark 0.00 out of 1.00
What will be printed as the output of the following program? public class testincr { public static void main(String args[]) { int i = 0; i = i++ + i;
System.out.println("I = " +i); } }
a. I = 2
b. I = 1
c. I=0
d. I = 3
Your answer is incorrect.
Question 41
Correct
Mark 1.00 out of 1.00
Which programming language doesn’t support multiple inheritance?
a. Java
b. Java and SmallTalk
c. C and C++
d. C++ and Java
Your answer is correct.
Question 42
Correct
Mark 1.00 out of 1.00
What is printed by the following statement? System.out.print("Hello,\nworld!");
a. Hello, world!
b. Hello, \nworld!
c. "Hello, \nworld!"
d. None of the above.
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 15/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 43
Incorrect
Mark 0.00 out of 1.00
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 = Yellow
b. a = 5 s = Yellow
c. a = 5 s = Blue
d. a = 3 s = Blue
Your answer is incorrect.
Question 44
Correct
Mark 1.00 out of 1.00
Which access type data gets derived as private member in derived class?
a. Protected
b. Public
c. Protected and Private
d. Private
Your answer is correct.
Question 45
Correct
Mark 1.00 out of 1.00
Which among the following best defines single level inheritance?
a. A class inheriting a base class
b. A class which gets inherited by 2 classes
c. A class inheriting a nested class
d. A class inheriting a derived class
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 16/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 46
Correct
Mark 1.00 out of 1.00
Which of the following variable declaration would NOT compile in a java program?
a. int var1;
b. int 1_var;
c. int VAR;
d. int var;
Your answer is correct.
Question 47
Correct
Mark 1.00 out of 1.00
To prevent any method from overriding, we declare the method as,
a. const
b. final
c. abstract
d. static
Your answer is correct.
Question 48
Correct
Mark 1.00 out of 1.00
Who is known as the father of Java Programming Language?
a. Charel Babbage
b. Blais Pascal
c. James Gosling
d. M. P Java
Your answer is correct.
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 17/18
6/19/23, 8:47 AM PRELIM EXAM: Attempt review
Question 49
Correct
Mark 1.00 out of 1.00
Which type of function among the following shows polymorphism?
a. Virtual function
b. Inline function
c. Undefined functions
d. Class member functions
Your answer is correct.
Question 50
Correct
Mark 1.00 out of 1.00
In java control statements break, continue, return, try-catch-finally and assert belongs to?
a. Pause Statemen
b. Transfer statements
c. Selection statements
d. Loop Statements
Your answer is correct.
◄ Announcements
Jump to...
Prelim Lab Exam ►
https://trimestralexam.amaesonline.com/2233/mod/quiz/review.php?attempt=49926&cmid=1690&showall=1 18/18