Wednesday, 17 December 2014

Programming Quiz-34

Q1) global variable conflicts due to multiple file occurrence is resolved during

a. compile-time
b. run-time
c. link-time
d. load-time

Answer: C


Q2) What will be the value of a & b after the execution of below program?
int a=5,b=6
swap(&a,b);
This function is written to swap a and b
find value of a and b.
a. 5,6
b. 6,5
c. 5,5
d. 6,6

Answer: D


Q3) What will be the output of the program below
#include
main(){
    int num[] = {1,4,8,12,16};
    int *p,*q;
    int i;
    p =  num;
    q = num+2;
    i = *p++;
    printf("%d, %d, %d\n",i, *p, *q);
}

a) 4, 4, 8
b) 1, 4, 8  
c) 2, 1, 8  
d) 2, 4, 8

Answer: B


Q4) What will be the output of the program below
#include

main(){
char *a[4]={"jaya","mahesh","chandra","swapant"};
int i = sizeof(a)/sizeof(char *);
printf("i = %d\n", i);
}
 
a)
b) 7  
c) 8  
d) 1
 
Answer: A
 
 
Q5)
#include
 #define scanf "%s is a string"
main()
{
 printf(scanf,scanf);
 

a) compilation error
b) runtime error  
c) %s is a string %s is a string  
d) %s is a string is a string  
e) None of the above

Answer: D
 


No comments:

Post a Comment