.autolab-asmt CSCI-2467-2019fall part1/README You can compile this program by running: gcc part1.c student.c -o part1 part1/part1.c /* part1.c -- This is part 1 of lab 0, CSCI2467, Fall 2016 */...

1 answer below »
i need help finishing this assignmet



.autolab-asmt CSCI-2467-2019fall part1/README You can compile this program by running: gcc part1.c student.c -o part1 part1/part1.c /* part1.c -- This is part 1 of lab 0, CSCI2467, Fall 2016 */ #include #include "student.h" int main () /* in this case we don't care about command line arguments */ { /* create a struct of type student_info called student */ /* then call the make_student() function from student.c * to fill it with information */ struct student_info student = make_student (); /* Now start printing out what's stored in student. * \n represents the newline character * %d is for substituting integer values */ printf ("ID number: %d\n\n", student.id); /* %s is for substituting a character array */ printf ("Name: %s\n\n", student.name); /* we reference individual array elements with [0] [1] etc */ printf ("CS Courses taken: CSCI%d, CSCI%d\n\n", student.csci_classes[0], student.csci_classes[1]); printf ("Reason for studying Computer Science:\n%s\n\n", student.reason); return 0; /* 0 is typically returned when no errors have occurred */ }; part1/student.c #include #include "student.h" struct student_info make_student(void){ struct student_info me; me.id = 2222222; strcpy(me.name, "My Name"); /* strcpy is necessary */ me.csci_classes[0]=2120; /* array indices always being with 0 */ me.csci_classes[1]=2450; strcpy(me.reason, "All the cool kids are doing it."); return me; } part1/student.h /* student.h */ /* define a struct for storing student information */ struct student_info { int id; char name[80]; /* 80 characters should be more than enough to store a name, right? */ /* need more stuff here */ int csci_classes[20]; /* has anyone taken more than 20 CS classes? */ char reason[400]; /* This means my reason for studying CS must be less than 400 characters, or I will have to increase the array size. */ }; /* this is a function prototype, the function itself is in student.c */ struct student_info make_student(void); part2/hello.c #include #define RETURNVALUE 67 int main() { int retval = RETURNVALUE; printf("Hello world.\n"); return retval; } part3/array_copy_ij.c /* by: Matthew Toups [email protected] Based on copyij and copyji functions described in Bryant & O'Hallaron's Computer Systems: A Programmer's Perspective text. August 15, 2016 */ #include #include void copyij (int src[2048][2048], int dst[2048][2048]) { int i, j; for (i = 0; i < 2048;="" i++)="" for="" (j="0;" j="">< 2048;="" j++)="" dst[i][j]="src[i][j];" }="" void="" main="" ()="" {="" *="" use="" malloc="" to="" grab="" appropriate="" size="" block="" of="" memory="" */="" int="" **a="malloc" (2048="" *="" 2048="" *="" sizeof="" (int));="" int="" **b="malloc" (2048="" *="" 2048="" *="" sizeof="" (int));="" *="" we="" could="" set="" values,="" or="" just="" leave="" whatever="" values="" are="" already="" in="" memory="" since="" we="" don't="" actually="" care="" what="" is="" inside="" the="" matrix="" */="" printf="" ("running="" copyij...");="" copyij="" ((int="" (*)[2048])="" a,="" (int="" (*)[2048])="" b);="" printf="" ("="" done!\n");="" return;="" }="" part3/array_copy_ji.c="" *="" by:="" matthew="" toups="" [email protected]="" based="" on="" copyij="" and="" copyji="" functions="" described="" in="" bryant="" &="" o'hallaron's="" computer="" systems:="" a="" programmer's="" perspective="" text.="" august="" 15,="" 2016="" */="" #include=""> #include void copyji (int src[2048][2048], int dst[2048][2048]) { int i, j; for (j = 0; j < 2048;="" j++)="" for="" (i="0;" i="">< 2048;="" i++)="" dst[i][j]="src[i][j];" }="" void="" main="" ()="" {="" *="" use="" malloc="" to="" grab="" appropriate="" size="" block="" of="" memory="" */="" int="" **a="malloc" (2048="" *="" 2048="" *="" sizeof="" (int));="" int="" **b="malloc" (2048="" *="" 2048="" *="" sizeof="" (int));="" *="" we="" could="" set="" values,="" or="" just="" leave="" whatever="" values="" are="" already="" in="" memory="" since="" we="" don't="" actually="" care="" what="" is="" inside="" the="" matrix="" */="" printf="" ("running="" copyji...");="" copyji="" ((int="" (*)[2048])="" a,="" (int="" (*)[2048])="" b);="" printf="" ("="" done!\n");="" return;="" }="" csci="" 2467,="" fall="" 2021="" lab="" 0:="" introductions="" to="" c="" and="" unix="" due:="" tuesday,="" august="" 31,="" 11:59pm="" 2467="" instructors:="" md="" wasi="" ul="" kabir="" 1="" introductions="" the="" purpose="" of="" this="" assignment="" is="" to="" perform="" two="" introductions="" while="" getting="" you="" started="" in="" your="" exploration="" of="" computers="" from="" a="" systems="" perspective.="" chapter="" 1="" of="" bryant="" &="" o’hallaron’s="" cs:app="" textbook="" will="" accompany="" this="" lab="" conceptually,="" and="" the="" tools="" we="" use="" will="" be="" explained="" further="" in="" the="" two="" pdf="" documents="" from="" stanford’s="" cs="" library="" (essential="" c="" and="" unix="" programming="" tools).="" please="" keep="" both="" the="" textbook="" and="" these="" two="" supplements="" handy="" as="" we="" work="" through="" this="" lab.="" the="" two="" introductions="" we="" will="" accomplish="" are:="" 1.1="" introducing="" you="" to="" the="" lab="" tools="" this="" lab="" will="" introduce="" you="" to="" the="" tools="" and="" processes="" we="" will="" use="" for="" all="" labs="" this="" semester.="" this="" includes="" how="" to="" access="" the="" initial="" files="" to="" work="" on="" and="" how="" to="" turn="" in="" your="" work="" using="" our="" autolab="" system.="" it="" is="" very="" important="" that="" you="" become="" comfortable="" with="" the="" process="" of="" starting,="" working="" on,="" and="" turning="" in="" a="" lab="" using="" the="" instructions="" given="" here.="" the="" labs="" after="" this="" one="" will="" be="" much="" more="" challenging,="" so="" you="" cannot="" afford="" to="" get="" held="" up="" on="" logistical="" details="" with="" those="" labs.="" use="" this="" opportunity="" to="" learn="" the="" system="" with="" this="" lab,="" which="" mainly="" requires="" you="" to="" follow="" directions.="" 1.2="" introducing="" us="" to="" the="" students="" your="" instructor="" wants="" to="" know="" a="" little="" bit="" about="" each="" of="" the="" students="" in="" the="" course.="" rather="" than="" pass="" out="" a="" survey="" or="" ask="" you="" to="" introduce="" yourselves="" in="" class,="" instead="" you="" are="" given="" the="" opportunity="" to="" introduce="" yourself="" while="" completing="" this="" simple="" lab="" assignment.="" 1="" 2="" pre-requisites="" 2.1="" what="" you="" will="" hand="" in="" this="" is="" an="" individual="" lab="" assignment.="" you="" must="" turn="" in="" only="" your="" own="" work,="" including="" comments.="" we="" will="" discuss="" much="" of="" this="" in="" class,="" but="" it="" is="" your="" responsibility="" to="" work="" on="" and="" complete="" the="" lab="" on="" your="" own="" as="" homework.="" you="" may="" do="" your="" work="" remotely="" using="" ssh.="" the="" instructions="" in="" this="" (and="" all="" subsequent)="" assignments="" assume="" that="" you="" are="" logged="" in="" to="" our="" class="" server.="" you="" will="" either="" open="" a="" terminal="" in="" room="" 209/212="" and="" type="" commands,="" or="" use="" the="" web="" client="" at="" https:="" webterminal.cs.uno.edu/,="" or="" use="" ssh.="" you="" will="" hand="" in="" your="" work="" electronically="" using="" autolab="" when="" you="" complete="" the="" steps="" given="" in="" this="" document.="" when="" you="" are="" finished,="" you="" will="" create="" a="" tar1="" file="" containing="" your="" work="" to="" submit="" which="" should="" contain="" the="" following="" files="" (including="" the="" bonus="" answers="" if="" you="" choose="" to="" attempt="" them):="" part1/part1.c="" part1/student.c="" part1/student.h="" part2/answers2.txt="" part2/a.out="" part2/bonus-answers2.txt="" part2/hello.c="" part2/hello.i="" part2/hello.s="" part2/hello="" part2/hello-att.s="" part2/hello-bits="" part2/hello-xxd="" part3/answers3.txt="" part3/bonus-answers3.txt="" part3/copyij_result.txt="" part3/copyji_result.txt="" 2.2="" get="" the="" initial="" handout="" files="" and="" set="" up="" a="" working="" directory="" the="" lab="" files="" are="" all="" contained="" in="" a="" tar="" file.="" you="" will="" download="" a="" copy="" of="" the="" tar="" file="" and="" then="" extract="" its="" contents="" in="" your="" home="" directory.="" each="" user="" has="" their="" own="" space="" on="" the="" system="" for="" files,="" called="" a="" home="" directory.="" the="" path="" for="" the="" directory="" is=""> where USERID is your UNO user ID. When you first log in and open a terminal, your home directory is the default starting point. The files on your home directory are accessible from all of the thin clients in rooms 209 and 212, as well as via ssh, so you should always be able to access them inside or outside the lab. 1This originally stood for (t)ape (ar)chive but the name persists decades later. tar is the most common archive format on Unix systems, analogous to zip files on MS Windows systems. 2 https://webterminal.cs.uno.edu/ https://webterminal.cs.uno.edu/ 2.2.1 Creating your directory We will make a protected working directory to use for all class assignments in your home directory, using the following commands: $ cd ~ $ mkdir 2467 $ chmod go-rwx 2467 Above, the first line changes our current directory to your home directory. Normally when you first log in this will already be the current directory, but in case it isn’t, it doesn’t hurt to do this. Then the second line creates a directory called 2467 for your lab work. The third line is important. This changes the permissions on the directory, ensuring that no other users (such as your classmates) can read your files. chmod is the Unix command for changing permissions. The characters go-rwx tell it to remove (-) the read (r), write (w), and execute (x) bits from both group (g) and other (o) users. We will describe these things more in class, but it is important that your working directory is fully private. Verify that the permissions look right by using the command ls -ld 2467. It should look like this (only the names and dates should be different): drwx------ 2 matoups2 matoups2 4096 Aug 17 12:13 2467 2.2.2 Downloading introlab-handout.tar from autolab Now you can get the assignment files by downloading the file introlab-handout.tar from Autolab. In a web browser, navigate to autolab.cs.uno.edu, select the ”Sign in with UNO” option near the bottom of the page and sign in with your UNO student credentials. Select the 2467 course, then Intro Lab from the list of assignments. Under ’Options’, click on ’Download handout’ to download introlab-handout.tar. Move it from Downloads to your 2467 directory. Then extract the tar archive using the tar command. See the example below: $ cd ~/2467 $ tar -xvf introlab-handout.tar The first line changes your current directory, so you are now “in” the 2467 directory where introlab-handout.tar was downloaded (the tilde symbol (~) is an abbreviation for your home directory, so it is equivalent to /home/). Then the second line extracts the files, using the tar command. This will cause a number of files to be unpacked. The letters xvf are given as an argument to the tar program.2 In fact, each letter denotes something specific we are telling the program. x is the main operation, short for extract, as opposed to create which does the opposite. v is an option, short for verbose, which says that we want to see a list of
Answered 2 days AfterSep 07, 2021

