Computer Science

Computer Science MCQ-5

FontSize

Q.61 C language was invented by
(A) Abacus (B) Charles babage
(C) Thomson (D) Dennis Ritchie
Ans:D

Q.62 The given FOR loop is
for ( ; ; )
{
printf(“ ”);
}

(A) valid (B) indefinite
(C) invalid (D) displays runtime errors
Ans:D

The given for loop displays runtime errors because no test condition is given. Test condition is
must inside for loop.


Q.63 The following code displays
main( )
{
int *p;
p = (int*) malloc(sizeof(int));
*p = 10;
printf(“p = %d\n”, *p);
}

(A) 10 (B) 1542 (address of p)
(C) 20 (D) None of the above
Ans:A

Q.64 The _______ operator is a technique to forcefully convert one data type to the others
(A) Cast (B) Conversion
(C) Type (D) Uniary
Ans:A

Q.65 The output of the following will be
for (x=1, y=5; x+y<=10; x++)
{
printf(“%d%d”, x,y);
y++;
}

(A) 1 5 (B) 1 5
2 6 2 6
3 7 3 7
4 8
(C) 1 5 (D) 1 5
1 6 2 5
1 7 3 5
1 8 4 5
1 9 5 5
Ans:A

Q.66 The __________ statement causes immediate exit from the loop overriding the condition test
(A) Exit (B) Break
(C) Goto (D) None of the above
Ans:B

Q.67 The output of the following code is
a = 5;
a << 1;
printf(“%d”, a);

(A) 5 (B) 6
(C) 2 (D) 3
Ans:A

Q.68 The purpose for mode “w+b” in file operation is
(A) create a binary file for write
(B) create a binary file for read/write
(C) open a binary file for writing
(D) open a binary file for reading/writing
Ans:B

Q.69 The operators << and >> are
(A) assignment operator (B) relational operator
(C) logical operator (D) bitwise shift operator
Ans D

Q.70 Which of the following numerical value is invalid constant
(A) .75 (B) 9.3e2
(C) 27,512 (D) 123456
Ans C

Q.71 A C program contains the following declaration int i=8, j=5 what would be the value of
following expression?

abs(i-2*j)
(A) 2 (B) 4
(C) 6 (D) 8
Ans A

Q.72 What will be the output of the following program
main( )
{
int k, num=30;
k=(num>5 ? (num<= 10 ? 100:200):500);
printf(“\n%d”, num);
}

(A) 100 (B) 5
(C) 30 (D) 500
Ans C

Q.73 What is the output of the following code
int n = 0, m=1;
do
{
printf(“%d”, m);
m++;
}
while(m<=n);

(A) 0 (B) 2
(C) 1 (D) 4
Ans C

Q.74 If a=8 and b=15 then the statement
x= (a>b) ? a:b;

(A) assigns a value 8 to x (B) gives an error message
(C) assigns a value 15 to x (D) assigns a value 7 to x
Ans C

Q.75 What is the output of the following code
int n=0, m;
for (m=1; m<=n+1; m++)
printf(“%d”, m);

(A) 2 (B) 1
(C) 0 (D) 6
Ans B


Please Donate






RSS Feeds

SiteTranslation



Copyright © 2024 ashkerala.com. All Rights Reserved.
Google+ Click to listen highlighted text! Powered By GSpeech