Java Fundamentals: Type Conversion, Scope, Arrays, and More

Type Conversion

int n = Integer.parseInt("53"); // compile-time error

double m = Integer.parseInt("53"); // automatic conversion (int to double)

int n = Double.parseDouble("53"); // compile-time error

int n = Integer.parseInt("cat"); // run-time error

double → int : (int) casting


String Conversion

String → int : int x = Integer.parseInt(" ");
String → double : double y = Double.parseDouble(" ");
String → boolean : boolean z = Boolean.parseBoolean("true/false");


Scope

The parts of the program where
Read More

Computer Organization and Architecture Fundamentals

Computer Technology and Architecture

  1. Computer technology is changing at a rapid pace.
  2. Computer architecture refers to those attributes that have a direct impact on the logical execution of a program.
  3. Architectural attributes include I/O mechanisms.
  4. Organizational attributes include hardware details transparent to the programmer.
  5. It is an architectural design issue whether a computer will have a multiply instruction.
  6. It is an organizational issue whether the multiply instruction will be implemented by
Read More

Comprehensive Guide to Sorting Algorithms and Data Structures

1. Lower Bound on Sorting Algorithm Complexity

Any correct sorting algorithm, regardless of its type (comparison-based or otherwise), has a lower bound on its worst-case complexity of Ω(n).

2. In-Place Sorting Algorithms and Auxiliary Storage

Statement: Sorting algorithms that sort objects “in place” require O(1) auxiliary storage (on top of the space needed to store the values to be sorted).

Assessment: Valid

3. Sorting Algorithms and In-Place Sorting

Question: All of these sorting algorithms sort objects

Read More

Lab 5: Configuring GRUB Boot and Kernel Modules

Overview

This lab covers configuring the GRUB boot loader and inserting/removing modules onto a running kernel. It is recommended to perform these steps in a controlled environment like the 401lab to allow for rebooting in case of errors.

Key Concepts

  • rpm (Red Hat Package Manager): Installs, verifies, and queries packages.
  • Hot-plugging: A feature (especially in SuSE Linux) that allows the system to detect newly added hardware like USB or FireWire devices.
  • lsmod: Lists all loaded modules.
  • diff: Compares
Read More

Learn Go in Y Minutes: A Crash Course in Golang Programming

Learn Go in Y Minutes

Introduction

This is a crash course in the Go programming language. It covers the basics of syntax, data types, control flow, and concurrency.

Getting Started

Go is a statically typed, compiled language with a focus on simplicity and efficiency. It’s known for its built-in concurrency features and fast compilation times.

Package Declaration

Every Go source file starts with a package declaration. The main package is special and declares an executable program.

package main

Import Declaration

Import

Read More

Pipeline Performance and Hazard Detection in Computer Architecture

Given a non-pipelined architecture running at 2.5GHz that takes 5 cycles to finish an instruction. You want to make it pipelined with 5 stages. The increase in hardware forces you to run the machine

at 2GHz. The only stalls are caused by:

  • memory – (30% of the total instructions) a stall of 50 cycles happens in 2% of the memory instructions
  • branch – (20% of the total instructions) a stall of 2 cycles happens in 20% of the branch instructions

What is the speedup? Clearly show all work.

Equation

For the following

Read More