wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SOCKET PROGAMMING BASICS 1

Total questions: 10

Worksheet time: 3mins

Name
Class
Date
1.

................................... is the name given to the memory location where a value is stored.

a)

Variable

b)

Class

c)

Object

d)

Constant

2.

A _____________is a value that does not change throughout program execution.

a)

Variable

b)

Constant

c)

Class

d)

Object

3.

_________________are the reserved words available in Java language.

a)

Variables

b)

Keywords

c)

Constants

d)

Classes

4.

Keywords listed in Java can be used as identifiers.

a)

True

b)

False

5.

In a Java program, variables should be declared before they can be used.

a)

True

b)

False

6.

Specify whether the following variable name are valid/invalid


total sum

a)

Valid

b)

Invalid

7.

The statements in which you expect exceptions in runtime should be enclosed within a ________block.

a)

try

b)

catch

c)

throw

8.

Choose the CORRECT scanner declaration.

a)

Scanner input = new Scanner(System.in);

b)

scanner input = new Scanner(System.in);

c)

Scanner input = new scanner(System.in);

d)

Scanner input = new Scanner(system.in);

e)

Scanner input = new Scanner(System);

9.

Choose the CORRECT statement to accept Integer input from user, for the following variable:


int age;

a)

age=input.nextInt();

b)

age=input.nextInteger();

c)

age=input.nextInt()

d)

input.nextInt();

e)

input.nextInteger();

10.

Choose the CORRECT object call for getting the current PCs IP address

a)

InetAddress address = InetAddress.getLocalHost();

b)

InetAddress address = InetAddress.getLocalHost();

c)

InetAddress address == InetAddress.getLocalHost();

d)

InetAddress address = InetAddress.getLocalHost():