Answer To: .autolab-asmt CSCI-2467-2019fall part1/README You can compile this program by running: gcc part1.c...

Ali Asgar answered on Sep 10 2021
163 Votes
part1/part1.c
/* part1.c -- This is part 1 of lab 0, CSCI2467, Fall 2016 */
#include
#include "student.h"
int main () /* in this case we don't care about command line arguments */
{
    /* create a struct of type student_info called student */
    /* then call the make_student() function from student.c
     * to fill it with information */
struct student_info student = make_student ();
/* Now start printing out what's stored in student.
* \n represents the newline character
* %d is for substituting integer values */
printf ("ID number: %d\n\n", student.id);
/* %s is for substituting a character array */
printf ("Name: %s\n\n", student.name);
/* we reference individual array elements with [0] [1] etc */
printf ("CS Courses taken: ");
for (int i=0;i
<8;i++)
     printf("CSCI%d , ",student.csci_classes[i]);
printf ("\n\n");
printf ("UNO Email id: %s\n\n",student.UNO_Email);
printf ("Number of Semesters I have previously Attended: %d\n\n",student.sem_Num);
printf ("What I want most out of this class?\n%s\n\n",student.objective);
printf ("My non-CS interest: %s\n\n",student.hobby);
printf ("Reason for studying Computer Science:\n%s\n\n", student.reason);
printf ("Anything Else about me:\n%s\n\n",student.anythingElse);
return 0; /* 0 is typically returned when no errors have occurred */
};
part1/makefile
part1: student.c part1.c
    gcc -o part1 part1.c student.c
