Python and Java Developer Certification Exam Questions and Answers, Exams of Software Development

A set of questions and answers related to python and java programming languages, designed to help developers prepare for certification exams. It covers a range of topics, including data types, control structures, object-oriented programming concepts, and exception handling. Each question is followed by a rationale, offering a deeper understanding of the correct answer. This resource is valuable for students and professionals looking to enhance their knowledge and skills in python and java development, and to successfully pass certification exams. The questions are designed to test understanding of fundamental concepts and best practices in both languages, making it a useful tool for self-assessment and exam preparation.

Typology: Exams

2025/2026

Available from 09/03/2025

DrNotion
DrNotion 🇺🇸

4.4

(7)

9.1K documents

1 / 21

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Python/Java Developer Certification
Exam With Actual Questions & Verified
Answers,Plus Rationales/Expert Verified
For Guaranteed Pass 2025/2026 /Latest
Update/Instant Download Pdf
1. What is the output of the following Python code?
print(type([]) is list)
a) False
b) True
c) <class 'list'>
d) None
Answer: b
Rationale: In Python, [] creates a list object, and type([]) returns <class 'list'>. Using is checks
identity, which is True for the list class.
2. Which of the following is not a valid Python data type?
a) set
b) tuple
c) dict
d) record
Answer: d
Rationale: Python has built-in types like set, tuple, dict, but record is not a built-in
type.
3. In Java, what is the default value of a boolean variable?
a) null
b) 0
c) false
d) true
Answer: c
Rationale: In Java, primitive boolean variables default to false.
4. What does the strip() method do in Python?
a) Removes all spaces from a string
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download Python and Java Developer Certification Exam Questions and Answers and more Exams Software Development in PDF only on Docsity!

Python/Java Developer Certification

Exam With Actual Questions & Verified

Answers,Plus Rationales/Expert Verified

For Guaranteed Pass 2025/2026 /Latest

Update/Instant Download Pdf

  1. What is the output of the following Python code? print(type([]) is list) a) False b) True c) <class 'list'> d) None Answer: b Rationale: In Python, [] creates a list object, and type([]) returns <class 'list'>. Using is checks identity, which is True for the list class.
  2. Which of the following is not a valid Python data type? a) set b) tuple c) dict d) record Answer: d Rationale: Python has built-in types like set, tuple, dict, but record is not a built-in type.
  3. In Java, what is the default value of a boolean variable? a) null b) 0 c) false d) true Answer: c Rationale: In Java, primitive boolean variables default to false.
  4. What does the strip() method do in Python? a) Removes all spaces from a string

b) Removes leading and trailing whitespace from a string c) Removes all whitespace in the string d) Converts string to uppercase Answer: b Rationale: strip() removes only leading and trailing whitespace, not internal spaces.

  1. What will be the output of this Python code? x = [ 1 , 2 , 3 ] x.append([ 4 , 5 ]) print(len(x)) a) 3 b) 4 c) 5 d) Error Answer: b Rationale: append adds the entire object as a single element, so list x now has 4 elements: [1, 2, 3, [4,5]].
  2. Which of these keywords is not used in Java? a) transient b) finalize c) delegate d) synchronized Answer: c Rationale: delegate is used in C#, not Java.
  3. Which Python keyword is used for exception handling? a) catch b) try c) handle d) except Answer: b Rationale: Python uses try for exception handling along with except.
  4. How do you create an object in Java? a) MyClass obj = new MyClass(); b) MyClass obj = MyClass(); c) obj = MyClass.new(); d) new obj = MyClass(); Answer: a Rationale: Java uses new keyword with the class constructor to create objects.
  1. How is inheritance represented in Java? a) class Child extends Parent b) class Child implements Parent c) class Child : Parent d) class Child inherits Parent Answer: a Rationale: Java uses extends for class inheritance.
  2. Which of the following Python statements is used to import a specific function from a module? a) import module b) from module import func c) import func from module d) module import func Answer: b Rationale: from module import func imports only the specified function.
  3. What is the output of the following Java code? int x = 5 ; System.out.println(x++); a) 5 b) 6 c) Error d) 0 Answer: a Rationale: x++ prints the current value then increments, so output is 5.
  4. Which method in Java is called when an object is destroyed? a) finalize() b) delete() c) destroy() d) remove() Answer: a Rationale: finalize() is invoked by the garbage collector before object destruction.
  5. How can you make a Python function accept an arbitrary number of positional arguments? a) def func(args): b) def func(args): c) def func(*args): d) def func(args...):

