CSC 300L 1st Semester Past Questions

You might also like

Download as pdf
Download as pdf
You are on page 1of 7
ry OF CALABAR, CALABAR SITY OF Cr vr ecphan UNE BAR RP, PME 3 CSMPUTER SCIENCE: \ i oe y12022, CURSE CODE: CSC 311 opeay ING 2. HRS FIRST Si:MESTER EXAMINATION 202/202 Vo INSTRUCTION: ANSWER ANY FOUR QUESTIONS. TWO FROM EACH SECTOt SECTION A ition (i) Explain }. (@xi) What is race © soling internpts as 4 way of executing mutue! exclu ‘on (ii) Briefly ¥ Nair ihe muhOPofdign (b) Ui) byalain the method of ais uting i ) expla whut is interprocess eofamunication af state the three major issues involved in interprocess condition and state the wns that can help avoid race condi conatmunivation (o) Briefly explain the process hierarchy an¢ respectively ts implementation in Windows O.$ and UNIX O.S. (a) () Diffeventiate between a thread and a pkfcess ({i) what are the resources of a thread ; {b) State the four events that cause a process fo be created, and briefly explain the two categories of processes that the O. S. creates. (c) What is the UNIX system call that creates process and what happen next after this system ay * ‘ ess control block entries. f i (a) Briefly explain the process table or the prt j J transitions. (i) State the different conditions thatean (b) () Explain the process state and the proc lead 10 proeess termination (© @) Explein what you understand by pscud}parallelism, (ii) Explain the differe that 3procesy nt types oftthreads Avs Internal and External fragmentation. SECTION B : 4, (a) Explain the difference betweex the follow fag ii, Logical Address space and physical Addriss space ()) Compare paging with segmentation with ifspect to the amount of memory required by 1 3) cress translation structures in order to convprt virtual addresses 1 physical address. t faction of memory management. advantages of using unequal size partitions. itigning scheme, what are t > list five (5) requirensents needed for the sai (b) Briefly explain the following: i Physical U ‘ganization ii, Protection iii, Sharing | / : / © List five (5) memory management techniqifes. : Lb & Define swapping, hence with the aid of a fiagram illustrate the swapping of two processes/usin, a disk us a backing store, ' tA (b) What is dispatcher, hence state its functio, (©) Lisi five (5) scheduling criteria, | DEPARTMENT OF COMPUTER SCIE RSITY OF CALABAR it 2021/2022 EXAMINATION, Course Costifhiite: CSC 351 (ALGORITHMS AND COMELEXITY ANALYSIS) Unsiructionst Answer all questions ola) State two compelling reasons why the study of algorithms is important {b} What is today’s modern definition for an algorithm? State five (5) basie characteristics specified in this modern definition. it § ©) Write down or ing dieatons for going from your school 19 Your home with the precision required from ; an algorithm's description : cision requirea f Gy Write down a recipe for cooking your favorite dish with the precision required by an algorithm, (a) Find god (31415, 14142) by applying Euclid’s algorithm : (b) There are n lockers in a hallway, ‘numbered sequentially from 1 to m- Initially, all the locker doors are closed. Fae ay passe by the lockers, each time starting with Jocker #1, On the ith pass, i=1,2, ++, you open J ites open, you close it. After the last pass vt feh Tocker doors are open and which are closed? How many of them are open. Represent your solution algorithmically. ‘ (c), Deseribe the algorithm used by your favourite ATM machine in dispensing cash. (Note: You may give your description in either a natural language or Pseudocode). 3. Consider the following algorithm. ALGORITHM Mystery(n) {/lnput: A nonnegative integer n s-0 fori — 1 tondo SeStisi return $ a. What does this algorithm compute? b, What is its basic operation? How many times isthe basic operation executed? «. What is the efficiency class of this algorithm? 6. Siggest an improvement, or a Better algoitin’ altogether, and indicate its efficiency class If you cannot do it, try {6 prove that, infact, it eannot be done. 4 (@)Mention and explain the two ways that ean be used to represent graphs in @ computer program? (b) Use the graph below to prepare an adjacency matrix oO { a ie (0 Denorseae jour understanding on the reason why space efficiency is no longer a basic concer in Algorithm 5 |, (feiphinths why the input size under te following circumstances: i) Situations that requires sorting, searching, aud sinJing the largest or smallest elemer sj (Gi) Situation that requires the ae son of pobvonal pO) =a ae’ mea \ {ii) Situations that requires computing the prod of two n x n matrices {b) Mention three Basie operations in graph algorithms aad discuss the concept of a ‘raph algorithms ad discuss the concept of “order of growth”? (san a tnt crc male hat do you understand by basic operation of an Algorithm? ‘s Ee an? wy basic operation of an Algorithm? What is the simplest way to identify the basie (c) Evaluate and find the time complexity of the function from the code snippet below. dep jad?) ne ” = UNIVERSITY OF CALABAR DEPARTMENT OF COMPUTER SCIENCE, Boy IN 202 FIRST SEMESTER EXAMINATION ACADEMIC SESE - NUMERICAL ANALYSIS a and are any two classical numerical integration formulas. . Any wo numerical methods for solving algebraic equations are ju) tn Newlon Raphson method ifthe curve f(x) is constant then sraic equations is convergence sensitive to the starting value? ... Cen «are emrots already present in the statement of the problem before its solution is sought, and are and in which numerical method of solving erors committed when fewer numbers of processes are used in computational process. vi) The aim of elimination steps in Gaussian elimination method is to reduce the coefficient matrix to vil) The function f(x) that represents the values (0, 3), (1, ) and (2,11) is .. vii) is the degree ofthe polynomial that represents the values (0, 4) and (2, 8) ix) The expression that represents ,*(x) in terms of forward shift operator E is in Gaussian elimination method, the orginal equations are transformed by using ....... x) SECTION B Question? — <20 Marks> 4) Draw a flowchart for the Regula-falsi method of finding the first n approximations to the root of f(x) and use the fldwchart to find successive approximations x1, x2 ..., x5 to the root of 3x2 ~ Sx - 2 in [1, 2} ») (i) Compare the Newton-Raphson method with the Reguia-Falsi method of solving transcendental equations based on their unique features. (i) List the five distinct phases of machine computation as discussed in class. Question 2 <20 Marks> ) Draw @ flowchart for the Newton-Rapson method of finding the first n approximations to the root of f(x) and used the flowchart to find the root of x* ~ 16x? + 15 = 0 which is near to x = 2. ( 1 t are given as 0.167, 0.160, 0.166 and 0.165. Which of these four is the best ; +) Four approximate values of the number epproximation, assuming that the true value is taken to 6 decimal places? Question3 — <20 Marks> 3) Use Lagrange interpolation formula to find the polynomial P(x) that approximate fa) from the table of values below x 300 | 304 305] 24529 | 24843] Lg Tarr ») Use Newton's forward interpolation formula to find y(x) that represent the table of values below xk 18 igor | tstt | fy) | 46 66 81 Hence, find p(301). L Hence, find y(1898). Best of luck : COMPUPER SCIENCE - UNIVERSITY OF CALABAR PARTMENT OF COMP FER SCIENCE - UNIVERSITY OF CAL Perse EXAMI TION (2020/2021 SESS!ON), DATE: 08/7/2023 OSC 331: COMPILER CONSTRUCTION 1 __ "ME: 2 HOURS. TNSTRUCTION: Ananor QUESTION 3 aid any otber wo question KEEP AWAY YOUR PHONES ESTION 20 marks i f4 hed ave si are programming languages? Hence, with the aid of examples, differentiate between natural and artificial languages. (b) Discuss any three longuages of the computer and explain why the foreign languages require use of translators, ; oe © Defoe compiler and comment briefly on the components of the front-end of a compiler known to you QUESTION 20 marks ) Write short notes on the following compiler terms: (i) byte codes (iii) linker (iii) loader (iv) interpreter (4) Assembler (o) Whatare the advantages of; (}) a compiler over an interpreter (i) aa interpreter over a compiler © Given & grammar G1 list > list + digit list > list — digit list > digit f digit > 0)1/213]4)5)5]7}8)9| What type of grammar is Ci? (ii) what ate the terminal symbols of G1? (iii) what are the non-terminal symbols of G1? (iv) what is the root or start symbol of G1 (v) with the aid ofa parse tree, generate five valid symbols or sentences of G1. TION 3 (COMPULSORY) 30 marks {a) A--~ allows several files of a relocatable machine code to be formed into a (b) The process ~ consigs of taking relocatable machine code, addresses, and placing tl locations. \ (©) Using the expression s = ut,+ % at i, Draw a syntax tree fpr it ii, Generate the tosis for it \ ili. Show the symbol table entries for wo QUE single program. altering the relocatable altered instructions and data in the memory at the proper QUESTION 4 20 marks {a) Using the expression s = ut + % at i. Generate the interiiediate code Generate the optimized code QUESTION 5 20 marks ) Give the ouspuu of the first three compiler phases for the following source text: inta, bye real d; a=btetd 3. With appropriate examples, explain any three operati yee Ples, explain any three operations that can be performed on a b. What is the difference between a Pass and a phase? DEPARTMENT OF COMPUTER SCIENCE > om SS? UNIVERSITY OF CALABAR ) FIRST SEMESTER 2021/2022 EXAMINATION COMPUTER ARCHITECTURE AND ORGANIZATION L(CSC 321) ANSWER QUESTION 1 AND ANY OTHER TWO Q) QUESTIONS | DATE: 05-07-2023, ‘TIME ALLOWED: 2 HOURS «1 processing operations is called ~ and input/output devices, QUESTION 1-30 marks i he part of the Computer that controls the operations o} i {he register that contains the address 0 \s. The =-- bus carries the address of data (but not the dat V.. The $085 microprocessor is an 8-bit general purpos? kilobytes of memory. ‘The result of operations in the arithmet After an arithmetic or logic operation, if result has evea number of Is, the The wo major types of interrupts are and The way an instruction is expressed in a computer system archi { performs the bulk of dat components like ALU, memory the next instruction to be executed is called !a) between the processor and the memory. ‘microprocessor which is capable to address --—- flag is set tic and logic unit are stored in the ‘Name the three jitecture is known as ~- ix variants of such representation of instructions. : : x. Inthe --- addeessing mode, the effective address is determined by the index mode by using the program counter instead of general purpose processor register QUESTION 2 - 20 marks stating their pros and With suitable illustrations, distinguish between fixed and variable length instruction formats, cons. | QUESTION 3-20 marks Compute the decimal representations of the following 19F AEs, 19FDCi6 and 17FDB16 Differentiate between single instruction, multiple data (SIMD) and multiple instruction, multiple data (MIMD). QUESTION 4-20 marks With a suitable illustration using the block diagtum of the arithmetic and logic unit, list the major components of the 8085 microprocessor arithmetic and logic unit. i What are registers? Mention the three major types of registers. iii, What do you understand by addressing mode? Mention the five basic addressing modes and explain vividly how any one (1) of them works. i, ii i, STION 5-20 marks and _ ‘i, ‘Three main hardware element of a machine langua; r e language are 5 iii, Find the two's compliment of (a) 29 (b) 119 i iv. Subtract 29 from 119 using one’s compliment The three common ways of representing a signed binary number in computer technology are [64 937 UNIVERSITY OF CALABAR TIME: 2 HRS. DEPARTMENT OF COMPUTER SCIENCE SEMESTER: FIRST SEMESTER EXAMINATION 9 ACADEMIC SESSION: 2021 2022 COURSE TITLE: STRUCTURED PROGRAMMING COURSE CODE; CsC34! ao ENS PREC TIONS: ASHER ALL QUESTIONS FON SECTION A AND ANY THR: PHONE(S) ARE NOT ALLOWABLE IN THE EXAMINATION HALL. SECTION A: PEST QUESTION - 10 MARKS in 3 teristics of the object-oriented programming paradigm. (6 Marks) r 2 advantages and disadvantages of euch paradigm above? (4 Marks) SECTION bi: EXAMINATION QUESTIONS -70 MARKS: Acy features of structured programming languages. »\\ dogs these features in (a) promote clear and organized code? dc 2 examples of control structures and discuss how they help to simplify programs and 1 easier to maintain, allenges that can arise when using structured programming d? erators used to combine multiple tests into one. cau the challenges explained above be addre: 2 entign 2 logical ¢ Vai modularity and what is a moduly fn modular programming otoly pe or blueprint called Interest computes interest on an account balance. The ction takes arguments for the initial balance, the monthly interest rate and the number of months for which interest must be paid. The value returned is the interest due. Using an object- srumining upprouck, design a UML. class diagram for the above statement. owes on the following: Reusability, Abstract Data Types (ADT), Classes and Oijects, abstraction (citing examples dettonstrated in class). oriented pro, rt s examples, explain what you understaad by multisparadigms languages. © between object-oriented programming style and structured programming, proach, using the following properties as benchmark: Top-down design, Bottom-up design, Voces», Data, Security, Data hiding, Reusubility and the Ability to handje complexity. | o4 Jie statement is from a language used to interact with databases: SELECT * FROM Department WHERE Course ="CSC34 1’; Which programming language par wigm docs the statement support. ‘ in few words, define this style of programming paradigm. State the three advantages and two disadvantages of these programming paradigm. UNIVERSITY OF CALABAR a olaco ARTMENT OF COMPUTER SCIENCE NATION 2021/2022 ACADEMIC SI LON PIRST SEMESTER EXAM! minsT | ona 1 COMPUTER LAB 34. DATE: 07/07/2023 TRUCTION: ANSWER ALL QUESTIONS IN SECTION A AND ANY ONE QUESTION IN INSTRUCTIO SQN B. TIME: 1S HOURS SECTION A ) In HTML, the tellthe web browser how to display web pages and _ can give further details, about the HTML elements on a page. in HTML is used to link to another document on a website. ii) The, while PHP stands for. iii) HTML stands for iv) The three components of a CSS syntax are 7 » and \) The three ways of inserting a style sheet are me and vi) In PHP, the two most fundamental constructs fo’ printing to output are and .. vii). The two types of comment in PHP are and. viii) The two branching structures in PHP are and ix) PHP borrowed its syntax from two programming languages, which are and x) The two major methods to submit form in PHP are and and xi) The two main techniques to read and write a file in JavaScript are ii) JavaScript supports three different forms of popup boxes ....... are the two fundamental categories of data types in JavaScript. are used in JavaScript to handle exceptions. , and iii) and iv) The keyWOPdS..o.eaen @NC xv) Does MySQL require a semicolon after each query? (TruelFalse). xvi) Can one write multiple statements in a single line in MySQL? (TruelFalse). Avil). In MySQL... Command is used to delete the entire data in a table without disturbing the table defniton, vill) In C+, the expression A=k++ causes... and the statement k++ is equivalent to. ..is the entry point of any C++ program and every C++ program must have a is a bottom-checking loop as. is a top-checking loop. xix) The function. XX) SECTION B Question 1 a) Liste four elements of a PHP function definition with an appropriate example. 5) Lstand gwve atleast one example of commands in each category of SOL commancs. tion 2 3) List and deseribe any fve of te eight basic dats ‘ypes in PHP. ©) Diferentate between call by value and ca by reference wth a suitable example oftheir operations in C++ Question 3 a) Describe any two advanced concepts in cbj e ject-0r ented programming suj J 5) () In your website, how do you define a JavaSeri block? (i) List ‘wo bones of vb ane ® as opposed to an inline JavaScript section oo

You might also like