Python and Java Programming Fundamentals
Test your knowledge of basic programming concepts in Python and Java, including control flow, object-oriented programming, syntax, and data structures
Questions
Do the list structure can have different data types ?
- True
- False
Do the negative indices are allowed in Python ?
- True
- False
Which is the following invalid structure/syntax in python ?
- list
- module
- sequence
- lib
Function definition in python prefix with _____ .
- function
- def
- void
- func
A class or a function definition in python ends with _____
- semicolon
- parentheses
- colon
- angle bracket
Identify the correct syntax for instantiating a class .
- testObj = CTest
- testObj = CTest()
- CTest testObj = CTest()
- testObj = new CTest()
Identify the correct syntax for instantiating a class .
- testObj = CTest
- testObj = CTest()
- CTest testObj = CTest()
- testObj = new CTest()
The constructor in python is _____
- def_init()
- name of class itself.
- python_init_
- init
Variable in python are by default ______
- public
- private
- global
- protected
How to initialize the variable with private scope ?
- Prefix the string 'private' to the variable name.
- initialize it with '_init_private'
- initialize it with double underscore '__'
- append the keyword 'pvt' before the variable.
Can we give argument values to the parameters which are not at the end of the parameter list in the function definition ?
- True
- False
In java local variables are automatically instantiated(T/F)
- True
- False
What gets printed after this boolean b = false; if (b = true){ System.out.println("True"); }
- Prints "True"
- Prints nothing
- Prints false
- Error in if condition
What is "instanceOf" ?
- an operator
- a method
- nothing
- a keyword in Java
For Object A to access method of object B, and the method has no modifier, Object A must be an instance of class which is ...
- Same package as B
- In different package
- mark a default acess modifier to the class
- None
Each source file should have a public class in it ?
- True
- False
Methods which are marked as Protected can be accessed only by classes with in the same package?
- True
- False
Can abstract classes have non - abstract methods?
- True
- False
In a switch construct the execution will continue till
- a match case is found
- a match case is found and break is encountered
- will continue till default
- none
Using a break in a for loop , causes the loop to break out of the current iteration and jump to the next iteration of the loop...
- True
- False