Answer: b Rationale: Using *args allows the function to take a variable number of positional arguments.

  1. What is the difference between == and equals() in Java? a) No difference b) == compares content, equals() compares reference c) == compares reference, equals() compares content d) Both compare memory address Answer: c Rationale: == checks reference equality; equals() checks logical content equality.
  2. Which Python statement will check if a key exists in a dictionary? a) key in dict b) dict.has_key(key) c) dict.exists(key) d) dict.contains(key) Answer: a Rationale: key in dict returns True if the key exists. has_key is deprecated in Python 3.
  3. Which of the following is a feature of Java interfaces? a) Can have private constructors b) Can have abstract methods only (Java 7) c) Can be instantiated directly d) Can extend multiple classes Answer: b Rationale: Java interfaces define abstract methods (before Java 8). They cannot be instantiated.
  4. What is the output of: a = [ 1 , 2 , 3 ] b = a b.append( 4 ) print(a) a) [1, 2, 3] b) [1, 2, 3, 4] c) Error d) [4] Answer: b Rationale: a and b refer to the same list object; appending via b affects a.

c) dict = () d) dict = set() Answer: a Rationale: Curly braces {} are used to define dictionaries.

  1. In Java, which method must be implemented by all threads? a) run() b) start() c) execute() d) main() Answer: a Rationale: Thread logic is defined in the run() method.
  2. How do you handle multiple exceptions in Python? a) except Exception1, Exception2: b) except (Exception1, Exception2): c) except Exception1 | Exception2: d) except Exception1 & Exception2: Answer: b Rationale: Python handles multiple exceptions using parentheses: except (E1, E2):
  3. Which of the following is used to make a Python class iterable? a) iter() b) next() c) getitem() d) All of the above Answer: d Rationale: Defining iter() and next() or getitem() allows iteration over the class.
  4. Which is true about abstract classes in Java? a) Can have abstract and concrete methods b) Cannot have fields c) Can be instantiated d) Must implement interfaces Answer: a Rationale: Abstract classes can have both abstract and concrete methods but cannot be instantiated directly.
  5. How can you convert a string to an integer in Python? a) int("123") b) str("123") c) float("123")

d) num("123") Answer: a Rationale: int() converts a numeric string to an integer.

  1. Which Java keyword is used to inherit multiple interfaces? a) implements b) extends c) inherits d) interface Answer: a Rationale: A class can use implements to inherit multiple interfaces.
  2. What is the difference between Python lists and tuples? a) Lists are mutable, tuples are immutable b) Lists are immutable, tuples are mutable c) Both are immutable d) Both are mutable Answer: a Rationale: Lists can be modified; tuples cannot.
  3. What is the result of 5 // 2 in Python? a) 2. b) 2 c) 3 d) 0 Answer: b Rationale: // is floor division, which returns the integer quotient.
  4. In Java, which operator is used for bitwise AND? a) & b) && c) | d) ^ Answer: a Rationale: & performs a bitwise AND; && is logical AND.
  5. Which of these statements about Python sets is true? a) Sets allow duplicate elements b) Sets are mutable and unordered c) Sets are immutable d) Sets are indexed Answer: b Rationale: Sets are mutable, unordered, and do not allow duplicates.
  1. What does the pass statement do in Python? a) Exits a loop b) Does nothing c) Skips iteration d) Returns None Answer: b Rationale: pass is a placeholder that does nothing.
  2. Which Java keyword is used to create a subclass object? a) new b) super c) extends d) this Answer: a Rationale: new is used to instantiate objects in Java.
  3. How do you read a file line by line in Python? a) open(file).read() b) open(file).readline() c) for line in open(file): d) open(file).readlines(line) Answer: c Rationale: Iterating directly over the file object reads it line by line.
  4. Which Java exception occurs when dividing by zero using integers? a) ArithmeticException b) NullPointerException c) IOException d) NumberFormatException Answer: a Rationale: Integer division by zero throws ArithmeticException.
  5. What is the output of the following Python code? x = [ 1 , 2 , 3 ] y = x[:] y.append( 4 ) print(x) a) [1, 2, 3] b) [1, 2, 3, 4] c) [4] d) Error

