search
Log In

Recent questions and answers in Programming

0 votes
1 answer
1
When searching for the key value 50 in the binary search tree, node containing the key values 10,30,40,70,90,120,150,175 are traversed in any order.The number of different orders possible in which these keys values can occur on the search path from root to the node containing the value 50 are?
answered 1 day ago in Programming Sainath Mandavilli 149 views
2 votes
5 answers
2
What error would the following function give on compilation? f(int a, int b) { int a; a=20; return a; } Missing parenthesis is $\textit{return}$ statement. Function should be defined as $\text{int f(int a, int b)}$ Redeclaration of $a$. None of these.
answered 5 days ago in Programming Yogesh Chaurasiya 409 views
79 votes
4 answers
3
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set p to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set p correctly? $p = n * (n-1) * (n-2) / 6;$ $p = n * (n-1) / 2 * (n-2) / 3;$ $p = n * (n-1) / 3 * (n-2) / 2;$ $p = n * (n-1) * (n-2) / 6.0;$
answered Jul 28 in Programming siddharths067 6.2k views
10 votes
4 answers
4
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s): It makes it more difficult to verify programs. It makes programs more inefficient. It makes it more difficult to modify existing programs. It results in the compiler generating longer machine code.
answered Jul 27 in Programming siddharths067 1k views
22 votes
8 answers
5
Aliasing in the context of programming languages refers to multiple variables having the same memory location multiple variables having the same value multiple variables having the same identifier multiple uses of the same variable
answered Jul 27 in Programming siddharths067 4k views
31 votes
11 answers
6
What will be the output of the following $C$ program? void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } void main(){ count (3); } $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4 \ 4 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2 \ 2 \ 2$ $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2$
answered Jul 26 in Programming dexter_n 6k views
2 votes
6 answers
7
What is the output of the following $C$-program main() { printf("%d %d %d",size of (3.14f), size of (3.14), size of (3.141)); } 4 4 4 4 8 10 8 4 8 8 8 8
answered Jul 23 in Programming Aakriti12 416 views
37 votes
6 answers
8
Consider the following C program #include<stdio.h> int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr-p, **ptr); } The output of the program is _______.
answered Jul 23 in Programming Krishnakumar Hatele 6.7k views
18 votes
4 answers
9
What is the output printed by the following C code? # include <stdio.h> int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j--]); printf ("%s\n", a); } dlrow Null string dlrld worow
answered Jul 21 in Programming Kushagra गुप्ता 2.4k views
1 vote
4 answers
10
What will be output if you will compile and execute the following C code? void main() { printf("%d",sizeof(5.2)); } $4$ $8$ $2$ $16$
answered Jul 21 in Programming hiteshpujari 140 views
47 votes
7 answers
11
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h> int a1[] = {6, 7, 8, 18, 34, 67}; int a2[] = {23, 56, 28, 29}; int a3[] = {-12, 27, -31}; int *x[] = {a1, a2, a3}; void print(int *a[]) { printf("%d,", a[0][2]); printf("%d,", ... } main() { print(x); } $8, -12, 7, 23, 8$ $8, 8, 7, 23, 7$ $-12, -12, 27, -31, 23$ $-12, -12, 27, -31, 56$
answered Jul 21 in Programming Krishnakumar Hatele 4k views
18 votes
4 answers
12
What is the result of the following program? program side-effect (input, output); var x, result: integer; function f (var x:integer:integer; begin x:x+1;f:=x; end begin x:=5; result:=f(x)*f(x); writeln(result); end $5$ $25$ $36$ $42$
answered Jul 13 in Programming Bhartendu Kumar 2.7k views
3 votes
2 answers
13
Consider the two program segments below: for i:=1 to f(x) by 1 do S end i:=1; While i<=f(x) do S i:=i+1 end Under what conditions are these two programs equivalent? Treat $S$ as any sequence of statement and f as a function.
answered Jul 13 in Programming Abir Mazumder 604 views
2 votes
1 answer
14
Prior to using a pointer variable it should be declared. initialized. both declared and initialized. none of these.
asked Mar 31 in Programming Lakshman Patel RJIT 231 views
2 votes
1 answer
15
2 votes
2 answers
16
What is the meaning of following declaration? int(*p[7])(); $p$ is pointer to function $p$ is pointer to such function which return type is array $p$ is array of pointer to function $p$ is pointer to array of function
asked Mar 31 in Programming Lakshman Patel RJIT 124 views
2 votes
1 answer
17
1 vote
1 answer
18
1 vote
2 answers
19
1 vote
1 answer
20
What will be output if you will compile and execute the following C code? void main(){ char c=125; c=c+10; printf("%d",c); } $135$ $115$ $-121$ $-8$
asked Mar 31 in Programming Lakshman Patel RJIT 114 views
1 vote
1 answer
21
The following program is to be tested for statement coverage: begin if(a==b){S1;exit;} else if (c==d){S2;} else{S3;exit;} S4; end The test cases $T1,T2,T3$ and $T4$ given below are expressed in terms of the properties satisfied by the values of variables $a,b,c$ ... of the test suites given below ensures coverage of statements $S1,S2,S3$ and $S4$? $T_1,T_2,T_3$ $T_2,T_4$ $T_3,T_4$ $T_1,T_2,T_4$
asked Mar 30 in Programming Lakshman Patel RJIT 74 views
1 vote
2 answers
22
Output of following program #include<stdio.h> int main() { int i=5; printf("%d %d %d", i++,i++,i++); return 0; } $7\:6\:5$ $5\:6\:7$ $7\:7\:7$ Compiler Dependent
asked Mar 30 in Programming Lakshman Patel RJIT 97 views
1 vote
1 answer
23
Output of following program? #include<stdio.h> void dynamic(int s,...) { printf("%d",s); } int main() { dynamic(2,4,6,8); dynamic(3,6,9); return 0; } $2\:3$ Compiler Error $4\:3$ $3\:2$
asked Mar 30 in Programming Lakshman Patel RJIT 78 views
1 vote
1 answer
24
Assume that float takes $4$ bytes, predict the output of following program. #include<stdio.h> int main() { float arr[5]={12.5,10.0,13.5,90.5,0.5}; float *ptr1=&arr[0]; float *ptr2=ptr1+3; printf("%f",*ptr2); printf("%d",ptr2-ptr1); return 0; } $90.500000\:\:3$ $90.500000\:\:12$ $10.000000\:\:12$ $0.500000\:\:3$
asked Mar 30 in Programming Lakshman Patel RJIT 69 views
1 vote
1 answer
25
Assume that size of an integer is $32$ bit. What is the output of following ANSI C program? #include<stdio.h> struct st { int x; static int y; }; int main() { printf(%d",sizeof(struct st)); return 0; } $4$ $8$ Compiler Error Runtime Error
asked Mar 30 in Programming Lakshman Patel RJIT 74 views
1 vote
1 answer
26
Consider the following C declaration struct { short s[5]; union { float y; long z; }u; }t; Assume that objects of the type short, float and long occupy $2$ bytes, $4$ bytes and $8$ bytes respectively. The memory requirement for variable $t$ ignoring alignment considerations, is $22$ bytes $14$ bytes $18$ bytes $10$ bytes
asked Mar 30 in Programming Lakshman Patel RJIT 55 views
1 vote
1 answer
27
#include<stdio.h> struct st { int x; struct st next; }; int main() { struct st temp; temp.x=10; temp.next=temp; printf("%d",temp.next,x); return 0; } Compiler Error $10$ Runtime Error Garbage Value
asked Mar 30 in Programming Lakshman Patel RJIT 95 views
1 vote
1 answer
28
What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head==NULL) return; fun1(head->next); printf("%d",head->data); } Prints all nodes of linked lists Prints all nodes of linked list in reverse order Prints alternate nodes of Linked List Prints alternate nodes in reverse order
asked Mar 30 in Programming Lakshman Patel RJIT 114 views
1 vote
1 answer
29
Let $A$ be a square matrix of size $n\times n$. Consider the following program. What is the expected output? C=100 for i=1 to n do for j=1 to n do { Temp=A[i][j]+C A[i][j]=A[j][i] A[j][i]=Temp-C } for i=1 to n do for j=1 to n ... ]); The matrix $A$ itself. Transpose of matrix $A$. Adding $100$ to the upper diagonal elements and subtracting $100$ from diagonal elements of $A$. None of the option.
asked Mar 30 in Programming Lakshman Patel RJIT 57 views
1 vote
1 answer
30
Following is C like Pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) { Stack S;//Say it creates an empty stack S while(n>0) { // This line pushes the value of n%2 to stack S; Push(&S,n%2); n=n ... $n$ in reverse order. Prints binary representation of $n$. Prints the value of $\log n$. Prints the value of $\log n$ in reverse order.
asked Mar 30 in Programming Lakshman Patel RJIT 59 views
1 vote
4 answers
31
Bug means A logical error in a program A difficult syntax error in a program Documenting programs using an efficient documentation tool All of the above
asked Mar 30 in Programming Lakshman Patel RJIT 92 views
0 votes
2 answers
32
If $x$ is a one dimensional array, then $^*(x+i)$ is same as $^*(\&x[i])$ $\&x[i]$ is same as $x+i-1$ $^*(x+i)$ is same as $^*x[i]$ $^*(x+i)$ is same as $^*x+i$
asked Mar 30 in Programming Lakshman Patel RJIT 125 views
1 vote
1 answer
33
What cannot replace ‘?’ in the following C-code to print all odd numbers less than $100$ ? for (i=1; ? ; i=i+2) printf("%d\n", i); $i\leq100$ $i\leq101$ $i<100$ $i<101$
asked Mar 28 in Programming jothee 64 views
1 vote
1 answer
34
Which of the following is a valid C code to print character A' to C' ? x='A' ; switch(x) {case 'A'= printf ( "%d\n" , x); .... case 'C'= printf ( "%d\n" , x); } x='A'; switch(x) {case 'A' <= x <= 'C' : printf ( "%d\n" , x);} x='A' ; switch(x) { case 'A' : printf ( " ... break; } x='A' ; switch(x) { case 'A' =printf ( "%d\n" , x); case 'B' =printf ( "%d\n" , x); case 'C' =printf ( "%d\n" , x); }
asked Mar 28 in Programming jothee 67 views
1 vote
1 answer
35
int arr[ ]={1, 2, 3, 4} int count; incr( ) {return ++count;} main( ) { arr[count++]=incr( ); printf(“arr[count]=%d\n”, arr[count]); } The value printed by the above program is : $1$ $2$ $3$ $4$
asked Mar 27 in Programming jothee 56 views
1 vote
1 answer
36
The declaration “unsigned u” indicates : u is an unsigned character u is an unsigned integer u is a character u is a string
asked Mar 27 in Programming jothee 49 views
1 vote
1 answer
37
After $3$ calls of the $c$ function bug ( ) below, the values of $i$ and $j$ will be : int j = 1; bug () { static int i = 0; int j = 0; i++; j++; return (i); } $i = 0, j = 0$ $i = 3, j = 3$ $i = 3, j = 0$ $i = 3, j = 1$
asked Mar 26 in Programming jothee 274 views
1 vote
6 answers
38
Find the output of the following $“C”$ code : Main() { int x=20, y=35; x=y++ + x++; y=++y + ++x; printf (“%d, %d\n”, x, y); } $55, 93$ $53, 97$ $56, 95$ $57, 94$
asked Mar 26 in Programming jothee 295 views
2 votes
2 answers
39
Main() { char *str="abcde"; printf("%c",*str); printf("%c",*str++); printf("%c",*(str++)); printf("%s",str); } The output of the above $‘C’$ code will be : $\text{a a c b c d e}$ $\text{a a c c c d e}$ $\text{a a b c d e}$ None of these
asked Mar 26 in Programming jothee 149 views
1 vote
1 answer
40
Consider the following statements, Int i=4, j=3, k=0; k=++i - --j + i++---j +j++; What will be the values of $i, j $ and $k$ after the statement. $7,2,8$ $5,2,10$ $6,2,8$ $4,2,8$
asked Mar 26 in Programming jothee 48 views
To see more, click for all the questions in this category.
...