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

Adv C MCQ

project 5

Uploaded by

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

Adv C MCQ

project 5

Uploaded by

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

(1) How many numbers of pointer (*) does C have against a pointer variable declaration?

a) 7 b) 127 c) 255 d) No limits


(2) scanf() is a predefined function in______header file.
a) stdlib. h b) ctype. h c) stdio. h d)stdarg. H
(3) What is the output of C program with multidimensional arrays.?
int main()
{
int ary[][3] = {6,5,4,3,2,1};
printf("%d %d", ary[0][0], ary[1][0]);
return 0;
}
a) 6 2
b) 6 3
c) 6 1
d) Compiler error
(4) Which loop is faster in C language, foe, while or do while?
a) For
b) While
c) Do while
d) All work at same speed
(5) What is the dimension of the C array int arr [10][5].?
a) 1
b) 2
c) 5
d) 10
(6) char ch[ ]={‘a’,’b’,’c’,’\0’};
int sum=ch[1]+ch[2];
What is the value of sum?
a) 195 b) 197 c) ab d) error

(7) How to refer an element in ith row jth column of a two dimensional array
b) x[i,j] b) x[i][j] c) x[ij] d) x[i]x[j]

(8) Pointer variable is declared using preceding with ______ sign

a) % b) & c) ^ d) *

(9) If the size of integer is 4 bytes, what will be the output of the program?
int main()
{
int arr[]={12,13,14,15,16};
printf(“%d, %d, %d\n”,sizeof(arr),sizeof(*arr),sizeof(arr[0]));
return 0;
}
a) 10, 2, 4 b) 20, 4, 4 c) 16, 2, 2 d) 20, 2, 2
(10) int a[10] will reserve how many locations in the memory?
a) 10 b) 9 c) 11 d) None of the above

(11)Comment on the following C statement.


int (*a)[7];

a) An array “a” of pointers


b) A pointer “a” to an array
c) A ragged array
d) None of the mentioned

(12)What are the applications of a multidimensional array?


a) Matrix-Multiplication
b) Minimum Spanning Tree
c) Finding connectivity between nodes
d) All of the mentioned

(13)Which of the following is the correct syntax to declare a 3 dimensional array using
pointers?
a) char *a[][];
b) char **a[];
c) char ***a;
d) all of the mentioned

(14)Which of the following declaration are illegal?


a) int a[][] = {{1, 2, 3}, {2, 3, 4, 5}};
b) int *a[] = {{1, 2, 3}, {2, 3, 4, 5}};
c) int a[4][4] = {{1, 2, 3}, {2, 3, 4, 5}};
d) none of the mentioned
(15) Which is true for a, if a is defined as “int a[10][20];”?
a) a is true two-dimensional array
b) 200 int-sized locations have been set aside
c) The conventional rectangular subscript calculation 20 * row + col is used to find
the element a[row, col].
d) All of the mentioned
(16) A function can be called in a program
a) Only two times b) Only once c) Any number of times d) Only three times
17) The statement used to send back any value to the calling function is
a) break b) continue c) exit d) return

18) Character constants are enclosed in Actual and formal parameters must agree in
a) Data types b) Number of arguments and Data types c)Names and Data type d)
None

19) _________ function is said to be function calling itself.


a) Call by reference b) Call by value c) Recursive d) All above

20) Call by reference is also known as


a) Call by address or Call by location b) Call by address or Call by value
c) Call by value or call by name d) None
(21)A pointer is
a) A variable that stores address of an instruction
b) A variable that stores address of other variable
c) A keyword used to create variables
d) None of these
(22)How can you write a[i][j][k][l] in equivalent pointer expression?
a) (((***(a+i)+j)+k)+l)
b) ((**(*(a+i)+j)+k)+l)
c) (*(*(*(a+i)+j)+k)+l)
d) *(*(*(*(a+i)+j)+k)+l)
(23) What is the default return type if it is not specified in function definition?
a) void
b) int
c) float
d) short int
(24) An array Index starts with.?
a) -1
b) 0
c) 1
d) 2
(25) An entire array is always passed by ___ to a called function.
a) Call by value
b) Call by reference
c) Address relocation
d) Address restructure
(26)Character constants are enclosed in

a)‘ ‘ b) “ “ c) ( ) d) [ ]

(27)The assignment statement “sum=sum+i;” is equivalent to

a)sum=+i; b) sum+=i; c) sum= =sum+i; d) None

(28)Which one of the following is known as the “language of computer”?

a) Programming language b) High-level language


c) Machine language d) Assembly language
(29)The size of “long double” data type in 16-bit machine is _____

a) 8 bytes b) 10 bytes c) 2 bytes d) 4bytes

(30)The range of “char” data type is ____

a)-128 to 127 b) 0 to 255 c) -32768 to 32767 d) None

(31)The address operator &, cannot act on


a) R-values
b) Arithmetic expressions
c) Both of the above
d) Local variables
(32)What will be the output?
main()
{
char *p;
p = "Hello";
printf("%cn",*&*p);
}
a) Hello b) H c) 0 d) None of these
(33)Which is an indirection operator among the following?
a) & b) * c) -> d) .
(34)Pointer variable is declared using preceding with ______ sign
a) % b) & c) ^ d) *
(35)char ch[ ]={‘a’,’b’,’c’,’\0’};
int sum=ch[1]+ch[2];
What is the value of sum?
a) 195 b) 197 c) ab d) error

(36)Array is an example of which of the following?

a)Derived types b) fundamental types c) user-defined types d) None

(37)Array elements are stored in

a)Scattered memory locations b) Sequential memory locations


c) Direct memory locations d) None

(38) int k[3]={1,2,3};int *p; one of the following statement is equal to p=k is

a)p=&k[0] b) p=&k[1] c) p=&k[2] d) None

(39)The size of “long double” data type in 16-bit machine is _____

(a)8 bytes b) 10 bytes c) 2 bytes d) 4bytes

(40)The range of “char” data type is ____

(a)-128 to 127 b) 0 to 255 c) -32768 to 32767 d) None

(41)Which one of the following statement is not true?


a) vim editor is the improved version of vi editor
b) vi editor commands are not case sensitive
c) vi editor has two modes of operation: command mode and insert mode
d) vi stands for visual editor
(42)In vi editor, the key combination CTRL+F
a) moves screen down one page
b) moves screen up one page
c) moves screen up one line
d) moves screen down one line
(43)Which vi editor command copies the current line of the file?
a) yy
b) yw
c) yc
d) none of the mentioned
(44)Which one of the following statement is true?
a) auto indentation is not possible in vi editor
b) auto indentation can be set using the command ‘:set ai’
c) auto indentation can be set using the command ‘:set noai’
d) auto indentation is set by default in vi editor
(45)In vi editor, which command reads the content of another file?
a) read
b) r
c) ex
d) none of the mentioned
(46)Which command is used to close the vi editor?
a) q
b) wq
c) both q and wq
d) none of the mentioned
(47) Which vi editor command copies the current line of the file?
a) yy
b) yw
c) yc
d) none of the mentioned
(48) PWD stands for ______________.
a) present working directory b) past working directory c) present working diary
d) past working diary

(49)Unix Operating System is an __________.


a) Time Sharing Operating System b) Multi-User Operating System c)Multi-tasking
Operating System d)All the Above
(50) How do you rename file "new" in file "old"?
a) mv new old b)cp new old c)rm new old d)rn new old

You might also like