What is the main purpose of an IDE (Integrated Development Environment)?
A Compilation
B Code editing
C Debugging
D Program execution
An IDE (Integrated Development Environment) provides tools for writing, editing, compiling, and debugging code. It offers an interface for writing code, with features like syntax highlighting, autocompletion, and error detection.
Which of these types is used for storing text in C?
A float
B double
C int
D char
In C, the char data type is used to store a single character. It is a fundamental type for handling textual data and is usually part of an array of char to represent strings.
How is a single-line comment written in Python?
A #
B <!– –>
C //
D /* */
In Python, comments are written using the # symbol for single-line comments. This helps the programmer annotate the code without affecting execution. Anything following the # on that line is ignored by the interpreter.
Which operator is used for modulo operation in Java?
A //
B %
C /
D //
In Java, the % operator is used to calculate the remainder of a division, also known as the modulo operation. For example, 10 % 3 results in 1, which is the remainder of dividing 10 by 3.
Which of these is a looping construct in C?
A Pauses the loop
B forEach
C let
D while
In C, the while loop is a fundamental looping construct that repeatedly executes a block of code as long as the specified condition evaluates to true. It is one of the most basic looping mechanisms in C.
What does the void keyword represent in C?
A Integer
B Null
C No value
D Undefined
In C, the void keyword indicates that a function does not return any value. It can also be used to define pointers that do not point to any specific data type, commonly referred to as void pointers.
How do you define a string in Python?
A string = Hello
B string = ‘Hello’
C string = “Hello”
D Both A and B
In Python, strings can be defined using either single quotes (‘) or double quotes (“). Both options work the same way, allowing you to store and manipulate text in your program.
In Java, what does the new keyword do?
A Creates a method
B Allocates memory
C Defines a class
D Declares a variable
The new keyword in Java is used to allocate memory for a new object and initialize it. It invokes the constructor of the class to create an instance of that class in memory.
What does the continue statement do in a loop in C?
A Pauses the loop
B Exits the function
C Skips the current iteration
D Ends the loop
In C, the continue statement is used within loops to skip the current iteration and proceed with the next iteration of the loop. This is useful when certain conditions make further processing unnecessary.
Which of the following is the correct syntax for an array in Python?
A arr = {1, 2, 3}
B arr = [1, 2, 3]
C arr = <1, 2, 3>
D arr = (1, 2, 3)
In Python, arrays are implemented as lists, which are defined using square brackets ([]). The list can store multiple items, and those items can be of different data types.
Which of these is used to access the value of an object’s property in Java?
A []
B ->
C ::
D .
In Java, the dot (.) operator is used to access an object’s properties or methods. It allows the program to reference and manipulate the data or behavior associated with the object.
What is the correct way to define a function in C?
A func name()
B void name()
C def name()
D function name()
In C, functions are defined with a return type (such as void for no return value) followed by the function name and its parameters in parentheses. For example: void name() is a function with no return type.
Which of these operators is used for incrementing a variable by one in C?
A ++
B —
C +
D +=
The ++ operator in C is used to increment the value of a variable by one. It can be used either before or after the variable, with slightly different behavior in each case (pre-increment vs post-increment).
In Python, which function is used to get the length of a list?
A count()
B len()
C length()
D size()
In Python, the len() function is used to return the length of a list (or other iterable objects like strings and dictionaries). It gives the number of elements in the list or collection.
What is the purpose of the break statement in a loop in Python?
A Exits the loop
B Ends the program
C Skips the iteration
D Pauses the loop
The break statement is used to exit a loop prematurely in Python. When the break condition is met, the program exits the loop and continues with the next statement after the loop.