Guest | Sign in | Register

Sign in to LucentBlackBoard

E-mail Id
Password
Loading...

New Member to LucentBlackBoard?

Forgot Your Password?

Enter your registered e-mail address, your password will be sent to e-mail address.
Enter E-mail Id
Loading...

Time left :





Note:

1. Total number of questions : 15.

2. Time alloted : 20 minutes.

3. Each question carry 1 mark, no negative marks.

4. Click the 'Submit Test' button given in the bottom of this page to Submit your answers.

5. Test will be submitted automatically if the time expired.

6. Don't refresh the page.

Result and Statistics

Time Left :

Result and Statistics ( Test No : online_test_number )

A. Number Of Question

15

B. Number Of Attempted

-

C. Number Of Correct Answer

-

D. Number Of Wrong Answer ( D = B-C )

-

E. Total Score ( E = C )

-

F. Accuracy Rate ( F = C / B * 100 )

-

G. Total Percentage ( G = C / A * 100 )

-



1.

The statement which sums all values between 10 and 100 into a variable called total is, assuming that total has NOT been initialised to zero.

A.    Statement 1
for( a = 10; a <= 100; a = a + 1)
total = total + a;
Wrong Right

B.    Statement 2
for( a = 10; a < 100; a = a + 1, total = 0)
total = total + a;
Wrong Right

C.    Statement 3
for( a = 10; a <= 100, total = 0; a = a + 1)
total = total + a;
Wrong Right

D.    Statement 4
for( a = 10, total = 0; a <= 100; a = a + 1)
total = total + a;
Wrong Right

Answer : Statement 4
for( a = 10, total = 0; a <= 100; a = a + 1)
total = total + a;

Explanation : There is no explanation...

Learn more problems on : Loops

Discuss on this question

2.

Assign the text string "Welcome" to the character based array stuff (not at declaration time)

A.    strcpy( stuff, 'Welcome' ); Wrong Right

B.    stuff = "Welcome"; Wrong Right

C.    stuff[0] = "Welcome"; Wrong Right

D.    strcpy( stuff, "Welcome" ); Wrong Right

Answer : strcpy( stuff, "Welcome" );

Explanation : There is no explanation...

Learn more problems on : Arrays

Discuss on this question

3.

Which variable stores the number of arguments to a program?

A.    argc Wrong Right

B.    argv Wrong Right

C.    count Wrong Right

D.    arglen Wrong Right

Answer : argc

Explanation : There is no explanation...

Learn more problems on : Command Line Arguments

Discuss on this question

4.

What is the output of following program?
void main(){
int a;
a=100;
printf("%d%d",++a,a++);
}   

A.    101 101 Wrong Right

B.    101 102 Wrong Right

C.    102 100 Wrong Right

D.    102 101 Wrong Right

Answer : 102 100

Explanation : There is no explanation...

Learn more problems on : Typecasting

Discuss on this question

5.

Which of the following is a properly defined struct?

A.    struct {int a;} Wrong Right

B.    struct a_struct {int a;} Wrong Right

C.    struct a_struct int a; Wrong Right

D.    struct a_struct {int a;}; Wrong Right

Answer : struct a_struct {int a;};

Explanation : There is no explanation...

Learn more problems on : Structures

Discuss on this question

6.

The statement to read a float value into the variable discount_rate is

A.    scanf("%f", discount_rate); Wrong Right

B.    scanf("%d", &discount_rate); Wrong Right

C.    scanf(discount_rate); Wrong Right

D.    scanf("%f", &discount_rate); Wrong Right

Answer : scanf("%f", &discount_rate);

Explanation : There is no explanation...

Learn more problems on : printf() and scanf()

Discuss on this question

7.

Which one is not logical operator?

A.    & Wrong Right

B.    && Wrong Right

C.    || Wrong Right

D.    ! Wrong Right

Answer : &

Explanation : There is no explanation...

Learn more problems on : C Basics

Discuss on this question

8.

A structure pointer times of type time (which has three fields, all pointers to integers, day, month and year respectively) is declared. Using the pointer times, update the field day to 10.

A.    times.day = 10; Wrong Right

B.    *(times->day) = 10; Wrong Right

