<<= Back Next =>>
You Are On Multi Choice Question Bank SET 478

23901. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> fun(...); int main() { fun(3, 7, -11.2, 0.66); return 0; } fun(...) { va_list ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }





23902. Point out the error if any in the following program (Turbo C). #include<stdio.h> #include<stdarg.h> void display(int num, ...); int main() { display(4, 'A', 'a', 'b', 'c'); return 0; } void display(int num, ...) { char c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, char); printf("%c", c); } }





23903. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11, 0); return 0; } void varfun(int n, ...) { va_list ptr; int num; num = va_arg(ptr, int); printf("%d", num); }





23904. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(char s, int num1, int num2, ...); display("Hello", 4, 2, 12.5, 13.5, 14.5, 44.0); return 0; } void display(char s, int num1, int num2, ...) { double c; char s; va_list ptr; va_start(ptr, s); c = va_arg(ptr, double); printf("%f", c); }





23905. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(int num, ...); display(4, 12.5, 13.5, 14.5, 44.3); return 0; } void display(int num, ...) { float c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, float); printf("%f", c); } }





23906. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void display(char s, ...); void show(char t, ...); int main() { display("Hello", 4, 12, 13, 14, 44); return 0; } void display(char s, ...) { show(s, ...); } void show(char t, ...) { int a; va_list ptr; va_start(ptr, s); a = va_arg(ptr, int); printf("%f", a); }





23907. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11.2, 0.66); return 0; } void varfun(int n, ...) { float ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }





23908. The macro va_arg is used to extract an argument from the variable argument list and advance the pointer to the next argument.



23909. In a function that receives variable number of arguments the fixed arguments passed to the function can be at the end of argument list.



23910. A function that receives variable number of arguments should use va_arg() to extract arguments from the variable argument list.



23911. For a function receives variable number of arguments it is necessary that the function should receive at least one fixed argument.



23912. A function that receives variable number of arguments should use va_arg() to extract the last argument from the variable argument list.



23913. va_list is an array that holds information needed by va_arg and va_end



23914. The macro va_start is used to initialise a pointer to the beginning of the list of fixed arguments.



23915. Can we pass a variable argument list to a function at run-time?



23916. While defining a variable argument list function we drop the ellipsis(...)?



23917. Is it necessary that in a function which accepts variable argument list there should be at least be one fixed argument?



23918. Can we write a function that takes a variable argument list and passes the list to another function?



23919. Can the fixed arguments passed to the function that accepts variable argument list, occur at the end?



23920. It is necessary to call the macro va_end if va_start is called in the function.



23921. The macro va_arg is used to extract an argument from the fixed micro argument list and advance the pointer to the next argument.



23922. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun(char msg, ...); int main() { fun("IndiaBIX", 1, 4, 7, 11, 0); return 0; } void fun(char msg, ...) { va_list ptr; int num; va_start(ptr, msg); num = va_arg(ptr, int); num = va_arg(ptr, int); printf("%d", num); }





23923. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(char, int, int , float , char ); void fun2(char ch, ...); void (p1)(char, int, int , float , char ); void (p2)(char ch, ...); int main() { char ch='A'; int i=10; float f=3.14; char p="Hello"; p1=fun1; p2=fun2; (p1)(ch, i, &i, &f, p); (p2)(ch, i, &i, &f, p); return 0; } void fun1(char ch, int i, int pi, float pf, char p) { printf("%c %d %d %f %s \n", ch, i, pi, pf, p); } void fun2(char ch, ...) { int i, pi; float pf; char p; va_list list; printf("%c ", ch); va_start(list, ch); i = va_arg(list, int); printf("%d ", i); pi = va_arg(list, int); printf("%d ", pi); pf = va_arg(list, float); printf("%f ", pf); p = va_arg(list, char ); printf("%s", p); }





23924. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void dumplist(int, ...); int main() { dumplist(2, 4, 8); dumplist(3, 6, 9, 7); return 0; } void dumplist(int n, ...) { va_list p; int i; va_start(p, n); while(n-->0) { i = va_arg(p, int); printf("%d", i); } va_end(p); printf("\n"); }





23925. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void display(int num, ...); int main() { display(4, 'A', 'B', 'C', 'D'); return 0; } void display(int num, ...) { char c, c1; int j; va_list ptr, ptr1; va_start(ptr, num); va_start(ptr1, num); for(j=1; j<=num; j++) { c = va_arg(ptr, int); printf("%c", c); c1 = va_arg(ptr1, int); printf("%d\n", c1); } }





23926. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys", "Cats", "Dogs"); fun2(2, 12, 13, 14); return 0; } void fun1(int num, ...) { char str; va_list ptr; va_start(ptr, num); str = va_arg(ptr, char ); printf("%s ", str); } void fun2(int num, ...) { va_list ptr; va_start(ptr, num); num = va_arg(ptr, int); printf("%d", num); }





