For a typical program, the input is taken using _________
1.scanf
2.Files
3.Command-line
4.All of the mentioned
The type va_list in an argument list is used _____
1.To declare a variable that will refer to each argument in turn;
2.For cleanup
3.To create a list
4.There is no such type
typedef int (*PFI)(char *, char *)creates _________
1.type PFI, for pointer to function (of two char * arguments) returning int
2. error
3.type PFI, function (of two char * arguments) returning int
4.type PFI, for pointer
Bit fields can only be declared as part of a structure.
1.FALSE
2. true
3.Nothing
4.Varies
Each call of va_arg ____
1.Returns one argument
2.Steps va_list variable to the next
3.Returns one argument & Steps va_list variable to the next
4.None of the mentioned
Escape sequences are prefixed with ____
1.%
2./
3.”
4.None of the mentioned
For binary files, a ___ must be appended to the mode string.
1.Nothing
2. “b”
3. “binary”
4.“01”
In a variable length argument function, the declaration “…” can _____
1.Appear anywhere in the function declaration
2. Only appear at the end of an argument list
3.Nothing
4.None of the mentioned
In C language, FILE is of which data type?
1. int
2.char *
3. struct
4.None of the mentioned
Presence of code like “s.t.b = 10” indicates ____
1.Syntax Error
2.Structure
3.double data type
4.An ordinary variable name
Members of a union are accessed as______
1. union-name.member
2.union-pointer->member
3.both union-name.member & union-pointer->member
4.none of the mentioned
Presence of loop in a linked list can be tested by ________
1.Traveling the list, if NULL is encountered no loop exists
2.Comparing the address of nodes by address of every other node
3.Comparing the the value stored in a node by a value in every other node
4.None of the mentioned
putchar(c) function/macro always outputs character c to the _____
1.screen
2.standard output
3.depends on the compiler
4.depends on the standard
The size of a union is determined by the size of the ______
1.First member in the union
2.Last member in the union
3.Biggest member in the union
4.Sum of the sizes of all members
The statement prog < infile causes _____
1.prog to read characters from infile
2. prog to write characters to infile
3. infile to read characters from prog instead
4.nothing
The syntax to print a % using printf statement can be done by ____
1. %
2. \%
3. ‘%’
4.%%
What are the first and second arguments of fopen?
1.A character string containing the name of the file & the second argument is the mode
2.A character string containing the name of the user & the second argument is the mode
3.A character string containing file pointer & the second argument is the mode
4.None of the mentioned
What does the following command line signify? prog1|prog2
1.It runs prog1 first, prog2 second
2. It runs prog2 first, prog1 second
3.It runs both the programs, pipes output of prog1 to input of prog2
4.It runs both the programs, pipes output of prog2 to input of prog1
What does the following segment of C code do? fprintf(fp, "Copying!");
1.It writes “Copying!” into the file pointed by fp
2.It reads “Copying!” from the file and prints on display
3.It writes as well as reads “Copying!” to and from the file and prints it
4.None of the mentioned
What is FILE reserved word?
1.A structure tag declared in stdio.h
2.One of the basic data types in c
3.Pointer to the structure defined in stdio.h
4.It is a type name defined in stdio.h
What is meant by ‘a’ in the following C operation? fp = fopen("Random.txt", "a");
1.Attach
2.Append
3.Apprehend
4.Add
What is the correct syntax to declare a function foo() which receives an array of structure in function?
1.void foo(struct *var);
2.void foo(struct *var[]);
3.void foo(struct var);
4.none of the mentioned
What is the default return-type of getchar()?
1. char
2.int
3.char *
4.reading character doesn’t require a return-type
What is the difference between %e and %g?
1.%e output formatting depends on the argument and %g always formats in the format [-]m.dddddd or [-]m.dddddE[+|-]xx where no.of ds are optional
2.%e always formats in the format [-]m.dddddd or [-]m.dddddE[+|-]xx where no.of ds are optional and output formatting depends on the argument
3.No differences
4.Depends on the standard
What is the purpose of sprintf?
1. It prints the data into stdout
2.It writes the formatted data into a string
3. It writes the formatted data into a file
4.None of the mentioned
What is the return value of getc()?
1.The next character from the stream is not referred by file pointer
2.EOF for end of file or error
3.Nothing
4.None of the mentioned
What is the return value of putchar()?
1.The character written
2.EOF if an error occurs
3.Nothing
4.Both character written & EOF if an error occurs
What is the use of getchar()?
1. The next input character each time it is called
2.EOF when it encounters end of file
3.The next input character each time it is called EOF when it encounters end of file
4.None of the mentioned
What is the value of EOF?
1.-1
2.0
3.1
4.10
What is typedef declaration?
1.Does not create a new type
2.It merely adds a new name for some existing type
3.Does not create a new type, It merely adds a new name for some existing type
4.None of the mentioned
What will fopen will return, if there is any error while opening a file?
1.Nothing
2.EOF
3.NULL
4.Depends on compiler
When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?
1.Standard input
2.Standard output
3. Standard error
4.All of the mentioned
Which among the following is the odd one out?
1.printf
2.fprintf
3.putchar
4.scanf
Which header file includes a function for variable number of arguments?
1.stdlib.h
2. stdarg.h
3.ctype.h
4.both stdlib.h and stdarg.h
Which is true about function tolower?
1.The function tolower is defined in <ctype.h>
2.Converts an uppercase letter to lowercase
3.Returns other characters untouched
4. None of the mentioned
Which of the following data types are accepted while declaring bit-fields?
1.char
2.float
3.double
4.none of the mentioned
Which of the following data-types are promoted when used as a parameter for an ellipsis?
1.char
2.short
3. int
4.none of the mentioned
Which of the following fopen() statements are illegal?
1.fp = fopen(“abc.txt”, “r”);
2.fp = fopen(“/home/user1/abc.txt”, “w”);
3.fp = fopen(“abc”, “w”);
4.none of the mentioned
Which of the following function with ellipsis are illegal?
1.void func(…);
2.void func(int, …);
3.void func(int, int, …);
4.none of the mentioned
Which of the following is false about typedef?
1.typedef follow scope rules
2.typedef defined substitutes can be redefined again. (Eg: typedef char a; typedef int a;)
3.You cannot typedef a typedef with other term
4.All of the mentioned
Which of the following is not allowed?
1.Arrays of bit fields
2.Pointers to bit fields
3. Functions returning bit fields
4.None of the mentioned
Which of the following macro extracts an argument from the variable argument list (ie ellipsis) and advance the pointer to the next argument?
1.va_list
2.va_arg
3. va_end
4.va_start
Which of the following may create problem in the typedef program?
1.;
2.printf/scanf
3.Arithmetic operators
4. All of the mentioned
Which of the following mode argument is used to truncate?
1.a
2.f
3.w
4.t
Which of the following reduces the size of a structure?
1.union
2.bit-fields
3.malloc
4.none of the mentioned
Which of the following statement is true?
1.The symbolic constant EOF is defined in <stdio.h>
2.The value is -1
3.The symbolic constant EOF is defined in <stdio.h> & value is -1
4.Only value is -1
Which of the following uses structure?
1.Array of structures
2.Linked Lists
3.Binary Tree
4.All of the mentioned
Which of the given option is the correct method for initialization? typedef char *string;
1.*string *p = “Hello”;
2.string p = “Hello”;
3.*string p = ‘A’;
4.Not more than one space should be given when using typedef
Which option should be selected to work the following C expression? string p = "HELLO";
1.typedef char [] string;
2.typedef char *string;
3. typedef char [] string; and typedef char *string;
4.Such expression cannot be generated in C
Which type of files can’t be opened using fopen()?
1..txt
2. .bin
3..c
4.none of the mentioned