Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IB Computer Exam Practice Questions

Total questions: 96

Worksheet time: 56mins

Name
Class
Date
1.

What is a method in Java?

a)

A type of loop

b)

A way to define and reuse a block of code

c)

A conditional statement

d)

A data structure

2.

When defining a method, what does the return type specify?

a)

The input parameters of the method

b)

The name of the method

c)

The data type of the value returned by the method

d)

The visibility of the method

3.

What is the purpose of preconditions in method design?

a)

To specify the conditions under which a method should be called

b)

To specify the conditions that must be true after a method executes

c)

To specify the conditions under which a method can be called

d)

To specify the conditions that should be true before a method executes

4.

What is the purpose of postconditions in method design?

a)

To specify the conditions under which a method should be called

b)

To specify the conditions that should be true before a method executes

c)

To specify the conditions that must be true after a method executes

d)

To specify the conditions under which a method can be called

5.

Which of the following is a program entry point in Java?

a)

The main() method

b)

A constructor

c)

A getter method

d)

A setter method

6.

Control flow in Java refers to:

a)

The order in which statements are executed in a program

b)

The way Java manages memory

c)

The process of compiling Java code

d)

The method of creating user interfaces

7.

What is looping in Java?

a)

A way to create objects

b)

A way to execute code based on a certain condition

c)

A way to repeat a block of code until a certain condition is met

d)

A way to define variables

8.

Which of the following is a conditional statement in Java?

a)

for loop

b)

while loop

c)

switch statement

d)

if statement

9.

What is the purpose of classes in Java?

a)

To store data

b)

To define methods

c)

To define objects with attributes and behaviors

d)

To define loops and conditionals

10.

What is the purpose of commenting code in Java?

a)

To explain how the code works

b)

To make the code more efficient

c)

To prevent others from reading the code

d)

To make the code more difficult to understand

11.

Which of the following is a method for encoding digital data?

a)

JPEG

b)

ASCII

12.

What is the binary representation of the decimal number 18?

a)

10010

b)

11000

c)

11110

d)

10000

13.

Which number system is commonly used in computer science?

a)

Decimal

b)

Binary

c)

Octal

d)

Hexadecimal

14.

What is the hexadecimal representation of the binary number 11110010?

a)

EA

b)

E6

c)

F2

d)

F4

15.

How do computers manipulate images at the pixel level?

a)

By changing the resolution of the image

b)

By changing the color of the entire image

c)

By changing the brightness of the entire image

d)

By changing the color and brightness of individual pixels

16.

Which of the following is an advantage of using hexadecimal number system?

4 lines
17.

What is the process of converting data from one format to another called?

a)

Decoding

b)

Transcoding

c)

Encoding

d)

Compression

18.

Which of the following is a commonly used image file format?

a)

MP3

b)

PDF

c)

JPEG

d)

TXT

19.

What is the purpose of representing data in binary form in computers?

a)

To reduce the storage space required for data

b)

To speed up data processing

c)

To enable the transmission of data over networks

d)

All of the above

20.

What is the internet?

a)

A global network of computers

b)

A type of computer hardware

c)

A software program for browsing the web

d)

A type of computer virus

21.

Which numbering system is commonly used in computer science?

a)

Decimal

b)

Binary

c)

Octal

d)

Hexadecimal

22.

Which of the following is a valid binary number?

a)

1020

b)

1011

c)

8F

d)

57

23.

Which of the following is an example of internet hardware?

a)

Router

b)

Email client

c)

Web browser

d)

Text editor

24.

Which type of cable is commonly used for connecting devices to the internet?

a)

Coaxial cable

b)

Fiber optic cable

c)

Ethernet cable

d)

USB cable

25.

Which version of the IP protocol is commonly used on the internet?

a)

IP version 4

b)

IP version 6

c)

IP version 10

d)

IP version X

26.

What is the purpose of the Domain Name System (DNS)?

a)

To encrypt internet traffic

b)

To block access to certain websites

c)

To manage email accounts

d)

To translate domain names into IP addresses

27.

Which type of DNS record maps a domain name to an IP address?

a)

A record

b)

MX record

c)

CNAME record

d)

PTR record

28.

What is a packet?

a)

