search
Log In

Recent questions tagged programming

0 votes
1 answer
1
Consider the following declaration. int a, *b = &a, **c = &b; a = 4; **c = 5; If the statement b = (int *)**c Is appended to the above program fragment then Value of $b$ becomes $5$ Value of $b$ will be the address of $c$ Value of $b$ is unaffected None of these
asked Apr 1, 2020 in Programming Lakshman Patel RJIT 187 views
2 votes
1 answer
2
1 vote
1 answer
3
1 vote
1 answer
4
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, 2020 in Programming Lakshman Patel RJIT 186 views
1 vote
1 answer
5
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, 2020 in Programming Lakshman Patel RJIT 170 views
1 vote
4 answers
6
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, 2020 in Programming Lakshman Patel RJIT 309 views
0 votes
1 answer
7
What can you say about the following statements? XML tags are case-insensitive In JavaScript, identifier names are case-sensitive Cascading Style Sheets (CSS) cannot be used with XML All well formed XML documents must contain a document type definition only I and II are false only III and IV are false only I and III are false only II and IV are false
asked Mar 24, 2020 in Web Technologies jothee 404 views
5 votes
3 answers
8
#include int main( ) { int x=5, y=9; x=(x= x+y)-(y= x-y); printf("%d %d ", x, y); return 0; } A. 9 5 B. 5 14 C. 14 5 D. 5 9
asked Mar 5, 2020 in Programming vivek_mishra 282 views
4 votes
4 answers
9
What is the output of the code given below? # include<stdio.h> int main() { char name[]="satellites"; int len; int size; len= strlen(name); size = sizeof(name); printf("%d",len*size); return 0; } $100$ $110$ $40$ $44$
asked Jan 13, 2020 in Programming Satbir 853 views
2 votes
4 answers
10
Consider the following recursive C function that takes two arguments unsigned int rer(unsigned int n, unsigned int r){ if(n>0)return(n%r + rer(n/r,r)); else retturn 0; } What is the return value of the function $rer$ when it is called as $rer(513,2)$? $9$ $8$ $5$ $2$
asked Jan 13, 2020 in Programming Satbir 449 views
3 votes
1 answer
11
In the following procedure Integer procedure P(X,Y); Integer X,Y; value x; begin K=5; L=8; P=x+y; end $X$ is called by value and $Y$ is called by name. If the procedure were invoked by the following program fragment K=0; L=0; Z=P(K,L); then the value of $Z$ will be set equal to $5$ $8$ $13$ $0$
asked Jan 13, 2020 in Programming Satbir 707 views
2 votes
3 answers
12
Following declaration of an array of struct, assumes size of byte, short, int and long are $1,2,3$ and $4$ respectively. Alignment rule stipulates that $n$ - byte field must be located at an address divisible by $n$, the fields in the struct are not rearranged, padding is used to ensure ... $8$, what is the total size of $C$, in bytes? $150$ $160$ $200$ $240$
asked Jan 13, 2020 in Programming Satbir 593 views
7 votes
1 answer
13
What is the output in a $32$ bit machine with $32$ bit compiler? #include<stdio.h> rer(int **ptr2, int **ptr1) { int *ii; ii=*ptr2; *ptr2=*ptr1; *ptr1=ii; **ptr1*=**ptr2; **ptr2+=**ptr1; } void main(){ int var1=5, var2=10; int *ptr1=&var1,*ptr2=&var2; rer(&ptr1,&ptr2); printf("%d %d",var2,var1); } $60,70$ $50,50$ $50,60$ $60,50$
asked Jan 13, 2020 in Programming srestha 913 views
7 votes
2 answers
14
What is output of the following ‘C’ code assuming it runs on a byte addressed little endian machine? #include<stdio.h> int main() { int x; char *ptr; x=622,100,101; printf("%d",(*(char *)&x)*(x%3)); return 0; } $622$ $311$ $22$ $110$
asked Jan 13, 2020 in Programming srestha 1.4k views
0 votes
1 answer
15
#include<stdio.h> #include<stdlib.h> int main(void) { int maxLineCount = 500, maxCharCount = 500, index, j, count; char *line = NULL; size_t size; char *a[maxLineCount]; for (index = 0; index < maxLineCount; index++) a[index] = (char *)malloc(maxCharCount * ... of the code is doing. suppose we have 3 string given as input in 3 different lines then how can we access each character of the string?
asked Jun 1, 2019 in Programming Satbir 922 views
4 votes
3 answers
16
#include<stdio.h> #include<iostream> int bar(int m, int n){ if(m==0)return n; if(n==0)return m; return bar(n%m,m); } int foo(int m,int n){ return(m*n/bar(m,n)); } int main(){ int x=foo(1000,1500); printf("%d",x); return 0; } Output of the program is ___________
asked May 20, 2019 in Programming srestha 408 views
2 votes
1 answer
17
Consider the following $C$ implementation which when given $3$ numbers a,b,c as input, find the maximum of $3$ numbers $a,b,c.$ int kickstart(int a,int b,int c) { if(B1) return a; if(a>=b) return B2; return kickstart(c,a,b); } How the boxes filled up correctly? $I)B1:a\geq b$ ... $IV)B1:a\geq b$ && $a\geq c, B2:kickstart\left ( b,c,a \right );$ Is it $I) and II)$ or $I) and IV)$
asked May 19, 2019 in Programming srestha 440 views
2 votes
2 answers
18
Consider the following function $foo()$ void foo(int n){ if(n<=0) printf("Bye"); else{ printf("Hi"); foo(n-3); printf("Hi"); foo(n-1); } } Let $P(n)$ represent recurrence relation, indicating number of time print statement executed. What will best recurrence for ... $n=0$ The options are confusing to me. Can someone explain the options well. Moreover , what will be constant added $1$ or $2?$
asked May 12, 2019 in Programming srestha 353 views
1 vote
0 answers
19
Consider the following C code: int getNextGap(int gap){ gap=(gap*10)/13; if(gap<1)return 1; return gap; } void mystery(int a[ ],int n){ int gap=n; bool red=true; while(gap!=1||red==true){ gap=getNextGap(gap); red=false; for(int i=0;i<(n-gap ... n is number of array elements, then what output will print at last? I mostly stuck how bool function working here. Plz help me out, how program executing:(
asked May 10, 2019 in Programming srestha 337 views
1 vote
0 answers
20
Consider the following function int fun(int a[ ],int l, int target){ int i=0,j=0,sum=0,count=0; while(j<l){ if(sum<target){ sum=sum+a[j]; j++; } else if(sum>target){ sum=sum-a[i]; i++; } else{ count++; sum=sum-a[i]; i++; } } if(sum==target) ... be return value of function call $fun\left ( a,16,8 \right )=$_______________ Given ans $6,$ but I got $4.$ Which one correct?? Any shortcut to evaluate??
asked May 8, 2019 in Programming srestha 358 views
1 vote
1 answer
21
#include<stdio.h> int main(){ int (*a)[5]; int arr[5][5]={ {10,65,300,400,500}, {100,20,3000,40,5000} }; a = arr; ++a ; char *ptr = (char*)*a; ++a ; printf("%d %d %d",**a,*arr[1],*ptr); return 0; }
asked May 7, 2019 in Programming kaveeshnyk 345 views
3 votes
3 answers
22
#include<stdio.h> #include<string.h> int main(void) { char *a="MADEEASY"; char *b="GATECSIT2019"; char *r=a; char *s=b; printf("%d",(int)strlen(b+3[r]-1[s])); return 0; } Ans is given $8.$ I know basic thing, but couldnot getting what strlen(b+3[r]-1[s]) returning?? Plz explain.
asked May 4, 2019 in Programming srestha 347 views
1 vote
0 answers
23
Consider the following program: void A(int n){ printf("*"); if(n>1){ A(n/4); A(n/4); A(n/4); A(n/4); } } Let $X$ be number of asterisks printed by above function when $n=1024.$ Then the value of $X$ will be ____________ How ans will be $\frac{4^{k+1}-1}{3}$ , where $k=5?$ .
asked May 4, 2019 in Programming srestha 349 views
3 votes
3 answers
24
for(int i=0; i<=100;i++) { if (i % 3 == 0) printf("Great); if(i%5 == 0) printf("India"); } Count the number of times GreatIndia is printed. 6 20 33 none of these
asked Apr 29, 2019 in Programming manikgupta123 664 views
0 votes
1 answer
25
Consider the following C program #include<stdio.h> int main(){ char *arr={"GATE","CAT","IES","IAS","PSU","IFS"}; call(arr); return 0; } void call(char **ptr){ char **ptr1; ptr1=(ptr+=(sizeof(int)))-2; printf("%s",*ptr1); } Assume size of int pointer 4B.What will be output?
asked Apr 25, 2019 in Programming srestha 319 views
1 vote
1 answer
26
Suppose a queue $Q$ and two stacks $S_{1}$ and $S_{2}$ as given below. void enqueue(Q,x){ push(S1,x); } void dequeue(Q,x){ if(stack-empty(S2))then if(stack-empty(S1))then{ print("Q is empty"); return; } else while(!stack-empty(S1)){ x= ... is equal to______________ $Enqueue(4),Enqueue(3),Enqueue(2),Dequeue, Enqueue(6),Dequeue,Dequeue, Dequeue,Enqueue(5)$ Please tell value of X and Y are u getting
asked Apr 24, 2019 in Programming srestha 190 views
0 votes
2 answers
27
Consider the function give below, which should return the index of first zero in input array of length $n$ if present else return $-1.$ int index of zero(int[ ] array,int n){ for(int i=0; P ;i++); if(i==n){ return -1; } return i; } What should be placed in place code at ‘P’,So that code will work fine? $A)$array[i]!=0 && i<=n $B)$ array[i]!=0 && i<n
asked Apr 24, 2019 in Programming srestha 221 views
2 votes
4 answers
28
Which of the following data structure is efficient to implement priority queue such as insertion ,deletion, searching? A)Linked List B)Heap C)Sorted Array D)Unsorted Array How priority queue can work more efficiently in any data structure, other than heap?
asked Apr 24, 2019 in DS srestha 476 views
0 votes
1 answer
29
Consider a simple code $\mathcal{C}$ for error detection and correction. Each codeword in $\mathcal{C}$ consists of $2$ data bits $[d_1, d_0]$ followed by check bits $[c_2, c_1, c_0]$ ... $2$ addition. Write down all the codewords for $\mathcal{C}$ Determine the minimum Hamming distance between any two distinct codewords of $\mathcal{C}$
asked Apr 8, 2019 in Digital Logic akash.dinkar12 237 views
1 vote
1 answer
30
Write a $C$ program to fins all permutations of a string (having at most 6 characters). For example, a string of $3$ characters like $“abc"$ has 6 possible permutations: $“abc", “acb", “bca", “bac", “cab", “cba".$
asked Apr 8, 2019 in Programming akash.dinkar12 212 views
...