Recent questions tagged output

3 3 votes
3 3 answers
267
267 views
What value will $\texttt{x}$ store after the execution of the code below?x = 4 x = 2Value of $\texttt{x}$ multiplied by $\texttt{2}$Square of $\texttt{x}$Value of $\text...
2 2 votes
2 2 answers
196
196 views
Consider the following Python code:scores = {"Ali": 8, "Mia": 10} scores["Ali"] += 2 scores["Noah"] = scores["Mia"] - 3 print(scores)What is the output of the code above?...
2 2 votes
2 2 answers
209
209 views
Consider the following Python code:total = 0 for n in [1, 2, 3, 4]: if n % 2 == 0: total += n else: total -= n print(total)What is the output of the code above?
2 2 votes
3 3 answers
202
202 views
Consider the following Python code:word = "python" result = word[1:4] + word[-1] print(result)What is the output of the code above?ythnythopythnthon
3 3 votes
1 1 answer
154
154 views
Consider the following Python code:nums = [2, 4, 6, 8] nums = nums + 3 nums.append(10) nums.pop(0) print(nums)What is the output of the code above?[2, 7, 6, 8, 10][7, 6...
2 2 votes
1 1 answer
175
175 views
Consider the following Python code:def append_val(val, my_list=[]): my_list.append(val) return my_list list1 = append_val(10) list2 = append_val(20, []) list3 = append_va...
1 1 vote
1 1 answer
157
157 views
Consider the following Python code:m = [[1, 2], [3]] n = m.copy() r = [m[0], n ] * 2 m[0].remove(2) n += [4] r = r + [5]What is the result of evaluating $\texttt{r}$?[...
0 0 votes
1 1 answer
135
135 views
Consider the following Python code:x = [ , [2, 3]] y = [x[0]] * 3 + x[1:] y[0].append(4) x[0] = x[0] + [5] y[3].pop()What is the result of evaluating $\texttt{y}$?[[1, 4,...
0 0 votes
1 1 answer
129
129 views
Consider the following Python code:a = [[0], ] b = a[:] c = a * 2 b[0].append(2) c = c + [3] a .append(4)What is the result of evaluating $\texttt{c}$ ?[[0, 2], [1, 4]...
0 0 votes
1 1 answer
136
136 views
Consider the following Python code:p = [ , ] q = p * 2 q[0].append(3) q = q + [4] p .extend(q[0])What is the result of evaluating $\texttt{q}$ ?[[1, 3, 4], [2, 1, 3], ...
1 1 vote
1 1 answer
626
626 views
Consider the given Python program.def append_to_lst(val, lst=[]): lst.append(val) return lst print(append_to_lst(1)) print(append_to_lst(2)) print(append_to_lst(3, []))Wh...
0 0 votes
1 1 answer
823
823 views
Consider the given Python program.def fun(L, i=0): if i >= len(L)-1: return 0 if L[i] L[i+1]: L[i+1], L[i] = L[i], L[i+1] return 1+fun(L, i+1) else: return fun(L, i+1) d...
12 12 votes
3 3 answers
2.2k
2.2k views
Consider the following ANSI-C program.#include <stdio.h int main(){ int *ptr, a, b, c; a=5; b=11; c=20; ptr=&a; *ptr=c; ptr=&c; a=*(&b); c=*ptr-a; printf("%d",c); return(...
18 18 votes
5 5 answers
4.3k
4.3k views
Consider the following ANSI-C function.int func(int start, int end){ int length=end+1-start; if((length<1)||(start<0)||(end<0)){ return(0); } if(length%3==0){ return(func...
18 18 votes
5 5 answers
3.9k
3.9k views
Consider the following program in C:#include <stdio.h void func(int i, int j) { if(i < j) { int i = 0; while (i < 10) { j += 2; i++; } } printf("%d", i); } int main() { i...
2 2 votes
1 1 answer
504
504 views
Consider the following piece of C programming code:int x=128, y=110; do { If(x>y) x=x-y; else y=y-x; } while (x!=y) printf("%d",x);Which one will be the output?$18$$2$$92...
0 0 votes
1 1 answer
406
406 views
What will be the output of the following C programming code:int i, j; for(i=1; i<5; i+=2) for(j=1; j<i; j+=2) printf("%d", j);$1$$1 \quad 2$$1 \quad 3$$1 \quad 1 \quad 3$
0 0 votes
1 1 answer
533
533 views
What will be the output of the following C Programming code:void main () { int * i, a=12, b=2, c ; c=(a=a+b, b=a/b, a=a*b, b=a-b) i=& c ; printf("%d", (*i)); }$91$$90$$9...
0 0 votes
1 1 answer
299
299 views
Match the LIST-I with LIST-II$\begin{array}{|l|l|l|l|} \hline & \textbf{LIST-I} & & \textbf{LIST-II} \\ & \textbf{(FUNCTIONS)} && \textbf{(Uses of functions)} \\ \hline \...
0 0 votes
1 1 answer
256
256 views
Match the $\textbf{List - I}$ with $\textbf{List - II}.$$\textbf{List - I}$(Question)$\textbf{List - II}$(Answer)A.The speed of a CPU is measured in $\_\_\_\_\_\_\_$.I.In...
1 1 vote
2 2 answers
423
423 views
#include<stdio.h void main() { int arr[]={1, 2, 3, 4, 5}; int *p=arr; printf("%d", *p++); printf("%d", *(p+1)); }Find the output of the above code?$1,2$$1,3$$2,3$$1,4$
0 0 votes
1 1 answer
259
259 views
#include<iostream.h using namespace std; void swap(int &x, int &y) { int temp = x; x=y; y= temp; } int main() { int a=5,b=10; swap(a,b); swap(a,b); cout<<a<<" " <<b; retu...
0 0 votes
2 2 answers
408
408 views
Consider the following code:#include<stdio.h void f1(char *x, char *y) { char *t1; t 1 = x; x= y; y = t 1;} void f2(char x, char y) { char *t1 ; t1 = *x; *x = *y; *y = ...
0 0 votes
1 1 answer
374
374 views
Consider following C program :#include<stdio.h int main() { int x[]={2,4,6,8,10}; int a, b=0, * y = x+4; for(a = 0; a<5; a++) { b=b+(*y -a) - *(y -a); } printf("%d\n", b)...
0 0 votes
1 1 answer
286
286 views
What will be the output of the following $\text{C}$ code?#include<stdio.h void main() { int arr[5]={10,20,30,40,50}; int *p = (int*) (&arr+1); printf("\%d\%d", *(arr + 1)...
0 0 votes
0 0 answers
210
210 views
What is the output of code given below:#include<iostream.h using namespace std; class Base { public: Base(){ cout<<"Base Const"; } virtual ~Base() { cout<<"Base dest"; } ...
2 2 votes
1 1 answer
423
423 views
Consider the following statements regarding combinational and sequential circuits.Output of combinational circuits depends on the only current input.Output of combination...
0 0 votes
0 0 answers
193
193 views
What is the output of the following program?#include <stdio.h int main() { int i = 3; while (i ) { int i = 10; i ; printf("%d", i); } printf("%d", i); }$990$$9990$$999-1$...
0 0 votes
1 1 answer
192
192 views
What is the output of the following program?#include <stdio.h #define SQR(x) (x*x) int main() {int a, b = 3; a = SQR(b + 2); printf("%d", a); return 0; }$25$$11$Garbage v...
0 0 votes
0 0 answers
106
106 views
If the input to an $\text{LTI}$ system is a random signal with a known mean and variance, the output will have:The same mean and variance as the input signalThe same mean...