Question

Question 11 pts Fill in the blank. Two functions are defined main.c and MyAge.c   // FILE...

Question 11 pts

Fill in the blank. Two functions are defined main.c and MyAge.c  

// FILE main.c

main ( )

{

_______ int age ;

printf ( " the value of age is %d \n", age ) ;

}

// FILE MyAge.c

int age = 10;

int MyAge ( )

{

}

Group of answer choices

static

external

internal

extern

Flag this Question

Question 21 pts

Fill in the blank. Two functions are defined main.c and MyAge.c  

The below program will result in compilation error

// FILE main.c

main ( )

{

extern int age ;

printf ( " the value of age is %d \n", age ) ;

}

// FILE MyAge.c

int MyAge ( )

{

int age = 10 ; // local variable

}

Group of answer choices

True

False

Flag this Question

Question 31 pts

When you want memory allocated dynamically, you can call function

Group of answer choices

allocate ( )

malloc ( )

memAlloc ( )

GetMemory ( )

Flag this Question

Question 41 pts

malloc returns  

Group of answer choices

int *

char *

void *

float

Flag this Question

Question 51 pts

I need to assign int pointer to the pointer returned by malloc .

fill in the blank

int * ptr = _______ malloc ( 12 ) ;

Group of answer choices

( int )

( char * )

( int * )

( void * )

Flag this Question

Question 61 pts

pretend there is a structure  

struct _profile *ptr

is defined elsewhere. I want to allocate memory sufficient enough for one  structure.

fill in the blank

struct _profile *ptr = (struct _profile * ) malloc ( _________  )

Group of answer choices

1

(sizeof) (struct _profile )

sizeof (struct _profile )

sizeof (int)

Flag this Question

Question 71 pts

pretend there is a structure  

struct _profile *ptr

is defined elsewhere. I want to allocate memory sufficient enough for five structures.

fill in the blank

struct _profile *ptr = (struct _profile * ) malloc ( _________  )

Group of answer choices

5 * sizeof ( struct _profile )

sizeof ( struct _profile )

5

5 * sizeof ( ptr )

Flag this Question

Question 81 pts

what is the command to print all environment variables ?

Group of answer choices

showenv

environ

env

environment

Flag this Question

Question 91 pts

argc and argv related

I am issuing a command

./a.out 3 6 8 9

What is the value of argc ?

Group of answer choices

3

4

5

6

Flag this Question

Question 101 pts

argc and argv related

I am issuing a command

./a.out 3 6 8 9

What is the value of argv [ 0 ] ?

Group of answer choices

3

6

8

./a.out

Flag this Question

Question 111 pts

malloc

char * ptr = ______ malloc ( 8 ) ;

Group of answer choices

( char * )

char *

int *

(int * )

Flag this Question

Question 121 pts

I want to allocate 10 bytes.

short *ptr = ( short * ) malloc ( 5 * sizeof ( ____ ) ) ;

Group of answer choices

char

short

int

float

Flag this Question

Question 131 pts

int *ptr = (int *) malloc ( 12 ) ;

When I want to release the dynamic memory pointed to by *ptr, I want to release it by this function

Group of answer choices

release ( ptr )

free ( *ptr )

free ( ptr )

givingUp ( *ptr )

Flag this Question

Question 141 pts

char *ptr = (char*) malloc ( 12 ) ;

When I want to release the dynamic memory pointed to by *ptr, I want to release it by this function

Group of answer choices

free ( ptr ) ;

free ( * ptr ) ;

free ( ) ;

release ( ptr )

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 11 pts

Fill in the blank. Two functions are defined main.c and MyAge.c
ANSWER: extern

// FILE main.c
main ( )
{
_______ int age ;
printf ( " the value of age is %d \n", age ) ;
}

// FILE MyAge.c
int age = 10;
int MyAge ( )
{
}

Group of answer choices
static
external
internal
extern<===================ANSWER

*****************************************************************************
Question 21 pts

Fill in the blank. Two functions are defined main.c and MyAge.c
The below program will result in compilation error

Answer: TRUE

// FILE main.c
main ( )
{

extern int age ;
printf ( " the value of age is %d \n", age ) ;
}

// FILE MyAge.c

int MyAge ( )
{
int age = 10 ; // local variable
}

Group of answer choices
True <===================ANSWER
False

*****************************************************************************
Question 31 pts

When you want memory allocated dynamically, you can call function
ANSWER: malloc()

Group of answer choices

allocate ( )
malloc ( ) <========================ANSWER
memAlloc ( )
GetMemory ( )
*****************************************************************************
Question 41 pts

malloc returns
ANSWER : void*
Group of answer choices

int *
char *
void * <=====================ANSWER
float
*****************************************************************************
I need to assign int pointer to the pointer returned by malloc .

fill in the blank

ANSWER: (int *)


int * ptr = _______ malloc ( 12 ) ;
Group of answer choices
( int )
( char * )
( int * ) <===================ANSWER
( void * )
*****************************************************************************
pretend there is a structure

struct _profile *ptr
is defined elsewhere. I want to allocate memory sufficient enough for one structure.
fill in the blank
ANSWER: sizeof (struct _profile )
struct _profile *ptr = (struct _profile * ) malloc ( _________ )

Group of answer choices

1
(sizeof) (struct _profile )
sizeof (struct _profile ) <======================ANSWER
sizeof (int)

*****************************************************************************
pretend there is a structure

struct _profile *ptr

is defined elsewhere. I want to allocate memory sufficient enough for five structures.

fill in the blank
ANSWER: 5 * sizeof ( struct _profile )
struct _profile *ptr = (struct _profile * ) malloc ( _________ )

