Wednesday, 1 May 2019

ch - command line argument

What is command line argument ? Also explain how to pass command line arguments to „C‟ program


Arguments that take input by user before running a program are called A) Main function arguments B) Main arguments C) Command-line arguments D) Parameterized arguments

Arguments that take input by user before running a program are called 
A) Main function arguments 
B) Main arguments 
C) Command-line arguments 
D) Parameterized arguments

ch- file

file

End of file is detected by
A) fend()
B) endf()
C) EOF
D) FEND

b) What is a file in C? Discuss various modes in which a file can be opened. Also discuss types of files.

true/false

While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters. FALSE

If the file to be included doesn‟t exist, the preprocessor flashes an error message. TRUE

Using fprintf function, we can print on the standard output device.

fill in the blank:
Function ___(E) fputs________ writes a line to a specified file

Write a „C Program to copy test of one file to another file.

Explain the difference between Text Mode and Binary Mode files



 Explain the difference between Test mode and Binary mode files.


ch- Link List

link list
Write a program to add a new node to the beginning of a linked list and to the end of inked list.

Which are the demerits of linked list data structure?

true/false

A linked list is a linear data structure where each element is a separate object. TRUE

 It is better to use array than a linked list, when there is a fixed size list in a program.

Define array and link list. Give one example for each showing its usage.

fill in the blank
___link list_____ data structure facilitates to insert and delete data during the program execution.


ch- structure

structure
In ____union_____ all elements are stored in the same memory location.
We must use __dot______ symbol to access structure members.

true/false
A union cannot be nested in a structure FALSE

size of a pointer, which points to a structure, depends on size of a structure.
 2.7 All the members of a union share the same memory location.

question

Write a „C‟ program to store information (title, author, subject and book_id) of a Book using structure and display it in appropriate format

Write a C program to read following details of 50 students. Student Name,, Student Roll No, Class Display total number of students studying in Class “BCA”

b) Write two main differences between structure and union.

 Define a structure Distance having two data members: cm and mm in integer. The program enters three variables and find which distance is the largest among them. 

ch- Storage Class

storage classes

Register variable are active 
A) Outside the function 
B) Throughout the program 
C) Only in the function where it is defined
 D) Surrounding of that function


What is the output of this code
 #include 
void main() 

static int x; if(x++<2)
 main();
 } 
A) Infinite calls to main
 B) Run time error 
C) Varies 
D) Main is called twice

Which of the following is not a proper storage class in ‘C’?
A) auto 
B) dcc 
C) static 
D) extern 

1.10 Is the following statement declaration or definition: extern int i; 
a) Declaration 
b) Definition
c) Function 
d) Error


ans a) Declaration 

3 By default, storage class of local variable is ___auto_____
 Variables that are alive and active throughout the program are called _____global____ variables.

___extern_____ int fun(); - the declaration indicates the presence of a global function defined outside the current module or in another file. 

Global variable is initialized to __zero______ by default

What do you understand by local, global and static variables ? Explain
(c) Compare the lifetime, Scope, Initial value and storage place of all storage classes.

Explain different storage classes available in „C‟


ch- Memory Allocation

memory allocation
Memory allocation can be done by using keyword „create‟. FALSE
malloc() allocates memory from the heap and not from the stack. TRUE

Automatic variables are allocated memory in:
A) Heap 
B) Data Segment 
C) Code Segment 
D) Stack


. __realloc______ is a inbuilt library function to adjust the allocated dynamic memory size 

Index

ch-1 Introduction