A type of computer hardware

b)

A software program for browsing the web

c)

A unit of data transmitted over a network

d)

A type of computer virus

29.

Which protocol is commonly used for transmitting email over the internet?

a)

SMTP (Simple Mail Transfer Protocol)

b)

HTTP (Hypertext Transfer Protocol)

c)

FTP (File Transfer Protocol)

d)

IMAP (Internet Message Access Protocol)

30.

What is the primary goal of cybersecurity?

a)

To prevent any unauthorized access to information

b)

To provide unrestricted access to information

c)

To secure information without restricting access

d)

To provide unrestricted access to information but with security controls in place

31.

Which of the following is an example of a common cyber attack?

a)

Denial of Service (DoS)

b)

Password sharing

c)

Backing up important files

d)

Updating software regularly

32.

What is phishing?

a)

A type of malware that spreads through a network

b)

A type of cyber attack that targets specific individuals or groups

c)

A type of cyber attack that involves guessing passwords

d)

A type of cyber attack that manipulates users to provide sensitive information

33.

What is encryption?

a)

A process of converting plain text into code to secure information

b)

A process of converting code into plain text to access information

c)

A process of converting information into binary code

d)

A process of converting information into compressed format

34.

A firewall is:

a)

a security system that controls incoming and outgoing network traffic

b)

a device that increases internet speed

c)

a type of computer virus

d)

a software used for word processing

35.

What is two-factor authentication?

a)

A security method that requires two passwords to access sensitive information

b)

A security method that involves using a physical token to authenticate a user

c)

A security method that involves verifying a user's identity through two different means

d)

A security method that uses a biometric scan to authenticate a user

36.

Which of the following is NOT an example of a cybersecurity threat?

a)

Malware

b)

Viruses

c)

Backups

d)

Ransomware

37.

What is a VPN?

a)

A software program that encrypts data to secure it during transmission

b)

A physical barrier that prevents unauthorized access to a network

c)

A software program that blocks unauthorized access to a network

d)

A software program that allows users to connect to a private network over the internet

38.

Which of the following is a good cybersecurity practice?

a)

Using the same password for multiple accounts

b)

Updating software regularly

39.

What is a DDoS attack?

a)

A type of cyber attack that manipulates users to provide sensitive information

b)

A type of cyber attack that targets specific individuals or groups

c)

A type of cyber attack that involves flooding a server with traffic to make it unavailable

d)

A type of cyber attack that involves stealing confidential information

40.

Which of the following is a potential negative impact of the internet on society?

a)

Increased cyberbullying and online harassment

b)

Increased access to information

c)

Increased social connectedness

d)

Increased opportunities for education and learning

41.

Which of the following is an example of how the internet has impacted the job market?

a)

Increased demand for manual labor jobs

b)

Decreased demand for tech-related jobs

c)

Increased demand for remote work and telecommuting

d)

Decreased demand for jobs in the service industry

42.

What is the digital divide?

a)

The gap between those who have access to the internet and those who do not

b)

The difference in internet speeds between urban and rural areas

c)

The gap in income between those who work in tech-related industries and those who do not

d)

The difference in internet usage between different age groups

43.

Which of the following is a potential positive impact of the internet on education?

a)

Increased opportunities for cheating and academic dishonesty

b)

Increased access to educational resources and information

c)

Decreased interest in traditional forms of learning, such as classroom lectures

d)

Increased emphasis on rote memorization and standardized testing

44.

Which of the following is a potential positive impact of the internet on the economy?

a)

Increased competition and market transparency

b)

Reduced need for skilled labor

c)

Increased inflation rates

d)

Decreased access to global markets

45.

What is the primary purpose of a CPU in a computer system?

a)

To store data

b)

To display graphics

c)

To run applications

d)

To process data

46.

What is the purpose of a device driver?

a)

To control the computer's hardware components

b)

To create and edit documents

c)

To connect to the internet

d)

To display graphics on the screen

47.

What is the purpose of a motherboard in a computer system?

a)

To store data

b)

To display graphics

c)

To connect to the internet

d)

To provide communication between components

48.

Why is Java a popular programming language?

a)

It is platform-independent

b)

It is easy to learn and use

c)

It has a large and active community