Answer: a Rationale: y = x[:] creates a copy; modifying y does not affect x.

  1. Which Java keyword is used to define a constant value? a) static b) final c) const d) immutable Answer: b Rationale: final defines a constant that cannot be reassigned.
  2. How do you check if a variable a is of type integer in Python? a) type(a) == int b) isinstance(a, int) c) Both a and b d) int(a) Answer: c Rationale: Both type(a) == int and isinstance(a, int) correctly check the type.
  3. What is the output of the following Python code? a = [ 1 , 2 , 3 ] b = [ 4 , 5 , 6 ] print(a + b) a) [1,2,3,4,5,6] b) [5,7,9] c) [[1,2,3],[4,5,6]] d) Error Answer: a Rationale: In Python, using + with lists concatenates them.
  4. Which Java statement correctly declares an array of integers? a) int arr[] = new int[5]; b) int arr = new int[5]; c) int[] arr = 5; d) array arr = new int[5]; Answer: a Rationale: Arrays in Java are declared with a type and size: int arr[] = new int[5];.
  5. What is the output of this Python code? x = "Python"

Answer: a Rationale: Sets automatically remove duplicate elements.

  1. Which Java class provides methods to read input from the console? a) InputStream b) Scanner c) BufferedReader d) SystemInput Answer: b Rationale: Scanner is commonly used for reading console input.
  2. How do you create an empty set in Python? a) {} b) set() c) [] d) () Answer: b Rationale: {} creates a dictionary; set() creates an empty set.
  3. Which of the following is not a primitive type in Java? a) int b) float c) String d) double Answer: c Rationale: String is an object in Java, not a primitive type.
  4. Which Python statement is used to handle an exception? a) try b) except c) finally d) All of the above Answer: d Rationale: Exception handling can include try, except, and finally.
  5. What is the difference between list.append() and list.extend() in Python? a) append adds one element; extend adds multiple elements b) Both do the same c) append adds multiple elements; extend adds one element d) append replaces list; extend deletes list Answer: a Rationale: append adds a single element, extend concatenates another iterable.
  1. Which of these is a valid Java identifier? a) 2name b) _name c) name@ d) name# Answer: b Rationale: Identifiers can start with letters or underscore, not numbers or special characters.
  2. How do you check if a Python list is empty? a) if len(list) == 0: b) if not list: c) Both a and b d) if list.empty(): Answer: c Rationale: Both len(list) == 0 and not list correctly check if the list is empty.
  3. Which Java keyword is used to define an interface? a) class b) interface c) implements d) abstract Answer: b Rationale: interface defines an interface.
  4. What is the output of the following Python code? x = [ 1 , 2 , 3 , 4 ] print(x[ 1 : 3 ]) a) [2,3] b) [1,2,3] c) [1,2] d) [3,4] Answer: a Rationale: Slicing [1:3] returns elements from index 1 up to, but not including, 3.
  5. Which Java keyword is used to create a constant? a) const b) final c) static d) immutable
  1. Which of these Python modules is used for JSON parsing? a) json b) pickle c) csv d) xml Answer: a Rationale: json module is used to encode/decode JSON data.
  2. Which Java collection allows only unique elements? a) List b) Set c) Map d) ArrayList Answer: b Rationale: Sets do not allow duplicates.
  3. What is the output of this Python code? x = [ 1 , 2 , 3 ] print(x * 2 ) a) [1,2,3,1,2,3] b) [2,4,6] c) [1,2,3,2] d) Error Answer: a Rationale: Multiplying a list repeats the elements.
  4. Which Java keyword is used to inherit from a class? a) extends b) implements c) inherits d) super Answer: a Rationale: extends is used for class inheritance.
  5. How do you delete a key from a Python dictionary? a) del dict[key] b) dict.remove(key) c) dict.pop(key) d) Both a and c Answer: d Rationale: Both del and pop remove a key from a dictionary.
  1. Which Java collection class allows key-value pairs with fast retrieval by key? a) ArrayList b) HashMap c) LinkedList d) TreeSet Answer: b Rationale: HashMap stores key-value pairs with fast lookup.
  2. What is the difference between Python deepcopy and copy? a) copy duplicates objects, deepcopy duplicates nested objects b) deepcopy duplicates objects, copy duplicates nested objects c) No difference d) Both create references Answer: a Rationale: deepcopy creates independent copies of nested structures.
  3. Which Java keyword is used to handle exceptions? a) try b) catch c) finally d) all of the above Answer: d Rationale: Exception handling can include all three keywords.
  4. What is the output of the following Python code? x = [ 1 , 2 , 3 ] y = x.copy() y.append( 4 ) print(x) a) [1,2,3] b) [1,2,3,4] c) Error d) [4] Answer: a Rationale: copy() creates a shallow copy; modifying y does not affect x.
  5. Which of these is true for Java abstract methods? a) Must be overridden in subclass b) Can have a body c) Cannot be overridden d) Cannot be declared in abstract class
  1. Which Java exception occurs when accessing an invalid array index? a) ArrayIndexOutOfBoundsException b) NullPointerException c) IOException d) ClassCastException Answer: a Rationale: Accessing an invalid index throws ArrayIndexOutOfBoundsException.
  2. How do you remove duplicates from a Python list? a) list(set(list)) b) [x for x in list if x not in seen] c) Both a and b d) list.remove_duplicates() Answer: c Rationale: Converting to a set or using list comprehension removes duplicates.
  3. Which Java keyword defines a class that cannot be subclassed? a) abstract b) final c) static d) immutable Answer: b Rationale: final classes cannot be inherited.
  4. How do you concatenate two strings in Python? a) str1 + str b) str1.concat(str2) c) str1 & str d) concat(str1, str2) Answer: a Rationale: + operator concatenates strings.
  5. Which Java statement is used to stop the current iteration and continue with the next? a) break b) continue c) return d) exit Answer: b Rationale: continue skips the remaining code in the loop and moves to the next iteration.
  1. How do you create a multiline string in Python? a) "line1\nline2" b) '''line1 line2''' c) """line1 line2""" d) Both b and c Answer: d Rationale: Triple quotes allow multiline strings.
  2. Which Java method is called to start a new thread? a) run() b) start() c) execute() d) init() Answer: b Rationale: start() begins a new thread and calls run() internally.
  3. Which Python function converts a list of strings to integers? a) map(int, list_of_strings) b) list_of_strings.astype(int) c) int(list_of_strings) d) convert(list_of_strings) Answer: a Rationale: map(int, iterable) applies int to each element.
  4. Which Java exception occurs when parsing a non-numeric string to integer? a) NumberFormatException b) IOException c) ArithmeticException d) IllegalArgumentException Answer: a Rationale: Integer.parseInt("abc") throws NumberFormatException.
  5. How do you reverse a list in Python? a) list[::-1] b) list.reverse() c) reversed(list) d) All of the above Answer: d Rationale: All three methods can reverse a list.
  6. Which Java keyword is used for an abstract class? a) abstract b) interface