part1/student.h
    /* student.h */
/* define a struct for storing student information */
struct student_info {
int id;
char name[80]; /* 80 characters should be more than enough to store a name, right? */
/* need more stuff here */
char UNO_Email[50];
int sem_Num;
char objective[200];
char hobby[50];
char anythingElse[200];

//NEW STUFF ENDS HERE
int csci_classes[20]; /* has anyone taken more than 20 CS classes? */
char reason[400]; /* This means my reason for studying CS must be
less than 400 characters, or I will have to
increase the array size. */
};
/* this is a function prototype, the function itself is in student.c */
struct student_info make_student(void);
part1/part1
part1/README
You can compile this program by running:
gcc part1.c student.c -o part1
part1/student.c
#include
#include "student.h"
struct student_info make_student(void){
struct student_info me;
me.id = 2481382;
strcpy(me.name, "Katelyn Reneé Nolan"); /* strcpy is necessary */
me.csci_classes[0]=1581; /* array indices always being with 0 */
me.csci_classes[1]=1583;
me.csci_classes[2]=2120;
me.csci_classes[3]=2121;
me.csci_classes[4]=2125;
me.csci_classes[5]=2450;
me.csci_classes[6]=2467;
me.csci_classes[7]=3301;

strcpy(me.UNO_Email,"[email protected]");
me.sem_Num=3;
strcpy(me.objective,"I want to learn how to c programming properly");
strcpy(me.hobby,"Reading Book");
strcpy(me.anythingElse,"I Also have cerebral palsy");

strcpy(me.reason, "I always love working on computers");
return me;
}
part2/hello
part2/hello-bits
00000000: 00100011 01101001 01101110 01100011 01101100 01110101 #inclu
00000006: 01100100 01100101 00100000 00111100 01110011 01110100 de 0000000c: 01100100 01101001 01101111 00101110 01101000 00111110 dio.h>
00000012: 00001010 00100011 01100100 01100101 01100110 01101001 .#defi
00000018: 01101110 01100101 00100000 01010010 01000101 01010100 ne RET
0000001e: 01010101 01010010 01001110 01010110 01000001 01001100 URNVAL
00000024: 01010101 01000101 00100000 00110110 00110111 00001010 UE 67.
0000002a: 00001010 01101001 01101110 01110100 00100000 01101101 .int m
00000030: 01100001 01101001 01101110 00101000 00101001 00001010 ain().
00000036: 01111011 00001010 00100000 00100000 00100000 00100000 {.
0000003c: 01101001 01101110 01110100 00100000 01110010 01100101 int re
00000042: 01110100 01110110 01100001 01101100 00100000 00111101 tval =
00000048: 00100000 01010010 01000101 01010100 01010101 01010010 RETUR
0000004e: 01001110 01010110 01000001 01001100 01010101 01000101 NVALUE
00000054: 00111011 00001010 00001010 00100000 00100000 00100000 ;..
0000005a: 00100000 01110000 01110010 01101001 01101110 01110100 print
00000060: 01100110 00101000 00100010 01001000 01100101 01101100 f("Hel
00000066: 01101100 01101111 00100000 01110111 01101111 01110010 lo wor
0000006c: 01101100 01100100 00101110 01011100 01101110 00100010 ld.\n"
00000072: 00101001 00111011 00001010 00001010 00100000 00100000 );..
00000078: 00100000 00100000 01110010 01100101 01110100 01110101 retu
0000007e: 01110010 01101110 00100000 01110010 01100101 01110100 rn ret
00000084: 01110110 01100001 01101100 00111011 00001010 01111101 val;.}
0000008a: 00001010 .
part2/answers2.txt
In the hello.i file, the cpp compiler has imported the code from all the file included using #include commands.
It is in this phase that the checking is done to ensure all included files do exist and are available for reading. Also if any of the included file has any error it is caught in this stage.
This is a type of interpreter stage where all imported file's code is checked for errors before the actual program code is compiled.
part2/hello.s
    .file    "hello.c"
    .text
    .section    .rodata