23927. Saniya Mirza and Mahesh Bhupati won which of the following titles recently ?





23928. Can you play..............guitar





23929. Living here at the top of the mountain must be very _____.





23930. Mr. Kunwar Narayan who was selected for the Jnanpith Award (for 2005) recently is a famous poet and writer in—





23931. ...........she know that you are here?





23932. Which of the following is the correct output of the C#.NET code snippet given below? int[ , , ] a = new int[ 3, 2, 3 ]; Console.WriteLine(a.Length);






23933. Which of the following statements are correct about arrays used in C#.NET? Arrays can be rectangular or jagged. Rectangular arrays have similar rows stored in adjacent memory locations. Jagged arrays do not have an access to the methods of System.Array Class. Rectangular arrays do not have an access to the methods of System.Array Class. Jagged arrays have dissimilar rows stored in non-adjacent memory locations.






23934. Which of the following statements are correct about the C#.NET code snippet given below? int[][]intMyArr = new int[2][]; intMyArr[0] = new int[4]{6, 1, 4, 3}; intMyArr[1] = new int[3]{9, 2, 7};






23935. Which of the following are the correct ways to define an array of 2 rows and 3 columns? int[ , ] a; a = new int[2, 3]{{7, 1, 3},{2, 9, 6}}; int[ , ] a; a = new int[2, 3]{}; int[ , ] a = {{7, 1, 3}, {2, 9,6 }}; int[ , ] a; a = new int[1, 2]; int[ , ] a; a = new int[1, 2]{{7, 1, 3}, {2, 9, 6}};






23936. Which of the following statements is correct about the array declaration given below? int[][][] intMyArr = new int[2][][];






23937. Which of the following statements is correct about the C#.NET code snippet given below? int[] intMyArr = {11, 3, 5, 9, 4};






23938. Which of the following is the correct way to define and initialise an array of 4 integers? int[] a = {25, 30, 40, 5}; int[] a; a = new int[3]; a[0] = 25; a[1] = 30; a[2] = 40; a[3] = 5; int[] a; a = new int{25, 30, 40, 5}; int[] a; a = new int[4]{25, 30, 40, 5}; int[] a; a = new int[4]; a[0] = 25; a[1] = 30; a[2] = 40; a[3] = 5;






23939. Which of the following is the correct output of the C#.NET code snippet given below? int[][] a = new int[2][]; a[0] = new int[4]{6, 1, 4, 3}; a[1] = new int[3]{9, 2, 7}; Console.WriteLine(a[1].GetUpperBound(0));






23940. Which of the following is the correct way to obtain the number of elements present in the array given below? int[] intMyArr = {25, 30, 45, 15, 60}; intMyArr.GetMax; intMyArr.Highest(0); intMyArr.GetUpperBound(0); intMyArr.Length; intMyArr.GetMaxElements(0);






23941. What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class SampleProgram { static void Main(string[ ] args) { int i, j; int[ , ] arr = new int[ 2, 2 ]; for(i = 0; i < 2; ++i) { for(j = 0; j < 2; ++j) { arr[i, j] = i 17 + i 17; Console.Write(arr[ i, j ] + " "); } } } } }






23942. Which of the following statements are correct about the C#.NET code snippet given below? int[ , ] intMyArr = {{7, 1, 3}, {2, 9, 6}}; intMyArr represents rectangular array of 2 rows and 3 columns. intMyArr.GetUpperBound(1) will yield 2. intMyArr.Length will yield 24. intMyArr represents 1-D array of 5 integers. intMyArr.GetUpperBound(0) will yield 2.






23943. Which of the following statements are correct about the C#.NET code snippet given below? int[] a = {11, 3, 5, 9, 4}; The array elements are created on the stack. Refernce a is created on the stack. The array elements are created on the heap. On declaring the array a new array class is created which is derived from System.Array Class. Whether the array elements are stored in the stack or heap depends upon the size of the array.






23944. Which one of the following statements is correct?






23945. If a is an array of 5 integers then which of the following is the correct way to increase its size to 10 elements?






23946. How will you complete the foreach loop in the C#.NET code snippet given below such that it correctly prints all elements of the array a? int[][]a = new int[2][]; a[0] = new int[4]{6, 1 ,4, 3}; a[1] = new int[3]{9, 2, 7}; foreach (int[ ] i in a) { / Add loop here / Console.Write(j + " "); Console.WriteLine(); }






23947. Which of the following countries is planning to launch its Moon Mission Space Vehicle named as Moon-LITE ?





23948. Which of the following books is written by Mr. Nandan Nilekani ?





23949. All his schemes fell ______ for want of money.





23950. Identify the wrongly spelt word:





<<= Back Next =>>
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions