Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged programming-in-c
1
votes
0
answers
1
GATE CSE SET-1 2024
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
My question is that can we use command line arguments without use of main function's parameters argc and *argv?
RahulVerma3
75
views
RahulVerma3
asked
6 days
ago
Programming in C
programming-in-c
programming
+
–
0
votes
0
answers
2
GATE 2024 CSE1
I have a question that can we use command line arguments without main function arguments? int main(int argc, char **argv){ }
I have a question that can we use command line arguments without main function arguments?int main(int argc, char argv){}
RahulVerma3
104
views
RahulVerma3
asked
Mar 16
Programming in C
gatecse2024-set1
programming-in-c
+
–
1
votes
1
answer
3
#OS-FORK Output
Q23. The following C program is executed on a Unix/Linux system: main() { int i=0; while (i<20) if (i%2==0) fork(); i++; return 0; } Calculate how many number of processes will be created after executing the above program. Options: 1.1023 2.Infinite 3.1024 4.2048
Q23. The following C program is executed on a Unix/Linux system: main(){ int i=0; while (i<20) if (i%2==0) fork(); ...
BitMask
248
views
BitMask
asked
Mar 3
Operating System
operating-system
fork-system-call
gate-preparation
programming-in-c
usermod
+
–
0
votes
1
answer
4
c programming
#include <stdio.h> int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; } output is 255 , but please explain how
#include <stdio.h int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; }output is 255 , but please explain how
SSR17
204
views
SSR17
asked
Feb 29
Programming in C
programming-in-c
+
–
0
votes
0
answers
5
Programming and DS
Trying out a code to get all the possible marks that can be obtained in a GATE paper. Assumptions taken : 1) All questions are MCQs (all questions have a chance of negative marking) 2) 30 1-mark questions, 35 2-mark questions 3) Static array without any ... [i]); return 0; } The console doesn't output anything. Any suggestions on where might I be going wrong/ the error lies?
Trying out a code to get all the possible marks that can be obtained in a GATE paper.Assumptions taken : 1) All questions are MCQs (all questions have a chance of negativ...
Mrityudoot
110
views
Mrityudoot
asked
Feb 26
Object Oriented Programming
programming-in-c
output
programming
+
–
3
votes
2
answers
6
GATE CSE 2024 | Set 2 | Question: 3
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left. #include <stdio.h> int g( int p) { printf("%d", p); return p; } int h(i nt q) { printf("%d", q) ... one of the following options is the CORRECT output of the above $\text{C}$ program? $20101020$ $10202010$ $20102010$ $10201020$
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left.#include <stdio.h>int g( int p) { printf("%d", p); return p; }...
Arjun
3.3k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
3
votes
1
answer
7
GATE CSE 2024 | Set 2 | Question: 23
Consider the following $\mathrm{C}$ function definition. int f X(char * a) { char * b = a; while (*b) b ++; return b - a; } Which of the following statements is/are TRUE? The function call $\text{f X("a b c d''}$) will ... ${ }^{*} \mathrm{C}=$ "abcd" in main (), the function call $\mathrm{fX}(\mathrm{c})$ will always return a value
Consider the following $\mathrm{C}$ function definition.int f X(char * a) {char * b = a;while (*b)b ++;return b - a; }Which of the following statements is/are T...
Arjun
2.1k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
multiple-selects
+
–
2
votes
2
answers
8
GATE CSE 2024 | Set 2 | Question: 26
What is the output of the following $\text{C}$ program? #include <stdio.h> int main() { double $a[2]=\{20.0,25.0\},{ }^{*} \mathrm{p},{ }^{*} \mathrm{q}$; $\mathrm{p}=\mathrm{a} ;$ $q=p+1 ;$ printf("%d,%d", (int) $(q-p),($ int $\left.)\left({ }^{*} q-{ }^{*} p\right)\right)$; return $0$ ; } $4,8$ $1,5$ $8,5$ $1,8$
What is the output of the following $\text{C}$ program?#include <stdio.h>int main() {double $a =\{20.0,25.0\},{ }^{*} \mathrm{p},{ }^{*} \mathrm{q}$;$\mat...
Arjun
2.5k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
3
votes
2
answers
9
GATE CSE 2024 | Set 2 | Question: 32
Consider an array $\mathrm{X}$ that contains $\mathrm{n}$ positive integers. A subarray of $\mathrm{X}$ is defined to be a sequence of array locations with consecutive indices. The $\mathrm{C}$ code snippet given below has been written to compute the length of the longest ... $\text{(P) } \text{len} 2+1$ $\text{(Q) } \text{len} 1+1$
Consider an array $\mathrm{X}$ that contains $\mathrm{n}$ positive integers. A subarray of $\mathrm{X}$ is defined to be a sequence of array locations with co...
Arjun
1.7k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
+
–
3
votes
3
answers
10
GATE CSE 2024 | Set 1 | Question: 8
Consider the following $\mathrm{C}$ program: #include <stdio.h> int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; } Which one of the following ... The program prints $9$ as output The program prints $10$ as output The program gets stuck in an infinite loop The program prints $6$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h>int main() {int a=6;int b = 0;while (a<10) {a = a / 12+1 ;a += b ;}printf ("%d", a);return 0 ; }Which one ...
Arjun
5.6k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
+
–
1
votes
3
answers
11
GATE CSE 2024 | Set 1 | Question: 9
Consider the following $\mathrm{C}$ program: #include <stdio.h> void fX () { void fX () ; char a; int main() { if ((a=g e t c h a r()) ! = '\n') fX}() ; fX(); return 0 ; if (a ! ... program will not terminate The program will terminate with no output The program will terminate with $4321$ as output The program will terminate with $1234$ as output
Consider the following $\mathrm{C}$ program:#include <stdio.h void fX () {void fX () ; char a;int main() { if ((a=g e t c h a r()) ! = '\n')fX}() ; fX();return 0 ; if ...
Arjun
2.7k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
programming
programming-in-c
+
–
2
votes
1
answer
12
GATE CSE 2024 | Set 1 | Question: 38
Consider the following $\mathrm{C}$ function definition. int $\mathrm{f}$ (int $\mathrm{x}$, int $\mathrm{y})$ { for (int $i=0 ; i<y ; i++$ ) { $\mathrm{x}=\mathrm{x}+\mathrm{x}+\mathrm{y}$; } return $\mathrm{x}$; } Which of the ... $2^{10}$ If the inputs are $x=10, y=20$, then the return value is greater than $2^{20}$
Consider the following $\mathrm{C}$ function definition.int $\mathrm{f}$ (int $\mathrm{x}$, int $\mathrm{y})$ {for (int $i=0 ; i<y ; i++$ ) {$\mathrm{x}=\mathrm{x}+...
Arjun
1.9k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
multiple-selects
programming
programming-in-c
+
–
5
votes
1
answer
13
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 16
Consider the following C code: double A[2][3] = {{1, 2, 3}, {4, 5, 6}}; Assume that A[0] = 0xFFAA0000 and the sizeof(double) is 8. What will be the value of `A[1]`? 0xFFAA0024 0xFFAA0003 0xFFAA000C 0xFFAA0018
Consider the following C code:double A [3] = {{1, 2, 3}, {4, 5, 6}};Assume that A[0] = 0xFFAA0000 and the sizeof(double) is 8.What will be the value of A ?0xFFAA00240x...
GO Classes
486
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
array
1-mark
+
–
5
votes
2
answers
14
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 27
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data space A variable allocated on the stack A variable allocated on the heap A variable which can NOT be defined as local variable
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data spaceA variable allocated on the stackA variab...
GO Classes
333
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
storage-classes-in-c
1-mark
+
–
7
votes
2
answers
15
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 33
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x[2]+4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \textsf{x}$ $\ast((*(x+16))+28)$ $\ast((*(x+2))+7)$ $\ast(((* x)+2)+7)$ $(* \ast(x+2)+7)$
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x +4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \text...
GO Classes
420
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
pointers
1-mark
+
–
4
votes
1
answer
16
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 42
The provided C code is a version of the C string library function strlen(), which calculates the length of a given string. unsigned int mystrlen(char *c) { unsigned int i = 0; /* Your code here. */ } Which line of code creates a working and ... != '\0') i++; return i; while (*(c + i) != '\0') ++i; return i;
The provided C code is a version of the C string library function strlen(), which calculates the length of a given string.unsigned int mystrlen(char *c) { unsigned in...
GO Classes
374
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
strings
multiple-selects
2-marks
+
–
4
votes
1
answer
17
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 43
What will be the output of the following C program? #include <stdio.h> void Mickey(int**, int, int); void Mouse(int, int*); int main() { int a = 2, b = 3, c = 4; int *points = &a; Mickey(&points, b, c); printf("%d", ... x; *p = **points+1; Mouse(z, p); return; } void Mouse(int z, int *p) { *p = *p+1; return; }
What will be the output of the following C program?#include <stdio.h>void Mickey(int , int, int);void Mouse(int, int*);int main(){ int a = 2, b = 3, c = 4; int *poi...
GO Classes
369
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
numerical-answers
programming
programming-in-c
functions
2-marks
+
–
4
votes
1
answer
18
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 54
Consider the following pseudocode procedure. Which of the following best describes procedure mystery? It returns a list of numbers from 1 to $n$. It prints every third number from 1 to $n$. It returns the sum of the numbers from 1 to $\mathrm{n}$. It returns the sum of the multiples of 3 from 1 to $n$.
Consider the following pseudocode procedure.Which of the following best describes procedure mystery?It returns a list of numbers from 1 to $n$.It prints every third numbe...
GO Classes
201
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
functions
2-marks
+
–
1
votes
1
answer
19
Array, Memory Allocation
In what cases does an uninitialized array have values = 0 and for which cases does it have values = garbage values. How to differentiate?
In what cases does an uninitialized array have values = 0 and for which cases does it have values = garbage values. How to differentiate?
Mrityudoot
248
views
Mrityudoot
asked
Feb 2
Programming in C
memory-management
programming-in-c
array
+
–
1
votes
1
answer
20
Array
Does C support fractional Indices? float x = some fraction; Is float a[x] valid declaration?
Does C support fractional Indices?float x = some fraction;Is float a[x] valid declaration?
Mrityudoot
132
views
Mrityudoot
asked
Feb 2
Programming in C
array
programming-in-c
+
–
5
votes
1
answer
21
GO Classes Test Series 2024 | Mock GATE | Test 13 | Question: 18
What will be output printed by the following program? #include<stdio.h> main() { int c=4; switch(c) { c=c-1; case 4: printf("IITB "); break; default: printf("IISc "); case 3: printf("IITM "); case ... ;IITD"); } } $\text{IITB IITM}$ $\text{IITB IISc IITM}$ $\text{IITB}$ $\text{IITB IITM IITD}$
What will be output printed by the following program?#include<stdio.h main() { int c=4; switch(c) { c=c-1; case 4: printf("IITB ")...
GO Classes
348
views
GO Classes
asked
Jan 28
Programming in C
goclasses2024-mockgate-13
goclasses
programming
programming-in-c
output
1-mark
+
–
4
votes
0
answers
22
GO Classes Test Series 2024 | Mock GATE | Test 13 | Question: 19
What will be the output of the following program? #include <stdio.h> int main() { int a[2][2] = { {1, 2}, {3, 4} }; int (*p)[2][2]; p = &a; printf("%d", (*p)[0][1]); return 0; } $1$ $2$ $3$ $4$
What will be the output of the following program?#include <stdio.h int main() { int a = { {1, 2}, {3, 4} }; int (*p) ; p = &a; printf("%d", (*p)[0] ); return 0; }$1$$2...
GO Classes
291
views
GO Classes
asked
Jan 28
Programming in C
goclasses2024-mockgate-13
goclasses
programming
programming-in-c
array-of-pointers
1-mark
+
–
3
votes
1
answer
23
GO Classes Test Series 2024 | Mock GATE | Test 13 | Question: 47
#include<stdio.h> #include<string.h> char upstr[50]; void putStar (int n,char str[]){ upstr[n] = str[n]; if(n == strlen(str)) return; else upstr[n+1] = '*'; putStar(n+1,str); } int main() { char str[] = " ... , upstr); } What will be the output of the given program? h*e*l*l*o h*e*l*l*o* h*e*l*l* hello
#include<stdio.h #include<string.h char upstr[50]; void putStar (int n,char str[]){ upstr[n] = str[n]; if(n == strlen(str)) return; else upstr[n+1] = '*'; putStar(n+1,str...
GO Classes
302
views
GO Classes
asked
Jan 28
Programming in C
goclasses2024-mockgate-13
goclasses
programming
programming-in-c
array
2-marks
+
–
8
votes
2
answers
24
GO Classes Test Series 2024 | Mock GATE | Test 13 | Question: 48
#include <stdio.h> int main() { int i= 255; short int *s= (short int *)&i; printf("%d\n", *s); } What will be the output of the above program in little-endian and big-endian, respectively? $(65280\text{ is } 255\times2^8)$ $255,\; 0$ $65280,\; 0$ $0,\;0$ $0,\; 65280$
#include <stdio.h int main() { int i= 255; short int *s= (short int *)&i; printf("%d\n", *s); }What will be the output of the above program in little-endian and big-endia...
GO Classes
519
views
GO Classes
asked
Jan 28
Programming in C
goclasses2024-mockgate-13
goclasses
programming
programming-in-c
little-endian-big-endian
output
2-marks
+
–
2
votes
1
answer
25
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 12
Consider the following two declarations for $\textsf{arr1}$ and $\textsf{arr2}:$ int arr1[2][3]; int r1[3]; int r2[3]; int * arr2[2] = {r1, r2}; Assume that the size of the integer is $4$ Bytes and the ... $\operatorname{sizeof}(\operatorname{arr}1)=48$ bytes and sizeof $(\operatorname{arr}2)=32$ bytes
Consider the following two declarations for $\textsf{arr1}$ and $\textsf{arr2}:$int arr1 [3]; int r1[3]; int r2[3]; int * arr2 = {r1, r2};Assume that the size of the int...
GO Classes
411
views
GO Classes
asked
Jan 21
Programming in C
goclasses2024-mockgate-12
goclasses
programming
programming-in-c
array-of-pointers
1-mark
+
–
6
votes
2
answers
26
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 13
What will be the output of following program ? #include <stdio.h> int thefunction(int a) { static int b = 0; b++; a = a + b; return a; } int main() { int b = 0; int i; for (i = 1; i <= 3; i++) { b = b + thefunction(i); } printf("%d\n", b); return 0; }
What will be the output of following program ?#include <stdio.h int thefunction(int a) { static int b = 0; b++; a = a + b; return a; } int main() { int b = 0; int i; for ...
GO Classes
480
views
GO Classes
asked
Jan 21
Programming in C
goclasses2024-mockgate-12
goclasses
numerical-answers
programming
programming-in-c
storage-classes-in-c
1-mark
+
–
6
votes
1
answer
27
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 14
What will be the output of the following program? main() { int a[2][2] = { {1,2},{3,4} }; int(*p)[2][2]; p = &a; printf("%d", (*p)[0][0]); } $1$ $3$ $4$ None of these
What will be the output of the following program?main() { int a = { {1,2},{3,4} }; int(*p) ; p = &a; printf("%d", (*p)[0][0]); }$1$$3$$4$None of these
GO Classes
408
views
GO Classes
asked
Jan 21
Programming in C
goclasses2024-mockgate-12
goclasses
programming
programming-in-c
array
output
1-mark
+
–
5
votes
1
answer
28
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 26
What will be the output of the following C program? #include<stdio.h> void main() { int i=6; for(--i; --i; i--) { printf("%d",i); } } $42$ $31$ Infinite loop None of these
What will be the output of the following C program?#include<stdio.h void main() { int i=6; for( i; i; i ) { printf("%d",i); } }$42$$31$Infinite loopNone of these
GO Classes
445
views
GO Classes
asked
Jan 21
Programming in C
goclasses2024-mockgate-12
goclasses
programming
programming-in-c
output
2-marks
+
–
1
votes
1
answer
29
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 27
Consider the following C program:- #include <stdio.h> void ubswap(int **a, int **b) { int* temp = *a; *a = *b; *b = temp; } int main() { int x = 1, y = 9; int* u = &x; int* v = &y; int** a = &u; int** b ... $\text{ return 0 }?$ $x$ and $y$ $u$ and $v$ $a$ and $b$ None of the above
Consider the following C program:-#include <stdio.h void ubswap(int a, int b) { int* temp = *a; *a = *b; *b = temp; } int main() { int x = 1, y = 9; int* u = &x; int* v...
GO Classes
445
views
GO Classes
asked
Jan 21
Programming in C
goclasses2024-mockgate-12
goclasses
programming
programming-in-c
pointers
2-marks
+
–
4
votes
2
answers
30
GO Classes Test Series 2024 | Mock GATE | Test 11 | Question: 21
Consider the following two blocks of code, found in separate files: /* main.c */ int main() { int i=0; foo(); return 0; } /* foo.c */ int i=1; void foo() { printf( %d , i); } What will happen when you attempt to ... ? It will fail to compile. It will fail to link. It will print " $0$ ". It will print " $1$ ".
Consider the following two blocks of code, found in separate files:/* main.c */ int main() { int i=0; foo(); return 0; }/* foo.c */ int i=1; void foo() { printf(“%d”,...
GO Classes
883
views
GO Classes
asked
Jan 13
Programming in C
goclasses2024-mockgate-11
goclasses
programming
programming-in-c
recursion
1-mark
+
–
Page:
1
2
3
4
5
6
...
64
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register