Home > General Knowledge > Computer Science
Q 1.

Study the following program fragment  :

char c=’a’;

while(c++<=’z’)

putchar(xxx);

If the required output is :

abcdefghijklmnopqrstuvwxyz

then xxx should be:

A)  c
B)  c++
C)  c-1
D)  -c
Q 2.

In the following program fragment, s, b are two integers

b = s + b;

s = b – s;

b = b – s;

What does it intend to do ?

 

A)  Transfer the contents of s to b
B)  Transfer the contents of b to s
C)  Exchange (swap) the contents of s and b
D)  Negate the contents of s and b
Answer & Explanation Answer: Exchange (swap) the contents of s and b

Explanation:

View Answer   Discuss

MCQ Type: C, Computer Science, Computer Science, Computer Science, UGC NET

Q 3.

The C language is a :

A)  High level language
B)  Low level language
C)  High level language with some low low level features
D)  Low level language with some high level features
Answer & Explanation Answer: High level language with some low low level features

Explanation:

View Answer   Discuss

MCQ Type: C, Computer Science, Computer Science, Computer Science, UGC NET

Q 4.

The primary reason for developing C language was to treat it as a:

A)  Systems Programming Language
B)  General Purpose Language
C)  Data Processing Language
D)  None of the above
Q 5.

From the following statements, choose the correct one:

A)  Use of goto makes the debugging task easier
B)  Use goto when you want to jump out of a nested loop
C)  Use of goto enhances the logical clarity of a code
D)  Never use goto
Answer & Explanation Answer: Use goto when you want to jump out of a nested loop

Explanation:

View Answer   Discuss

MCQ Type: C, Computer Science, Computer Science, Computer Science, UGC NET

Q 6.

Study the following statements:

for(i=3; i<15; i+=3)

{ printf(“%d”, i);

++i;

}

What will be the output ?

A)  3 6 9 12
B)  3 6 9 12 15
C)  3 7 11
D)  3 7 11 15
Q 7.

The following program fragment:

int a= 4, b= 6;

printf(“%d”,a=b);

 

A)  Outputs an error message
B)  Prints 0
C)  Prints 1
D)  None of the above
Q 8.

The following program fragment

int a=4, b=6;

printf(“%d”,a!=b);

 

A)  Outputs an error message
B)  Prints 0
C)  Prints 1
D)  None of the above
Q 9.

Study the following statement:

printf(“%f”,(float)9/5);

What will it print ?

A)  1.0
B)  1.8
C)  2.0
D)  None of these
Q 10.

Study the following statement:

printf(“%f”,9/5);

What will it print ?

A)  1.0
B)  1.8
C)  2.0
D)  None of these