Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

COMP ENG 2SH4 Principles of Programming Day Class Duration of Examination: 2.5 Hours MCMASTER UNIVERSITY FINAL EXAMINATION

Beoordeling
-
Verkocht
-
Pagina's
10
Cijfer
A+
Geüpload op
23-10-2023
Geschreven in
2023/2024

COMP ENG 2SH4 Principles of Programming Day Class Duration of Examination: 2.5 Hours MCMASTER UNIVERSITY FINAL EXAMINATION Instructor: SORINA DUMITRESCU December 2016 This examination paper includes 5 pages and 5 questions. You are responsible for ensuring that your copy of the paper is complete. Bring any discrepancy to the attention of your invigilator. SPECIAL INSTRUCTIONS: Do not detach pages from this exam. Answer all questions on the provided answer booklet. This paper must be returned with your answers. The number in brackets at the start of each question is the number of points the question is worth. No reference material of any kind is allowed. No calculators of any kind are permitted. 1. (20) Q1. Programming in C: Write a C function with prototype int isSuffix(const char* s1, const char* s2), which returns 1 if string s1 is a suffix of string s2 and returns 0 otherwise. Note that string s1 is a suffix of string s2 if s1 appears at the end of s2. Examples: ”end” is a suffix of ”weekend”; ”end” is a suffix of ”end”; ”week”, ”eke” and ”back” are not suffixes of ”weekend”. If you need to use any function in your code, you will have to write it yourself. For instance, you may write a function which returns the length of a string, and use it in function isSuffix(). You are not allowed to use any C library functions. Include instructive comments. Solution 1: int len(const char *s){ int i=0; while(*s!=0){ i++; s++; } return i; }// end len int isSuffix(const char* s1, const char* s2){ int l1=len(s1), l2=len(s2); if(l1l2) return 0; for(i=0; il1; i++){ if(s1[l1-1-i]!=s2[l2-1-i]) return 0; } return 1; } 2. (20) Q2. Programming in C: This exercise uses the following C structure type definition: typedef struct{ int day; int month; int year; } Date; Write a C function with prototype int remove(Date* birthdates[], int* sizePtr, int index), where birthdates is an array of pointers to structure variables of type Date, each such structure variable representing the date of birth of an employee in a company. You may think of the array birthdates as a list containing all these birth dates. Parameter sizePtr is a pointer to a variable in the caller that stores the size of the list (number of structure variables). Function remove() is invoked to remove from the list the date of birth of an employee who leaves the company. Parameter index represents the position in the array c

Meer zien Lees minder
Instelling
COMP ENG 2SH4
Vak
COMP ENG 2SH4









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
COMP ENG 2SH4
Vak
COMP ENG 2SH4

Documentinformatie

Geüpload op
23 oktober 2023
Aantal pagina's
10
Geschreven in
2023/2024
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$10.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ExamsConnoisseur Self
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
587
Lid sinds
3 jaar
Aantal volgers
344
Documenten
1492
Laatst verkocht
2 weken geleden

4.2

68 beoordelingen

5
40
4
11
3
13
2
1
1
3

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen