Login
Register
Dark Mode
Brightness
Ambient Glow – Questions list
Register
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged c-programming
12
12 votes
1
1 answer
1.1k
1.1k views
GO Classes DPP | GATE CS | C Programming | Struct Padding
Assume:$\texttt{short = 2 bytes}$, $\texttt{int = 4 bytes}$, $\texttt{char = 1 byte}$$\texttt{int}$ needs $4$-byte alignment and the final structure size is rounded to a ...
GO Classes
1.1k
views
asked
Jul 2
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-312
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
14
14 votes
2
2 answers
580
580 views
GO Classes DPP | GATE CS | C Programming | Struct Pointer
Assume:struct Student { double gpa; }; struct Student alice; struct Student *sptr = &alice;Which of the following correctly assigns $\texttt{4.0}$ to $\texttt{alice.gpa}$...
GO Classes
580
views
asked
Jul 2
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-312
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
multiple-selects
+
–
9
9 votes
1
1 answer
441
441 views
GO Classes DPP | GATE CS | C Programming | Struct Copy
Consider the following code idea from the source:typedef struct { double x, y; } Point; void reset(Point p) { p.x = p.y = 0; } int main() { Point a = {12.0, 42.0}; Point ...
GO Classes
441
views
asked
Jul 2
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-312
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
6
6 votes
1
1 answer
425
425 views
GO Classes DPP | GATE CS | C Programming | Member Access
What is printed by the following program?#include <stdio.h struct Student { int id, year; char grade; }; int main() { struct Student s; s.id = 10001; s.year = 2010; s.gra...
GO Classes
425
views
asked
Jul 2
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-312
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
8
8 votes
1
1 answer
390
390 views
GO Classes DPP | GATE CS | C Programming | Typedef Structure
Which option correctly completes the given exercise?#include <stdio.h /* define the person struct here using the typedef syntax */ int main() { person john; john.name = "...
GO Classes
390
views
asked
Jul 2
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-312
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
11
11 votes
2
2 answers
453
453 views
GO Classes DPP | GATE CS | C Programming | Pass by Pointer
What is the output of the following code?#include <stdio.h void func(int a, int *bptr) { a = 42; *bptr = 42; return; } int main(void) { int x = 100, y = 100; func(x, &y);...
GO Classes
453
views
asked
Jul 1
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-311
programming-in-c
c-programming
goclasses-c-programming-practice-questions
+
–
11
11 votes
3
3 answers
457
457 views
GO Classes DPP | GATE CS | C Programming | Macro Parentheses Trap
Consider the macro:#define square(x) (x*x)Now consider the statement:c = square(a + b);After macro expansion, which expression is produced?$\texttt{c = ((a + b) * (a + b)...
GO Classes
457
views
asked
Jul 1
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-311
programming-in-c
c-programming
goclasses-c-programming-practice-questions
+
–
11
11 votes
4
4 answers
376
376 views
GO Classes DPP | GATE CS | C Programming | Macro Expansion Trap
Consider the statement:double ans = 18.0 / squared(2 + 1);For each of the following macro definitions, find the value of $\texttt{ans}$.#define squared(x) x*x #define squ...
GO Classes
376
views
asked
Jul 1
Programming and DS
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-311
programming-in-c
c-programming
goclasses-c-programming-practice-questions
+
–
7
7 votes
3
3 answers
403
403 views
GO Classes DPP | GATE CS | C Programming | Character I/O
What does the following code do?#include <stdio.h int main() { char c; while ((c = getchar()) != EOF) { if (c >= 'A' && c <= 'Z') c = c - 'A' + 'a'; putchar(c); } return ...
GO Classes
403
views
asked
Jul 1
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-311
programming-in-c
c-programming
goclasses-c-programming-practice-questions
+
–
9
9 votes
2
2 answers
374
374 views
GO Classes DPP | GATE CS | C Programming | Getchar Putchar Loop
Consider the following program:#include <stdio.h int main(void) { char ch; printf("Enter your input: "); while ((ch = getchar()) != 'C') { putchar(ch); } return 0; }For t...
GO Classes
374
views
asked
Jul 1
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-311
programming-in-c
c-programming
goclasses-c-programming-practice-questions
+
–
5
5 votes
1
1 answer
293
293 views
GO Classes DPP | GATE CS | C Programming | Structure Padding
Assume:$\texttt{char}$ takes $1$ byte $\texttt{int}$ takes $4$ bytes $\texttt{int}$ must be stored at an address divisible by $4$ Structure size is rounded to a multiple ...
GO Classes
293
views
asked
Jun 30
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-310
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
5
5 votes
2
2 answers
291
291 views
GO Classes DPP | GATE CS | C Programming | Structure Assignment
What is the output of the following code?#include <stdio.h struct Book { char name[4]; int pages; }; int main() { struct Book b1 = {"CAT", 50}; struct Book b2; b2 = b1; b...
GO Classes
291
views
asked
Jun 30
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-310
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
array
+
–
5
5 votes
2
2 answers
287
287 views
GO Classes DPP | GATE CS | C Programming | Structure Passed by Value
What is the output of the following code?#include <stdio.h struct Item { int code; int price; }; void f(struct Item x) { x.code = x.code + 1; x.price = x.price + 50; } vo...
GO Classes
287
views
asked
Jun 30
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-310
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
pointers
+
–
7
7 votes
3
3 answers
350
350 views
GO Classes DPP | GATE CS | C Programming | Array of Structures with Pointer
What is the output of the following code?#include <stdio.h struct Student { int roll; int marks; }; int main() { struct Student s[3] = { {1, 50}, {2, 60}, {3, 70} }; stru...
GO Classes
350
views
asked
Jun 30
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-310
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
6
6 votes
2
2 answers
298
298 views
GO Classes DPP | GATE CS | C Programming | Structure Pointer Precedence
What will happen when the following code is compiled?#include <stdio.h struct Node { int data; }; int main() { struct Node n = {25}; struct Node *p = &n; printf("%d", *p....
GO Classes
298
views
asked
Jun 30
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-310
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
6
6 votes
3
3 answers
305
305 views
GO Classes DPP | GATE CS | C Programming | Structure Copy
What will happen when the following code is compiled?#include <stdio.h struct Point { int x; int y; }; int main() { struct Point p1 = {2, 4}; struct Point p2; p2 = p1; p2...
GO Classes
305
views
asked
Jun 29
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-309
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
7
7 votes
2
2 answers
288
288 views
GO Classes DPP | GATE CS | C Programming | Structure Pointer in Function
What is the output of the following code?#include <stdio.h struct Item { int code; int price; }; void update(struct Item *p) { p->price = p->price + 20; (*p).code = (*p)....
GO Classes
288
views
asked
Jun 29
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-309
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
pointers
functions
+
–
6
6 votes
2
2 answers
259
259 views
GO Classes DPP | GATE CS | C Programming | Structure Pointer
What is the output of the following code?#include <stdio.h struct Box { int width; int height; }; int main() { struct Box b = {4, 6}; struct Box *p = &b; p->width = p->wi...
GO Classes
259
views
asked
Jun 29
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-309
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
pointers
+
–
5
5 votes
2
2 answers
298
298 views
GO Classes DPP | GATE CS | C Programming | Array of Structures
What is the output of the following code?#include <stdio.h struct Student { int roll; int marks; }; int main() { struct Student s[3] = { {1, 70}, {2, 80}, {3, 90} }; s .m...
GO Classes
298
views
asked
Jun 29
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-309
programming-in-c
c-programming
goclasses-c-programming-practice-questions
array
structure
+
–
6
6 votes
2
2 answers
281
281 views
GO Classes DPP | GATE CS | C Programming | Structure Member Access
What is the output of the following code?#include <stdio.h struct Book { char name; float price; int pages; }; int main() { struct Book b1 = {'C', 150.5, 300}; b1.pages =...
GO Classes
281
views
asked
Jun 29
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-309
programming-in-c
c-programming
goclasses-c-programming-practice-questions
structure
+
–
5
5 votes
2
2 answers
278
278 views
GO Classes DPP | GATE CS | C Programming | Memory Leak
What is the main issue in the following code? Assume both $\texttt{malloc()}$ calls succeed.#include <stdio.h #include <stdlib.h int main() { int *p = (int *)malloc(sizeo...
GO Classes
278
views
asked
Jun 27
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-308
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
4
4 votes
2
2 answers
267
267 views
GO Classes DPP | GATE CS | C Programming | Dangling Pointer
What will happen in the following code?#include <stdio.h #include <stdlib.h int main() { int *p = (int *)malloc(sizeof(int)); *p = 10; free(p); printf("%d", *p); return 0...
GO Classes
267
views
asked
Jun 27
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-308
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
5
5 votes
2
2 answers
278
278 views
GO Classes DPP | GATE CS | C Programming | Malloc & Heap Memory
What is the output of the following code? Assume $\texttt{malloc()}$ succeeds.#include <stdio.h #include <stdlib.h int main() { int *p = (int *)malloc(3 * sizeof(int)); p...
GO Classes
278
views
asked
Jun 27
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-308
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
6
6 votes
2
2 answers
238
238 views
GO Classes DPP | GATE CS | C Programming | Void Pointer Typecasting
What is the output of the following code?#include <stdio.h int main() { int x = 25; void *p = &x; printf("%d", *(int *)p); return 0; }$\texttt{25}$ Address of $\texttt{x}...
GO Classes
238
views
asked
Jun 27
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-308
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
7
7 votes
2
2 answers
275
275 views
GO Classes DPP | GATE CS | C Programming | Complex Declaration
Which of the following correctly describes the declarations?int *a[10]; int (*p)[5];$\texttt{a}$ is a pointer to an array of $10$ integers, and $\texttt{p}$ is an array o...
GO Classes
275
views
asked
Jun 27
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-308
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
6
6 votes
2
2 answers
301
301 views
GO Classes DPP | GATE CS | C Programming | Pointer to Row
What is the output of the following code?#include <stdio.h int main() { int a[3] = { {1, 2}, {3, 4}, {5, 6} }; int (*p) = a; p++; printf("%d %d %d", (*p)[0], *(*(p + 1)...
GO Classes
301
views
asked
Jun 25
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-307
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
8
8 votes
3
3 answers
388
388 views
GO Classes DPP | GATE CS | C Programming | 2D Array Access
What is the output of the following code?#include <stdio.h int main() { int a [3] = { {2, 4, 6}, {8, 10, 12} }; printf("%d %d %d", a , *(*(a + 1) + 1), *(*a + 2)); retur...
GO Classes
388
views
asked
Jun 25
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-307
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
7
7 votes
3
3 answers
304
304 views
GO Classes DPP | GATE CS | C Programming | Double Pointer in Function
What is the output of the following code?#include <stdio.h void update(int q, int *r) { q = q + 5; *q = r; q = q + 2; } int main() { int x = 3, y = 8; int *p = &x; u...
GO Classes
304
views
asked
Jun 25
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-307
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
8
8 votes
3
3 answers
318
318 views
GO Classes DPP | GATE CS | C Programming | Pointer Redirection
What is the output of the following code?#include <stdio.h int main() { int a = 5, b = 9; int *p = &a; int q = &p; *p = *p + 2; *q = &b; q = q + 3; printf("%d %d %d", ...
GO Classes
318
views
asked
Jun 25
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-307
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
8
8 votes
3
3 answers
337
337 views
GO Classes DPP | GATE CS | C Programming | Double Pointer Basics
What is the output of the following code?#include <stdio.h int main() { int x = 10; int *p = &x; int q = &p; q = q + 4; *p = *p + 1; printf("%d %d", x, q); return 0; ...
GO Classes
337
views
asked
Jun 25
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-307
programming-in-c
c-programming
goclasses-c-programming-practice-questions
pointers
+
–
Page:
1
2
3
4
5
next »