C.    *times.day = 10; Wrong Right

D.    times.day = *10; Wrong Right

Answer : *(times->day) = 10;

Explanation : There is no explanation...

Learn more problems on : Pointers & Structures

Discuss on this question

9.

In which header file is the NULL macro defined?

A.    stdio.h Wrong Right

B.    stddef.h Wrong Right

C.    stdio.h and stddef.h Wrong Right

D.    Math.h Wrong Right

Answer : stdio.h and stddef.h

Explanation : There is no explanation...

Learn more problems on : Preprocessor Directives

Discuss on this question

10.

What will be output of the following c program?
#include "stdio.h"
int main()
{
int _ = 5;
int __ = 10;
int ___;
___ = _ + __;
printf("%i", ___);
return 0;
}

A.    5 Wrong Right

B.    10 Wrong Right

C.    15 Wrong Right

D.    Compilation Error Wrong Right

Answer : 15

Explanation : Variable name can have only underscore

Learn more problems on : Defining Variables

Discuss on this question

11.

Rewrite the following statements using a switch statement


if( letter == 'X' )
sum = 0;
else if ( letter == 'Z' )
valid_flag = 1;
else if( letter == 'A' )
sum = 1;
else
printf("Unknown letter -->%c\n", letter );

}
"/> A.    Statement 1
switch( letter ) {
case 'X' : sum = 0; break;
case 'Z' : valid_flag = 1; break;
case 'A' : sum = 1; break;
default : printf( "Unknown letter -->%c\n", letter ); break;
}
Wrong Right

}
"/> B.    Statement 2
switch( letter ) {
case 'X' : sum = 0;
case 'Z' : valid_flag = 1;
case 'A' : sum = 1;
default : printf( "Unknown letter -->%c\n", letter );
}
Wrong Right

case "Z" : valid_flag = 1; break;
case "A" : sum = 1; break;
default : printf( "Unknown letter -->%c\n", letter ); break;
}
"/> C.    Statement 3
switch( letter ) {
case "X" : sum = 0; break;
case "Z" : valid_flag = 1; break;
case "A" : sum = 1; break;
default : printf( "Unknown letter -->%c\n", letter ); break;
}
Wrong Right

D.    None of these Wrong Right

Answer : Statement 1
switch( letter ) {
case 'X' : sum = 0; break;
case 'Z' : valid_flag = 1; break;
case 'A' : sum = 1; break;
default : printf( "Unknown letter -->%c\n", letter ); break;
}

Explanation : There is no explanation...

Learn more problems on : Switch-case

Discuss on this question

12.

What will the output of following C code?
main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
}

A.    0 Wrong Right

B.    2 Wrong Right

C.    1 Wrong Right

D.    65000 Wrong Right

Answer : 1

Explanation : Note the semicolon after the while statement. When the value of i becomes 0 it comes out of while loop. Due to post-increment on i the value of i while printing is 1.

Learn more problems on : Operators

Discuss on this question

13.

islower() method is used for?

A.    check for lowercase character or not Wrong Right

B.    conversion for lowercase to uppercase Wrong Right

C.    convert to lowercase to uppercase Wrong Right

D.    None Wrong Right

Answer : check for lowercase character or not

Explanation : There is no explanation...

Learn more problems on : Inbuilt Functions

Discuss on this question

14.

What is the output of the following code?
int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y = %d\n",x,y);
}

A.    x = 10 y = 10 Wrong Right

B.    x = 20 y = 20 Wrong Right

C.    x = 02 y = 01 Wrong Right

D.    x = 20 y = 10 Wrong Right

Answer : x = 20 y = 10

Explanation : This is one way of swapping two values. Simple checking will help understand this.

Learn more problems on : Functions

Discuss on this question

15.

Predict the output or error(s) for the following?


main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
}

A.    8 Wrong Right

B.    0 Wrong Right

C.    9 Wrong Right

D.    10 Wrong Right

Answer : 10

Explanation : The variable i is a block level variable and the visibility is inside that block only. But the lifetime of i is lifetime of the function so it lives upto the exit of main function. Since the i is still allocated space, *j prints the value stored in i since j points i.

Learn more problems on : Pointers

Discuss on this question

Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.