Scholarship Test For 3 Month Online Project Development Program (Sep'10-nov'10)

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Collegeprojectin
C
Collegeprojectin
Community Contributor
Quizzes Created: 1 | Total Attempts: 2,572
Questions: 16 | Attempts: 2,599

SettingsSettingsSettings
Scholarship Test For 3 Month Online Project Development Program (Sep10-nov10) - Quiz


www. Collegeproject. In has launched scholarships (Rs. 4000) for meritorious students for our 3-Month Online Project development Program (Sep2010-Nov-2010).

Pass mark is 60%. The students who have passed in the test will be mailed the coupon code within 24 hours.
The students will have to enter the same coupon code at the time of payment and he will get a scholarship discount of Rs4000/ only.
Student must enter the same email id which has been used registration with www. Collegeproject. In.
Student must enter their mobile no as their unique id no.
For any query write to Read moreus at project@collegeproject. In or call 9311481855.
All the best.


Questions and Answers
  • 1. 

    # include int one_d[]={1,2,3};main(){int *ptr;ptr=one_d;ptr+=3;printf("%d",*ptr);

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      Garbage Value

    • E.

      Compilation error

    Correct Answer
    E. Compilation error
    Explanation
    The given code will result in a compilation error. This is because the code is missing the required header file, which is "stdio.h" for the printf() function.

    Rate this question:

  • 2. 

    Main(){char s[ ]="man";int i;for(i=0;s[ i ];i++)printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);}What will be the second output of printf?

    • A.

      Nnnn

    • B.

      Aaaa

    • C.

      Mmmm

    • D.

      30

    Correct Answer
    B. Aaaa
    Explanation
    s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array
    name is the base address for that array. Here s is the base address. i is the index number/displacement from
    the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is
    same as s[i].

    Rate this question:

  • 3. 

    Main(){int a[10];printf("%d",*a+1-*a+3);

    • A.

      3

    • B.

      Some address will be printed.

    • C.

      0

    • D.

      4

    Correct Answer
    D. 4
    Explanation
    The given code declares an integer array 'a' of size 10. In the printf statement, the expression *a+1-*a+3 is evaluated. Since 'a' is an array, *a refers to the value at the first index of the array, which is the same as a[0]. So, *a+1 is equivalent to a[0]+1. Similarly, *a+3 is equivalent to a[0]+3. Therefore, the expression simplifies to a[0]+1-a[0]+3, which further simplifies to 1+3, resulting in the value 4 being printed.

    Rate this question:

  • 4. 

    Main(){float me = 1.1;double you = 1.1;if(me==you)printf("I love U");elseprintf("I hate U");}

    • A.

      I love U

    • B.

      I hate U

    • C.

      I

    • D.

      U

    • E.

      None of these.

    Correct Answer
    B. I hate U
    Explanation
    Explanation:
    For floating point numbers (float, double, long double) the values cannot be predicted
    exactly. Depending on the number of bytes, the precession with of the value represented varies. Float
    takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.
    Rule of Thumb:
    Never compare or at-least be cautious when using floating point numbers with relational
    operators (== , >,

    Rate this question:

  • 5. 

    Main(){int i=3;switch(i){default:printf("zero");case 1: printf("one");break;case 2:printf("two");break;case 3: printf("three");break;}} 

    • A.

      One

    • B.

      Two

    • C.

      Three

    • D.

      Compilation error.

    Correct Answer
    C. Three
    Explanation
    * is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again & references it to an address and * dereferences it to the value H.

    Rate this question:

  • 6. 

    Main(){int i=10;i=!i>14;Printf ("i=%d",i);} 

    • A.

      1

    • B.

      2

    • C.

      0

    • D.

      None of these

    Correct Answer
    C. 0
    Explanation
    In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol. ! is a
    unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

    Rate this question:

  • 7. 

    Main(){printf("\nab");printf("\bsi");printf("\rha");}

    • A.

      Nbr

    • B.

      Hsa

    • C.

      Aib

    • D.

      Hai

    Correct Answer
    D. Hai
    Explanation
    \n - newline
    \b - backspace
    \r - linefeed

    Rate this question:

  • 8. 

    #include #define a 10main(){#define a 50printf("%d",a);} 

    • A.

      10

    • B.

      Runtime error

    • C.

      Compilation error.

    • D.

      50

    • E.

      None of these

    Correct Answer
    D. 50
    Explanation
    Runtime error-Stack overflow.main function calls itself again and again. Each time the function is called its return address is stored in the call stack. Since there is no condition to terminate the function call, the call stack overflows at runtime. So it terminates the program and results in an error.

    Rate this question:

  • 9. 

    #includemain(){int i=1,j=2;switch(i){case 1: printf("GOOD");break;case j: printf("BAD");break;}}

    • A.

      GOOD

    • B.

      BAD

    • C.

      Compilation error.

    • D.

      None of these.

    Correct Answer
    C. Compilation error.
    Explanation
    Explanation:
    The case statement can have only constant expressions (this implies that we cannot use
    variable names directly so an error).
    Note:
    Enumerated types can be used in case statements.

    Rate this question:

  • 10. 

    Main(){int i=0;for(;i++;printf("%d",i)) ;printf("%d",i);}

    • A.

      0

    • B.

      1

    • C.

      2

    • D.

      None of these.

    Correct Answer
    B. 1
    Explanation
    The code snippet is a C program that starts with initializing an integer variable i to 0. It then enters a for loop with an empty initialization statement, a condition of i++, and an empty increment statement. This means that i will be incremented after each iteration of the loop. Inside the loop, the printf function is used to print the value of i. However, since the condition i++ is always evaluated as true, the loop becomes an infinite loop. Therefore, the program will continuously print the incremented value of i, starting from 1. Hence, the correct answer is 1.

    Rate this question:

  • 11. 

    Main(){char not;not=!2;printf("%d",not);}

    • A.

      1

    • B.

      2

    • C.

      0

    • D.

      Compilation error

    Correct Answer
    C. 0
    Explanation
    The code snippet initializes a variable 'not' as a character. The expression '!2' evaluates to 0, as the logical NOT operator (!) negates the truth value of the operand. The 'printf' function then prints the value of 'not', which is 0. Therefore, the correct answer is 0.

    Rate this question:

  • 12. 

    #define FALSE -1#define TRUE 1#define NULL 0main() {if(NULL)puts("NULL");else if(FALSE)puts("TRUE");elseputs("FALSE");} 

    • A.

      NULL

    • B.

      TRUE

    • C.

      Compilation error

    • D.

      FALSE

    Correct Answer
    B. TRUE
    Explanation
    The code snippet defines FALSE as -1, TRUE as 1, and NULL as 0. In the main function, the if statement checks if NULL is true. Since NULL is defined as 0, which is considered false, the if statement evaluates to false. The else if statement then checks if FALSE is true. Since FALSE is defined as -1, which is considered true, the else if statement evaluates to true. Therefore, the code will print "TRUE" as the output.

    Rate this question:

  • 13. 

    Void main(){ int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n");}

    • A.

      Forget it

    • B.

      Ok here

    • C.

      None of these

    • D.

      Not sure

    Correct Answer
    B. Ok here
    Explanation
    Printf will return how many characters does it print. Hence printing a null character returns 1 which makes the if statement true, thus "Ok here" is printed.

    Rate this question:

  • 14. 

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

    • A.

      10

    • B.

      Some address

    • C.

      Compilation error.

    • D.

      None of these

    Correct Answer
    A. 10
    Explanation
    Due to the assignment p[1] = 'c' the string becomes, "%c\n". Since this string becomes the format string for printf and ASCII value of 65 is 'A', the same gets printed.

    Rate this question:

  • 15. 

    # include aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2]();

    • A.

      Bye

    • B.

      Aaa

    • C.

      Bbb

    • D.

      Ccc

    Correct Answer
    A. Bye
    Explanation
    The given code snippet defines three functions: aaa, bbb, and ccc. These functions each print a different greeting message. In the main function, an array of function pointers called ptr is declared. The elements of this array are then assigned the addresses of the aaa, bbb, and ccc functions. Finally, the function pointed to by ptr[2] is called, which is ccc. Therefore, the output of the program would be "bye".

    Rate this question:

  • 16. 

    Register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a);}

    • A.

      Compilation error

    • B.

      Runtime error

    • C.

      Stack overflow

    • D.

      None of these

    Correct Answer
    A. Compilation error
    Explanation
    Compier Error: '&' on register variable
    Rule to Remember:
    & (address of ) operator cannot be applied on register variables.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Dec 27, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 18, 2010
    Quiz Created by
    Collegeprojectin
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.