Font size
WorksheetsPage 1
Total questions: 15
Worksheet time: 8mins
What is a variable in programming?
A variable is a fixed value that cannot change during execution.
A variable is a command that executes a function in programming.
A variable is a type of error that occurs in code execution.
A variable is a symbolic name for a storage location in programming that can hold a value.
Which of the following is a data type: Integer, Chair, Blue?
Red
Table
String
Integer
What symbol is commonly used to assign a value to a variable?
==
=
::
=>
What is an array?
An array is a single data type variable.
An array is a collection of elements identified by index or key.
An array is a fixed-size data structure.
An array is a type of function in programming.
How do you access the first element of an array in most programming languages?
array.first()
array.get(0)
array[0]
array[1]
What is the purpose of a list in programming?
A list is used to define functions in programming.
The purpose of a list is to execute commands sequentially.
The purpose of a list in programming is to store and manage a collection of items.
Lists are primarily for displaying user interfaces in programming.
Which of the following is a valid way to declare a variable in Python?
let x = 10;
x = 10
var x = 10;
x : 10
What is the output of the following code: print('Hello, World!')?
Hello, World!!
Hello, World?
Hello, World!
Hello World!
How do you read user input in most programming languages?
User input is read using 'readLine()' in C++ or 'getInput()' in Ruby.
User input is read using functions like 'input()' in Python or 'Scanner' in Java.
User input is read using 'inputString()' in JavaScript or 'readInput()' in PHP.
User input is read using 'fetch()' in Go or 'inputText()' in Swift.
What is the difference between an array and a list?
An array can grow in size and holds only one type.
An array has a fixed size and type, whereas a list is dynamic and can contain different types.
An array can contain mixed types, while a list cannot.
A list is always fixed in size and type, unlike an array.
What data type would you use to store a decimal number?
integer
float or double
string
boolean
How can you output text to the console in Java?
Console.write('Your text here');
System.out.print('Your text here');
System.out.println("Your text here");
print('Your text here');
What is the index of the last element in an array of size 5?
3
4
5
2
What is the purpose of the 'len()' function in Python?
The 'len()' function calculates the sum of numbers in a list.
The purpose of the 'len()' function is to return the number of items in an object.
The 'len()' function checks if an object is empty or not.
The 'len()' function converts an object to a string format.
How do you convert a string to an integer in most programming languages?
Use built-in functions like int(), parseInt(), or Integer.parseInt() depending on the programming language.
Apply string manipulation methods to extract numbers.
Utilize type casting operators like as.integer() in languages.
Use the eval() function to convert strings directly.