d)

All of the above

49.

Which of the following is a correct way to declare a variable of type String?

a)

String name = "John";

b)

String name = John;

c)

string name = "John";

d)

None of the above

50.

What is the value of the expression "5 / 2" in Java?

a)

2.5

b)

2

c)

2.0

d)

2.5f

51.

Which of the following is a valid data type in Java?

a)

int

b)

boolean

c)

float

d)

All of the above

52.

What is the purpose of the Scanner class in Java?

a)

To read user input from the console

b)

To write output to the console

c)

To perform mathematical calculations

d)

To create graphical user interfaces

53.

Why is programming important?

a)

To improve problem-solving skills

b)

To develop analytical and logical thinking

c)

To automate repetitive tasks

d)

All of the above

54.

What is the range of values that can be stored in a byte variable in Java?

a)

-128 to 127

b)

0 to 255

c)

-32768 to 32767

d)

-2147483648 to 2147483647

55.

Which of the following data types can hold decimal numbers in Java?

a)

int

b)

double

c)

char

d)

boolean

56.

What is the output of the following Java code? String s = "Hello"; System.out.println(s.substring(0, 3));

a)

Hel

b)

ello

c)

llo

d)

Error

57.

Which of the following statements is true about object-oriented programming (OOP)?

a)

It focuses on procedures and functions.

b)

It uses a procedural approach to programming.

c)

It involves the use of objects and classes.

d)

It is an outdated approach to programming.

58.

What is the output of the following code snippet? int x = 7; double y = 3.0; System.out.println(x / y);

a)

2.333333

b)

2

c)

2.0

d)

None of the above

59.

Which of the following is an example of a non-primitive data type in Java?

a)

int

b)

char

c)

boolean

d)

String

60.

What is the output of the following Java code? int[] arr = {1, 2, 3}; for(int i = 0; i < arr.length; i++){ System.out.print(arr[i] + " "); }

a)

1 2 3

b)

[1, 2, 3]

c)

{1, 2, 3}

d)

Error

61.

What is the output of the following Java code? String s1 = "Hello"; String s2 = "World"; System.out.println(s1 + " " + s2);

a)

HelloWorld

b)

Hello World

c)

Hello\nWorld

d)

Error

62.

What is the output of the following Java code? int[][] arr = {{1, 2}, {3, 4}}; System.out.println(arr[1][0]);

a)

1

b)

2

63.

What is the output of the following Java code? public class Main { public static void main(String[] args) { int x = 5; System.out.println(x > 2 ? "Yes" : "No"); } }

a)

Yes

b)

No

c)

5

d)

Error

64.

What is the output of the following Java code? int x = 5; int y = 3; if(x > y){ System.out.println("x is greater than y."); } else if(x == y) { System.out.println("x is equal to y."); } else { System.out.println("y is greater than x."); }

a)

x is equal to y.

b)

x is greater than y.

c)

y is greater than x.

d)

Error

65.

Which of the following is a correct statement about objects?

a)

Objects can be created without a class.

b)

Objects are instances of methods.

c)

Objects are instances of classes.

d)

Objects are not used in Java programming.

66.

What is the process of creating an object called in Java?

a)

Initialization

b)

Declaration

c)

Instantiation

d)

Assignment

67.

The keyword used to call a method in Java is:

a)

call

b)

invoke

c)

this

d)

super

68.

What is the result of the following concatenation in Java: "Hello" + 5 + 6?

a)

"Hello56"

b)

"Hello11"

c)

"Hello5 6"

d)

"Hello"

69.

Which of the following is a String method in Java?

a)

length()

b)

max()

c)

abs()

d)

sqrt()

70.

Which class in Java contains mathematical operations such as sin, cos, and tan?

a)

Scanner

b)

Random

c)

String

d)

Math

71.

Which of the following is NOT a wrapper class in Java?

a)

String

b)

Integer

c)

Double

d)

Boolean

72.

Which of the following is a valid Boolean expression?

4 lines
73.

What is the purpose of if statements in programming?

a)

To declare variables

b)

To create loops

c)

To print output to the console

d)

To control program flow based on a condition

74.

Which of the following is the correct syntax for an if statement in Java?

a)