.LC0:
    .string    "Hello world."
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
#space is allocated for retval
    .cfi_def_cfa_register 6
    subq    $16, %rsp
#value is placed in retval
    movl    $67, -4(%rbp)
    leaq    .LC0(%rip), %rdi
#Printf is called here
    call    puts@PLT
    movl    -4(%rbp), %eax
    leave
    .cfi_def_cfa 7, 8
#Program returns on this command
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .ident    "GCC: (Debian 10.2.1-6) 10.2.1 20210110"
    .section    .note.GNU-stack,"",@progbits
part2/hello-xxd
00000000: 2369 6e63 6c75 6465 203c 7374 6469 6f2e #include 00000010: 683e 0a23 6465 6669 6e65 2052 4554 5552 h>.#define RETUR
00000020: 4e56 414c 5545 2036 370a 0a69 6e74 206d NVALUE 67..int m
00000030: 6169 6e28 290a 7b0a 2020 2020 696e 7420 ain().{. int
00000040: 7265 7476 616c 203d 2052 4554 5552 4e56 retval = RETURNV
00000050: 414c 5545 3b0a 0a20 2020 2070 7269 6e74 ALUE;.. print
00000060: 6628 2248 656c 6c6f 2077 6f72 6c64 2e5c f("Hello world.\
00000070: 6e22 293b 0a0a 2020 2020 7265 7475 726e n");.. return
00000080: 2072 6574 7661 6c3b 0a7d 0a retval;.}.
part2/hello.c
#include
#define RETURNVALUE 67
int main()
{
int retval = RETURNVALUE;
printf("Hello world.\n");
return retval;
}
part2/hello-att.s
    .file    "hello.c"
    .text
    .section    .rodata
.LC0:
    .string    "Hello world."
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    subq    $16, %rsp
    movl    $67, -4(%rbp)
    leaq    .LC0(%rip), %rdi
    call    puts@PLT
    movl    -4(%rbp), %eax
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .ident    "GCC: (Debian 10.2.1-6) 10.2.1 20210110"
    .section    .note.GNU-stack,"",@progbits
part2/hello.i
# 1 "hello.c"
# 1 ""
# 1 ""
# 31 ""
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "" 2
# 1 "hello.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 27 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4
# 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 461 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
# 452 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 453...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here