Tuesday 1 April 2014

IT101 Advance C Programming Model Question Papers

SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 35
Subject Code: IT101                        Max. Marks: 100
Subject Name: Advance C Programming             Duration: 3 Hours
    PART A
1.        Literal means
    A.    a string.
B.    a string constant.
C.    a character.
D.    an alphabet.
2.        The C language consists of ____ number of keywords.
    A.    32
B.    40
C.    24D.    56
3.        What is the output of this program?
void main()
{
int a=b=c=10;
a=b=c=50;
printf(“\n %d %d %d”,a,b,c);
}
    A.    50 50 50
B.    Compile Time Error
C.    10 10 10
D.    Three Gaebage Value
4.        Which format specifier is used to print the values of double type variable
    A.    %If
B.    %Id
C.    %Iu D.    %f
5.        What is the output of the program?
enum colors {BLACK,BLUE,GREEN}
main()
{
    
    printf("%d..%d..%d",BLACK,BLUE,GREEN);
    
    return(1);
}
    A.    0..1..2
B.    1..1..1
C.    2..1..1
D.    1..2..2
6.        Which function is used to read character as you type?
    A.    getchar()
B.    getch()
C.    getche()
D.    Both (B) and (C)
7.        What is the output of this program?
void main()
{
int a=b=c=10;
a=b=c=50;
printf(“\n %d %d %d”,a,b,c);
}
    E.    50 50 50
F.    Compile Time Error
G.    10 10 10
H.    Three Gaebage Value
8.        Which format specifier is used to print the values of double type variable
    E.    %If
F.    %Id
G.    %Iu H.    %f
9.        What will be the output of the following program?
Void main ( )
{
Double x=28;
Int r;
R= x%5;
Printf (“\n r=%d”, r);
}
    A.    r= 3
B.    Run time Error
C.    Compile time Erroe
D.    None of the Above
10.        What the follwing function call mean?
Strcpy(s1 , s2 );
    A.    copies s1 string into s2
B.    copies s2 string into s1
C.    copies both s1 and s2
D.    None of these
    PART B
11.        Which are Bitwise Operators?
12.        Which are unformatted input output functions?
13.        Define Call by reference with example.
14.        What is the use of C functions?
15.        Distinguish between structure and union.
16.        What are the advantages of union
17.        Write the syntax of flushing a file.
18.        Write the syntax of write a file.
19.        What is the means of *argv[0]?
20.        What is mean by preprocessor?
    PART C
21.        Write about the C - Environment Setup using IDE.
    (OR)
    Describe the C Installation on Window, Mac OS and Unix.
22.        Explain about the following
a)    General form of a function and declarations
b)    Scope of functions
    (OR)
    Explain about the following
a)    Function Arguments
b)    Return Statements
23.        Write the program to receives an integer as input. The output is a sentence that gives the French name for the weekday that is associated with the integer. If the integer is not associated with a weekday, the program prints "C'est le mauvais jour."
    (OR)
    Summary about the Array and Structure with suitable examples.
24.        Write about the character input and output in details
    (OR)
    Write about the EOF  Detecting of EOF using feof() function
25.        Write about the advanced features of C Language.
    (OR)
    Write about the bitwise operator with suitable description and examples.


SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 35
Subject Code: IT101                        Max. Marks: 100
Subject Name: Advance C Programming             Duration: 3 Hours
    PART A
1.        Which of the following is a keyword used for a storage class?
    A.    printf
B.    external
C.    auto
D.    scanf
2.        The prototype of the function in the header file is-
    A.    Stdio.h
B.    stdlib.h
C.    conio.h
D.    io.h
3.        A pointer variable can be
    A.    passed to a function as argument.
B.    changed within function.
C.    returned by a function.
D.    assigned an integer value.
4.        ‘C’ is often called a
    A.    Object oriented language
B.    High level language
C.    Assembly language
D.    Machine level language
5.        The loop in which the statements within the loop are executed at least once is called
    A.    do-while
B.    while
C.    for
D.    goto
6.        What will be the output of the following program?
Void main( )
{
Int x []= {10,20,30,40,50};
Print f (“ \n %d %d %d %d “, x [4] ,3[x] ,x[2] ,1[x] ,x[0] );
}
    A.    Error
B.    10 20 30 40 50
C.    50 40 30 20 10
D.    None of these
7.        What will be the output of the following program code ?
void main ( )
{
char a[]= “Hello World” ;
char *p ;
p=a;
printf(“\n%d%d%d%d”,sizeof(a), sizeof(p), stren (a), strlen(p) );
}
    A.    11 11 10 10
B.    10 10 10 10
C.    12 12 11 11
D.    12 2 11 11
8.        Which is not keyword in ‘C’ ?
    A.    typedef
B.    const
C.    near
D.    complex
9.        Study the following C program
Void main ( )
{
Int a= 0;
For ( ; a ;);
A++;
}
What will be the value of the variable a, on the execution of the above program
    A.    I
B.    0
C.    –1
D.    None of these
10.        What is sizeof In ‘C’ ?
    A.    Operator
B.    Reserve Worf
C.    Both (A) and (B)
D.    Function
    PART B
11.        What is logical variable?
12.        What is global variable?
13.        What are the function arguments?
14.        Define Call by value with example.
15.        Define Union.
16.        What is the syntax of the union?
17.        What are the modes available for text files?
18.        Write the syntax of closing a file.
19.        Define *argv[1].
20.        List the C Directives.
    PART C
21.        Write about the Following
a)    History of C Language
b)    Uses and Features of C Language
c)    Why C Language and Facts of C Language
d)    How to Execute the C Programs
    (OR)
    Describe the C control statements each definition, syntax with examples
22.        What is Recursion? Write the example program for number Factorial.
    (OR)
    What is the use of recursion? Write the example program for number Fibonacci series
23.        Explain the following
a)    Unions
b)    Bit fields
    (OR)
    Explain the following
a)    Type definition
b)    Enumerations.
24.        Describe the working with binary files in details.
    (OR)
    Explain the following
a)    Opening a file
b)    File pointer
c)    Closing a file
d)    Flushing a file
25.        Brief the variable length argument list in details.
    (OR)
    Explain in details type qualifier with suitable example.

SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 35
Subject Code: IT101                        Max. Marks: 100
Subject Name: Advance C Programming             Duration: 3 Hours
    PART A
1.        Preprocessor Directives are used for -
    A.    Macro Expansion
B.    File Inclusion
C.    Conditional Compilation
D.    All of these
2.        Which operator has the lowest priority?
    A.    ++
B.    %
C.    + D.    ||
3.        The C language includes the header file standard input & output in
    A.    stdlib.h library
B.    stdio.h library
C.    conio.h library
D.    #include library
4.        The value that follows the keyword CASE may only be
    A.    constants
B.    variable
C.    number
D.    semicolon
5.        The statement which is used to terminate the control from the loop is
    A.    break
B.    continue
C.    goto
D.    exit
6.        Unsigned integer occupie
    A.    Two bytes
B.    Four bytes
C.    One byte
D.    Eight bytes
7.        Each C preprocessor directive begins with
    A.    #
B.    include
C.    main()D.    {
8.        main() {
long i = 30000;
printf(“%d”, i); }
the output is

    A.    3000
B.    30000
C.    0D.    -1
9.        The directive that can be used to test whether an expression evaluates to a nonzero value or not is
    A.    #if
B.    #elif
C.    #endif
D.    #exit
    Ans: A
10.        main() {
printf(“%p\n”, main());
}
    A.    Prints the address of main function.
B.    Prints 0.
C.    Is an error.
D.    Is an infinite loop.
    PART B
11.        What is the C program Structure?
12.        List out the C tokens.
13.        Define and syntax of realloc().
14.        Define and syntax of free().
15.        How to access the structure variable.
16.        Write the example of global declaration of structure.
17.        What is file pointer and give the example?
18.        Write the syntax of opening a file.
19.        What is the need of preprocessor?
20.        List out the header files in C.
    PART C
21.        Explain the Bitwise operator in detail with example.
    (OR)
    Describe about the Branching and Looping in detail.
   
22.        Explain about the following with suitable example.
Call by value
Call by reference
Describes the dynamic allocation functions in details.
    (OR)
    Describes the dynamic allocation functions in details.
23.        Write about the function pointer with suitable example and uses of function pointers.
    (OR)
    Describes the Structures within structures with suitable example.
24.        Explain about working with text files in details.
    (OR)
    Write about the following
a)    fputc()
b)    fputs()
c)    fgetc()
d)    fgets()
25.        Explain the following
a)    Code segment
b)    Data segment
c)    Stack segment
    (OR)
    Write about the Memory models and pointers with suitable examples.













SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 35
Subject Code: IT101                        Max. Marks: 100
Subject Name: Advance C Programming             Duration: 3 Hours
    PART A
1.        The type cast operator is-
    A.    (type)
B.    cast()
C.    //
D.    “ “
2.        File manipulation functions in C are available in which header file ?
    A.    streams.h
B.    stdio.h
C.    stdlib.h
D.    files.h
3.        Set of values of the same type, which have a single name followed by an index is called
    A.    function
B.    structure
C.    array
D.    union
4.        An array of pointers is same as
A.    pointer to array
B.    pointers to pointers
C.    pointer to function
D.    pointer to structure
5.        What is the output of the following program segment?
main()
{
long i = 65536;
printf(“%d\n”, i);
}
    A.    0
B.    65536
C.    -1D.    65
6.        ‘C’ is often called a
    E.    Object oriented language
F.    High level language
G.    Assembly language
H.    Machine level language
7.        The loop in which the statements within the loop are executed at least once is called
    E.    do-while
F.    while
G.    for
H.    goto
8.        The control automatically passes to the first statement after the loop in

    continue statement
break statement
switch statement
if statemen
9.        A self contained block of statements that perform a coherent task of some kind is called a
    A.    Monitor
B.    Function
C.    Program
D.    Structure
10.        Recursion is sometimes called
    A.    Circular definition
B.    Complex definition
C.    Procedure
D.    Union
    PART B
11.        How a programmer does find coding errors?
12.        Describe the appearance of machine code?
13.        Define and syntax of malloc().
14.        Define and syntax of calloc().
15.        What is the use of structure within structure?
16.        Why structure within structure?
17.        Write the file operations.
18.        How to processing a file?
19.        Difference between # and ##.
20.        Define type qualifier.
    PART C
21.        Write about the following
a)    What is an array and Declaration of array?
b)    Write the example of one dimensional array
c)    Write the example of two dimensional array
d)    Write the example of multi-dimensional array
   
    What is string and Explain about the String Functions in C Language
22.        What is multiple indirections and write about the various pointer usages?
    (OR)
    Write about the Pointers to functions with suitable examples.
23.        Describe the Passing Structure of functions with suitable example.
    (OR)
    Write the example program for the following
a)    Passing structure to function by value.
b)    Passing structure to function by reference
c)    Passing structure declare in global.
24.        Write the file operations.
    (OR)
    How to processing a file?
25.        Explain with suitable example for the following
a)    Near pointer
b)    Far pointer
c)    Huge pointer
    (OR)
    Explain the following with suitable example
a)    Stringize
b)    Token parsing











SNS COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 35
Subject Code: IT101                        Max. Marks: 100
Subject Name: Advance C Programming             Duration: 3 Hours
    PART A
1.        Which pair of functions below is used for single character I/O?
    A.    getchar() and putchar()
B.    scanf() and printf()
C.    input() and output()
D.    None of these
2.        Which function is used to read character as you type?
    E.    getchar()
F.    getch()
G.    getche()
H.    Both (B) and (C)
3.        What will be the output of the following program?
main()
{
int i = 5;
printf(“%d”, i=++i==6);
}
    A.    0
B.    1
C.    7D.    6
4.        Determine which of the following is a valid character constant
    A.    ‘\\’
B.    ‘\0’
C.    ‘xyz’
D.    ‘\052’
5.        The maximum value that an integer constant can have is
    A.    .32767
B.    32767
C.    1.7014e+38
D.    –1.7014e+38
6.        The expression X=4+2%-8 evaluates
    A.    –6
B.    6
C.    4
D.    None
7.        What will be the output of following program?
main()
{
int x=15;
printf(“\n%d%d%d”, x!=15, x=20, x<30);
}
    A.    0, 20, 1
B.    15, 20, 30
C.    0, 0, 0
D.    Error
8.        How many times the following program would print (“abc”)?
main()
{
printf(“\nabc”);
main();
}
    A.    Infinite number of times
B.    32767 times
C.    65535 times
D.    Till the stack does not overflow
9.        The following program fragment
int *a;
*a = 7;
    A.    assigns 7 to a
B.    results in compilation error
C.    assigns address of a as 7
D.    segmentation fault
10.        A pointer variable can be
    E.    passed to a function as argument.
F.    changed within function.
G.    returned by a function.
H.    assigned an integer value.
    PART B
11.        What is variable?
12.        What is constant?
13.        Short note on pointer to function.
14.        List out the dynamic memory allocation function.
15.        Define function pointer
16.        What is nested structure?
17.        List out the types of files.
18.        Why files are needed?
19.        Define *argv[n].
20.        What is huge pointer?
    PART C
21.        What are the C expressions and describe the operators with description associativity.
    (OR)
    Perform the following Programs
(i)    main( )
{
printf ( "nn \n\n nn\n" ) ;
printf ( "nn /n/n nn/n" ) ;
}
(ii)    main( )
{
int i = 4, j = -1, k = 0, w, x, y, z ;
w = i || j || k ;
x = i && j && k ;
y = i || j && k ;
z = i && j || k ;
printf ( "\nw = %d x = %d y = %d z = %d", w, x, y, z ) ;
}
(iii)    If the three sides of a triangle are entered through the keyboard, write a program to check whether the triangle is isosceles, equilateral, scalene or right angled triangle.
(iv)    main( )
{
int k, num = 30 ;
k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ;
printf ( "\n%d", num ) ;
}
22.        Define Pointers and describes the Pointers expression with neat examples.
    (OR)
    Difference between Pointers & Arrays. Describes the Array of Pointers.
23.        Define the structure. Write about the Array of structure with suitable example.
    (OR)
    Summary about the Array and Structure with suitable examples.
24.        Describe the file usage using C language.
    (OR)
    Discuss about the following
a)    SEEK_SET
b)    SEEK_CUR and
c)    SEEK_END.
25.        Write about the preprocessor in detail.
    (OR)
    Describe the # and ## preprocessor operator in detail with suitable examples.