munotes®

BSc CS Sem 3 JAVA Programming Nov 2024 Question Paper with Solutions

Mumbai University Solved Question Papers munotes.in

JAVA Programming

BSc CS · Sem 3

Nov 2024 Examination

Previous Year Question Paper with Solution

munotes.in Mumbai

munotes.in

First published on munotes.in on 12 November 2026.

Published by munotes.in, Mumbai.

Model answers written and edited by the munotes.in editorial desk.

Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.

munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.

The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.

The question paper reproduced here is the paper as set by the University of Mumbai at the Nov 2024 examination.

munotes.in ii
munotes.in iii
munotes.in iv

The Paper as Set

The questions in this volume are the questions asked at the Nov 2024 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.

Duration 2½ hours  ·  Total marks 75  ·  24 questions answered

How to use this volume

Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.

munotes.in v

SECTION I

QI)

Attempt any four, 5 marks each · 20 Marks

munotes.in 1

A)Describe how Java achieves portability and architecture-neutrality.[5]

Answer

For full marks, cover: the two terms defined; the compile-to-bytecode, run-on-a-JVM path as a labelled diagram; the fixed sizes of the primitive types; the specified class file format; "write once, run anywhere"; a short program whose output is the same on every machine; and the limits.

The two terms

  1. Architecture-neutral: the compiled program does not depend on any one processor or operating system.
  2. Portable: the same program behaves the same way on every machine, so it can be moved without change.

Java gets both from one design: it compiles to bytecode, not to machine code.

How it is done

  1. Bytecode. javac compiles Hello.java into Hello.class. The class file holds bytecode, the instruction set of an imaginary machine, the Java Virtual Machine (JVM).
munotes.in 2
  1. A JVM for every platform. Windows, Linux and macOS each have their own JVM. Each JVM reads the same class file and runs it on its own hardware, by interpreting it and compiling hot parts just in time.
  2. A specified class file format. The layout of a class file is fixed by the JVM specification. So a class file made on one machine is valid on all.
  3. Fixed sizes for the primitive types. An int is always 32 bits, a long 64, a char 16 and a double 64. In C, an int may be 16 or 32 bits depending on the machine.
  4. A standard library that is the same everywhere, so file, network and thread code does not change between systems.

Diagram: Hello.java goes into a box "javac". An arrow leads to Hello.class (bytecode). From it, three arrows fan out to three boxes, "JVM on Windows", "JVM on Linux" and "JVM on macOS". Each box sits on its own hardware.

This is the slogan "write once, run anywhere".

Shown by a run

  1. public class Sizes {
  2. public static void main(String[] args) {
  3. System.out.println("int " + Integer.SIZE + " bits, long " + Long.SIZE + " bits");
munotes.in 3
  1. System.out.println("char " + Character.SIZE + " bits, double " + Double.SIZE + " bits");
  2. }
  3. }

Output:

int 32 bits, long 64 bits
char 16 bits, double 64 bits

The same Sizes.class prints these lines on every operating system, because the sizes are part of the language.

Its limits

  1. A JVM must be installed for the platform.
  2. Code that calls native libraries, or hard-codes file paths like C:\data, loses portability.

Conclusion. Java is architecture-neutral because it compiles to bytecode for the JVM, not for a processor. It is portable because the class file format, the primitive sizes and the library are fixed, so one class file runs the same everywhere.

munotes.in 4

The rest of the answers

The first answer is free. The rest come with the B.Sc. (Computer Science) Semester 3 solved papers.

You have read the question paper and its first answer in full. Buy the solved papers once and you can read every answer of every solved paper in this semester.

Notes + practical solutions + solved papers: ₹798 Already bought it? Sign in

Or solved papers only: ₹499
Or notes + practical solutions: ₹499

The question paper itself stays free, and so does the syllabus.

Issue

Found an error in this volume? Report it and we will check it against the paper.

Done!