image not found

Oops! That page can't be found.


Directions to Solve

Which of phrases given below each sentence should replace the phrase printed in bold type to make the grammatically correct? If the sentence is correct as it is, mark 'E' as the answer.

Q1: For some days the new professor lectured above the heads of his pupils.

A over the head of

B through the heds of

C over the heads of

D on the heads of

E No correction required

Q2:
Point out the error in the following program.
#include<stdio.h>
struct emp
{
    char name[20];
    int age;
};
int main()
{
    emp int xx;
    int a;
    printf('%d\n', &a);
    return 0;
}

A
Error: in printf

B
Error: in emp int xx;

C No error.

D None of these.

Q3: According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments?

A
int main()
{
    int argc; char *argv;
}

B None of above

C
int main(argc, argv)
int argc; char *argv;

D
int main(int argc, char *argv[])

Q4: What do the 'c' and 'v' in argv stands for?

A 'c' means argument configuration 'v' means argument visibility

B 'c' means argument control 'v' means argument vector

C 'c' means argument count 'v' means argument vector

D 'c' means argument count 'v' means argument vertex

Q5: What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three
/* myprog.c */
#include<stdio.h>

int main(int argc, char **argv)
{
    printf('%c\n', **++argv);
    return 0;
}

A o

B myprog one

C myprog one two three

D two

Q6: What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three
/* myprog.c */
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)
{
    printf('%s\n', *++argv);
    return 0;
}

A two

B three

C one

D myprog

Q7: What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?
cmd> sample 1 2 3
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    int j;
    j = argv[1] + argv[2] + argv[3];
    printf('%d', j);
    return 0;
}

A Error

B Garbage value

C sample 6

D 6

Q8:
What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])
{
    printf("%d %s", argc, argv[1]);
    return 0;
}

A 3 Morning

B 3 Good

C Good Morning

D 2 Good

Q9: What will be the output of the program
#include<stdio.h>
void fun(int);

int main(int argc)
{
    printf('%d ', argc);
    fun(argc);
    return 0;
}
void fun(int i)
{
    if(i!=4)
        main(++i);
}

A 2 3 4

B 1 2 3 4

C 1 2 3

D 1

Q10: What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample '*.c'
/* sample.c */
#include<stdio.h>

int main(int argc, int *argv)
{
    int i;
    for(i=1; i<argc; i++)
        printf('%s\n', argv[i]);
    return 0;
}

A "*.c"

B *.c

C sample *.c

D List of all files and folders in the current directory