Group of answer choices
5 * sizeof ( struct _profile ) <===============================ANSWER
sizeof ( struct _profile )
5
5 * sizeof ( ptr )
*****************************************************************************
what is the command to print all environment variables ?
ANSWER : env
Group of answer choices

showenv
environ
env <====================ANSWER
environment
*****************************************************************************
Question 91 pts

argc and argv related
I am issuing a command
./a.out 3 6 8 9
What is the value of argc ?
ANSWER: 5 (program name is also counted as argument)
Group of answer choices

3
4
5 <==================ANSWER
6
*****************************************************************************
argc and argv related

I am issuing a command

./a.out 3 6 8 9

What is the value of argv [ 0 ] ?
ANSWER: ./a.out

Group of answer choices

3
6
8
./a.out <=============ANSWER
*****************************************************************************
malloc

char * ptr = ______ malloc ( 8 ) ;
ANSWER: (char *)
Group of answer choices

( char * )<=============ANSWER
char *
int *
(int * )
*****************************************************************************
I want to allocate 10 bytes.

short *ptr = ( short * ) malloc ( 5 * sizeof ( ____ ) ) ;
ANSWER: short
Group of answer choices
char
short <====================ANSWER
int
float
*****************************************************************************
int *ptr = (int *) malloc ( 12 ) ;

When I want to release the dynamic memory pointed to by *ptr, I want to release it by this function
ANSWER: free ( ptr )
Group of answer choices

release ( ptr )
free ( *ptr )
free ( ptr ) <==================ANSWER
givingUp ( *ptr )
*****************************************************************************
char *ptr = (char*) malloc ( 12 ) ;

When I want to release the dynamic memory pointed to by *ptr, I want to release it by this function
ANSWER: free ( ptr ) ;
Group of answer choices
free ( ptr ) ; <======================ANSWER
free ( * ptr ) ;
free ( ) ;
release ( ptr )

Add a comment
Know the answer?
Add Answer to:
Question 11 pts Fill in the blank. Two functions are defined main.c and MyAge.c   // FILE...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN C ONLY As mentioned earlier there are two changes we are going to make from...

    IN C ONLY As mentioned earlier there are two changes we are going to make from lab 5, The file you read into data structures can be any length. studentInfo array will be stored in another struct called studentList that will contain the Student pointer and current length of the list. Sometimes data can be used in structs that correlate between variables so it's convenient to store the data in the same struct. Instead of tracking a length variable all...

  • In c programming The Consumer Submits processing requests to the producer by supplying a file name, its location and a character. It also outputs the contents of the file provided by the producer...

    In c programming The Consumer Submits processing requests to the producer by supplying a file name, its location and a character. It also outputs the contents of the file provided by the producer to the standard output. The Producer Accepts multiple consumer requests and processes each request by creating the following four threads. The reader thread will read an input file, one line at a time. It will pass each line of input to the character thread through a queue...

  • OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main()...

    OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...

  • Writing a program in C please help!! My file worked fine before but when I put...

    Writing a program in C please help!! My file worked fine before but when I put the functions in their own files and made a header file the diplayadj() funtion no longer works properly. It will only print the vertices instead of both the vertices and the adjacent like below. example input form commnd line file: A B B C E X C D A C The directed edges in this example are: A can go to both B and...

  • Programing In C Add Command Line Arguments (Argc and Argv) and use files to the following...

    Programing In C Add Command Line Arguments (Argc and Argv) and use files to the following program. My program is called Ultimo.exe and it is in (C:\Users\Dell\source\repos\Ultimo\Debug). The file used is a .txt file in the directory of the .exe program. The text file which is address.txt is at the same location as Ultimo.exe (C:\Users\Dell\source\repos\Ultimo\Debug). The program takes information in the address.txt file and sorts it by zip code, from smallest to largest. The program works by using input/output redirection...

  • I am getting the Segmentation fault error on the Ubuntu machine but not on macOS. Any...

    I am getting the Segmentation fault error on the Ubuntu machine but not on macOS. Any help would be appreciated. /**** main.c ****/ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <pthread.h> #include <string.h> #define WORD_LEN 6 #define TOP 10 char * delim = "\"\'.“”‘’?:;-,—*($%)! \t\n\x0A\r"; struct Word { char word[30]; int freq; }; int threadCount; int fileDescriptor; int fileSize; off_t chunk; struct Word* wordArray; int arrIndex = 0; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;...

  • I am having problems with the following assignment. It is done in the c language. The...

    I am having problems with the following assignment. It is done in the c language. The code is not reading the a.txt file. The instructions are in the picture below and so is my code. It should read the a.txt file and print. The red car hit the blue car and name how many times those words appeared. Can i please get some help. Thank you. MY CODE: #include <stdio.h> #include <stdlib.h> #include <string.h> struct node { char *str; int...

  • operating system programming i need ans and explen after 20 min 2 When we are implementing...

    operating system programming i need ans and explen after 20 min 2 When we are implementing the following program, then we press "CTRL+C" on the keyboard; that will cause: #include <stdio.h> #include<signal.h> #include <stdlib.h> #include<unistd.h> void handle_sigint (int sig) { } printf("Caught signal $d\n", sig); int main(int argc, char *argv[]) { signal (SIGCONT, handle_sigint); while (1) { printf("the process id is $d \n",getpid()); sleep (1); } return 0; } O print the sentence" Caught signal 2" on the terminal 53,65,67,37,14,98,122,124,183...

  • Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h>...

    Deleting multiples of a given integer from a linked list: #include <stdio.h> #include <stdlib.h> #include <assert.h> #define MAX 10000 typedef struct node_tag { int v; // data struct node_tag * next; // A pointer to this type of struct } node; // Define a type. Easier to use. node * create_node(int v) { node * p = malloc(sizeof(node)); // Allocate memory assert(p != NULL); // you can be nicer // Set the value in the node. p->v = v; p->next...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT