Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An increasing number of mobile telephony handsets are GPS-enabled. (i) Explain why a GPS receiver can take many minutes to locate itself when first turned

An increasing number of mobile telephony handsets are GPS-enabled. (i) Explain why a GPS receiver can take many minutes to locate itself when first turned on. [2 marks] (ii) This length of delay is unacceptable for many mobile handset users. Explain how network operators are able to reduce this delay. [2 marks] (iii) It is not always possible for a GPS receiver to see a sufficient number of GPS satellites to position itself. Describe how a Time Difference of Arrival (TDoA) system would allow a mobile handset to be positioned within a typical cellular network of today. Why is a Time of Arrival (ToA) system inappropriate here? [6 marks] (iv) Indoor location can provide very useful context for sentient computing. Assuming it worked indoors just as it does outdoors, explain why GPS locations might not be good enough for indoor applications. Describe one technique that a mobile handset of the future could potentially use to get reliable indoor location.

(a) State carefully the Fermat-Euler theorem, defining any terms that you use. [4 marks] (b) Explain how calculating a n?1 (mod n) for various values of a can be used to show that n is composite without actually finding its factors. By considering 561 = 3 11 17 or otherwise, show that the test is not perfect and suggest an improvement to make it more selective. [6 marks] (c) Derive the RSA system for public key cryptography and explain how this can be used both to send messages that are kept secret from an interceptor and to prove the identity of a sender. [6 marks] (d) Show that knowledge of the secret key as well as the public key allows an interceptor to factor the modular base being used. [4 marks] 8 Discrete Mathematics Let (A, 6A) and (B, 6B) be partially ordered sets. (a) Define the product order on AB and prove that it is a partial order. [4 marks] The upper bound of a set S ? A is an element u ? A (but not necessarily in S) such that ? s ? S . s 6 u. The least upper bound of S is an upper bound of S that is less than every other upper bound of S. The greatest lower bound is defined similarly. A lattice is a partially ordered set in which every pair of elements has both a least upper bound and a greatest lower bound. (b) Prove that (N, |), the natural numbers under the divisibility order, form a lattice. [4 marks] (c) Given a set X, prove that (P(X), ?), the power set of X under set inclusion, forms a lattice. [4 marks] (d) Does every subset of (N, |) have a least upper bound and a greatest lower bound? Justify your answer. What about (N0, |) and (P(X), ?)? [4 marks] (e) If (A, 6A) and (B, 6B) are lattices, show that AB is a lattice under the product order. [4 marks] 5 [TURN OVER CST.2001.1.6 SECTION D 9 Programming in Java For each of the following areas, write brief comments on the way in which Java and its libraries have been designed to try to prevent programmers from making undetected errors and to ensure that code runs on all possible brands and models of computer, yielding the same results in each case. (a) Programmers who get mildly confused about syntax or who make typing errors. [4 marks] (b) Groups of programmers working on libraries that will form part of some large project. [4 marks] (c) Numbers, characters, trig functions and so on. [4 marks] (d) Opening files, reading or writing and then closing them.

Resolve this code by using text files.

(in java programing language)

//----------------------------------

// Worker class storing the data members and methods of Worker objects

import java.io.Serializable;

public class Worker implements Serializable {

private int id;

private int birthYear;

private int salary;

public Worker(int id, int birthYear, int salary) {

this.id = id;

this.birthYear = birthYear;

this.salary = salary;

}

public int getBirthYear() {

return birthYear;

}

public int getSalary() {

return salary;

}

public void setSalary(int s) {

salary = s;

}

@Override

public String toString() {

return "Worker [id=" + id + ", birthYear=" + birthYear + ", salary="

+ salary + "]";

}

}

// end of Worker class

// java program implementing Worker class

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

import java.io.ObjectOutputStream;

import java.util.ArrayList;

import java.util.Scanner;

public class WorkerReadWrite {

public static void printWorkers(ArrayList workers) {

for(Worker w: workers) {

System.out.println(w);

}

}

public static ArrayList changeSalary (String inputFile, String outputFile) throws IOException {

ObjectInputStream objectinputstream = null;

ArrayList listOfWorkers = null;

try {

FileInputStream streamIn = new FileInputStream(inputFile);

objectinputstream = new ObjectInputStream(streamIn);

listOfWorkers = (ArrayList) objectinputstream.readObject();

for(Worker w: listOfWorkers) {

if(w.getBirthYear() <= 1992) {

w.setSalary(w.getSalary() + 150);

}

}

// write to output file

FileOutputStream fout = new FileOutputStream(outputFile);

ObjectOutputStream oos = new ObjectOutputStream(fout);

oos.writeObject(listOfWorkers);

oos.close();

} catch (Exception e) {

e.printStackTrace();

} finally {

if(objectinputstream != null){

objectinputstream .close();

}

}

return listOfWorkers;

}

// method that reads N worker objects (N is user-input) into file: w1.ser

public static ArrayList writeWorkers(String fileName, int n) throws IOException {

int id,birthYear,salary;

FileOutputStream fout = new FileOutputStream(fileName);

ObjectOutputStream oos = new ObjectOutputStream(fout);

Scanner input = new Scanner(System.in);

ArrayList listOfWorkers = new ArrayList<>();

// input of id, birthYear and salary of n workers

for(int i=0; i

System.out.print(" ID for Worker-"+(i+1)+" : ");

id = input.nextInt();

System.out.print(" Birth year for Worker-"+(i+1)+" : ");

birthYear = input.nextInt();

System.out.print(" Salary for Worker-"+(i+1)+" : ");

salary = input.nextInt();

listOfWorkers.add(new Worker(id ,birthYear,salary));

}

oos.writeObject(listOfWorkers);

oos.close();

input.close();

return listOfWorkers;

}

public static void main(String[] args) throws IOException {

int n;

Scanner scan = new Scanner(System.in);// used for taking input from the user

// take input for number of workers

System.out.print(" Enter the number of workers : ");

n = scan.nextInt();

System.out.println(" Writing workers to file w1.ser");

String input = "w1.ser";

String output = "w2.ser";

ArrayList workers = writeWorkers(input, n);

printWorkers(workers);

workers = changeSalary(input, output);

System.out.println(" After changing the salary:");

printWorkers(workers);

scan.close();

}

}

// end of WorkerReadWrite class

Write program to read matrix z(16) then replace the (1st) part with the (4th) part of z(16)? Q2: Write program to read matrix z(16) then replace the (2nd) part with the (3rd) part of z(16)?

image

Consider the following (possibly non-standard) grammar and denotational semantics for a list of statements. [2]; (Mai ( , ), where for k= 1.1...,n if y+z (Me ("y+z", s)A= if (VARMAP (y.s): == undef OR VARMAP (z,s) == undef) (ik ==x) a=a*c; b=b+a; c=b+c then v= Me ( , s) else vk VARMAP (is) then error else VARMAP (y.s) + VARMAP (z.s) y z (Me ("y+z", s)A= if (VARMAP (y.s) == undef OR VARMAP (z.s) == undef) The error state. then error else VARMAP (y.s) VARMAP (z.s) Suppose the current program state is [ , , ]. What is the program state after the following statements- [ , , ) [ . , ) None of the other answers (above or below) is correct. ( , . )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Operations Research

Authors: Frederick S. Hillier, Gerald J. Lieberman

10th edition

978-0072535105, 72535105, 978-1259162985

More Books

Students also viewed these Computer Network questions