if {condition} then {code block}

b)

if (condition) {code block}

c)

if [condition] {code block}

d)

if /condition/ {code block}

75.

What is the purpose of the else statement in programming?

a)

To declare variables

b)

To create loops

c)

To execute code if the condition in the if statement is false

d)

To print output to the console

76.

Which of the following is an equivalent Boolean expression to !(x > 5 || y < 3)?

a)

x <= 5 && y >= 3

b)

x > 5 && y >= 3

c)

x > 5 || y < 3

d)

x <= 5 || y >= 3

77.

Which of the following is the correct syntax for comparing two objects in Java?

4 lines
78.

Which loop structure is best suited when the number of iterations is unknown?

a)

for loop

b)

while loop

c)

do-while loop

d)

if-else loop

79.

What is the output of the following code? int count = 0; while (count < 5) { System.out.print(count + " "); count++; }

a)

0 1 2 3 4

b)

1 2 3 4 5

c)

0 1 2 3 4 5

d)

1 3 5 7 9

80.

Which keyword is used in Java to refer to the current instance of a class?

a)

class

b)

object

c)

this

d)

super

81.

Which of the following is a method that is used to change the value of an instance variable?

a)

Constructor

b)

Accessor Method

c)

Mutator Method

d)

Static Method

82.

Which of the following is a variable that is shared by all instances of a class?

a)

Instance Variable

b)

Local Variable

c)

Parameter Variable

d)

Static Variable

83.

Which keyword is used to access a static variable or method?

a)

this

b)

super

c)

final

d)

static

84.

Which of the following is a section of code that is only executed when a new instance of a class is created?

a)

Constructor

b)

Accessor Method

c)

Mutator Method

d)

Static Method

85.

What is an array in Java?

a)

A type of object

b)

A collection of variables of the same data type

c)

A loop structure

d)

A conditional statement

86.

What is the correct syntax to create an array of integers in Java?

a)

int[] array = new int();

b)

int array = new int[];

c)

int[] array = new int[5];

d)

int array = {1, 2, 3, 4, 5};

87.

How do you access an element in an array in Java?

a)

By using the array name followed by the index enclosed in square brackets

b)

By using the index followed by the array name enclosed in square brackets

c)

By using the element name followed by the array name enclosed in square brackets

d)

By using the array name followed by the element name enclosed in square brackets

88.

Which loop structure is commonly used for traversing arrays in Java?

a)

while loop

b)

do-while loop

c)

for loop

d)

switch statement

89.

What is an algorithm?

a)

A mathematical formula

b)

A sequence of instructions to solve a problem

c)

A variable declaration

d)

A loop structure

90.

Which of the following is a valid method of adding an element to an ArrayList?

a)

arrayList.addLast(5);

b)

arrayList.push(5);

c)

arrayList.insert(5);

d)

arrayList.add(5);

91.

How can you remove an element at a specific index from an ArrayList?

a)

arrayList.remove(index);

b)

arrayList.delete(index);

92.

What is the purpose of the enhanced for loop in ArrayLists?

a)

To add elements to the ArrayList

b)

To remove elements from the ArrayList

c)

To iterate through the ArrayList

d)

To sort the elements in the ArrayList

93.

What is the syntax for declaring a 2D array in Java?

a)

int[] arr;

b)

int arr[2][3];

c)

int[][] arr;

d)

int arr[][];

94.

What is the syntax for traversing a 2D array using nested loops?

a)

for (int i = 0; i < arr.length; i++) for (int j = 0; j < arr[i].length; j++)

b)

for (int i = 0; i < arr.length; j++) for (int j = 0; j < arr[i].length; i++)

c)

for (int i = 0; i < arr.length; i++) for (int j = 1; j <= arr[i].length; j++)

d)

None of the above

95.

Which keyword is used in Java to implement inheritance?

a)

superclass

b)

subclass

c)

implements

d)

extends

96.

What is method overriding in Java?

a)

Creating a new method in the subclass with the same name as a method in the superclass

b)

Creating a new method in the superclass with the same name as a method in the subclass

c)

Creating a new variable in the subclass with the same name as a variable in the superclass

d)

Creating a new variable in the superclass with the same name as a variable in the subclass