0% found this document useful (0 votes)
77 views

MCQ Set1

The document contains 20 multiple choice questions about C programming concepts such as loops, arrays, pointers, structures, unions and SQL. The questions cover topics like trace the output of code snippets, valid C declarations, SQL query clauses and more.

Uploaded by

Thor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

MCQ Set1

The document contains 20 multiple choice questions about C programming concepts such as loops, arrays, pointers, structures, unions and SQL. The questions cover topics like trace the output of code snippets, valid C declarations, SQL query clauses and more.

Uploaded by

Thor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Technical Questions :MCQSet1

1) Trace the output.


void main()
{
int i=2,j=2;
while(i+1?--i:j++)
printf("%d",i);
}
a. 1
b. 2
c. ERROR
d. None of the above.

2)Suppose that x is a one dimensional array, then choose the correct answer regarding array.
a. *(x + n) is same as &x[n]
b. *&x[n] is same as x + n
c. *(x + n) is same as x[n] +1
d. *(x + n) is same as *x[n]

3) See the following C declaration


struct v
{
int n;
float a;
}
struct v * x[10];
Define x as :-
a. An array which has the same name as a program name
b. A structure with 10 elments in it
c. An array, where each element is a pointer to a structure of type node
d. A structure of 3 fields and an array of 10 elements

4)Trace the output.


void main()
{
int x=-5,y,num=5;
y=x%-4;
y=(y?0:num*num);
printf("%d",y);
}
a. 0
b. 25
c. -25
d. None of the above.

5) Find the output


#include< stdio.h>
void i(int *a,int *b)
{
a=b;
*a=2; }
int x=0,y=1;
int main()
{
i(&x,&y);
printf(“%d%d\n”,x,y);
return 0;
}
a. 22
b. 21
c. 02
d. 01

6)C programming: The compiler will give an error if we attempt to get the address of a variable with
_________ storage class.
a. register keyword
b. extern keyword
c. static keyword
d. auto keyword

7)What would be the equivalent pointer expression for referring the array?
arr[p][q][r][m]
a. * (*(*(*(arr+p)+q)+r)+m)
b. arr[0];
c. *((((arr+p)+q)+r)+m)
d. None of the above.

8)Which of the following does not represent a valid storage class in c?


a. static
b. union
c. extern
d. automatic
9)Trace the output
while(“%d” , printf(“abc”))
{
printf(“de”);
}
a. abcdeabcdeabcde……………
b. abdededede…………………
c. Compile error.
d. None of the above.

10)Trace the output:-


int main()
{
char c[]="CAREERRIDE";
char *p=c;
printf ("%s",p+p[3]-p[1]);
return 0;

}
a. CAREERRIDE
b. ERRIDE
c. REERRIDE
d. None of the above.

11) What is the output of the following code snippet?


#include<stdio.h>

main()
{
char c = 'A'+255;

printf("%c", c);
}
a. A
b. B
c. Overflow error at runtime
d. Compiler Error
12) What is the output of the following program?
#include<stdio.h>

main()
{
char *p = NULL;

printf("%c", *p);
}
a. NULL
b. 0
c. Compile error
d. Runtime error.

13)Which among the below specified condition is applicable if the Queue is non - empty?
a. rear > front
b. rear < front
c. rear = front
d. Unpredictable

14)What is the output of the following program?


a) C++ C++
b) C++ ++
c)- ++ ++
d) Compile error

15)Similarity between a structure, union and enumeration,


a) All are helpful in defining new variables
b) All are helpful in defining new data types
c) All are helpful in defining new pointers
d) All are helpful in defining new structures

16) Which statement can print \n on the screen?


a) printf("\\n");
b) printf("n\");
c) printf("n");
d) printf('\n');
17)A transaction state changes from active to______, after the transaction has been rolled back and the
database restored to its state prior to the start of the transaction.
a. Partially committed
b. Committed
c. Aborted
d. Failed

18)From the following statements which of them is/are true about SQL
1. All attributes used in the group by clause must appear in the select clause
2. An SQL query can contain a having clause only if it has a group by clause
3. An SQL query can contain a having clause even if it does not have a group by clause
4. Not all attributes used in the group by clause need to appear in the select clause
a. 3 and 4
b. 1 and 2
c. 1,3 and 4
d. All of the above

19) What will this program print?


1. main()  
2. {  
3.   int i = 2;  
4.   {  
5.     int i = 4, j = 5;  
6.      printf("%d %d", i, j);  
7.   }    
8.   printf("%d %d", i, j);  
9. }  
a. 4525
b. 2525
c. 4545
d. None of the these

20) What is the output of this statement "printf("%d", (a++))"?


a) The value of (a + 1)
b) The current value of a
c) Error message
d) Garbage

You might also like