Login
Register
Dark Mode
Brightness
Ambient Glow – Questions list
Register
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged programming-in-c
1
1 vote
1
1 answer
320
320 views
C programming , Doubt with the concepts of precedence , Associativity and Order of evaluation
1. If precedence tells me which operator has priority, and associativity tells me how to handle operators at the same level, then why do I need a separate concept called ...
khanshahima4
320
views
asked
Sep 24
Programming in C
programming-in-c
operator-precedence
+
–
14
14 votes
1
1 answer
1.4k
1.4k 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.4k
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
+
–
18
18 votes
2
2 answers
770
770 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
770
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
+
–
10
10 votes
1
1 answer
575
575 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
575
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
546
546 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
546
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
524
524 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
524
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
+
–
12
12 votes
2
2 answers
548
548 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
548
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
+
–
12
12 votes
3
3 answers
557
557 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
557
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
464
464 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
464
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
490
490 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
490
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
456
456 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
456
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
+
–
6
6 votes
1
1 answer
370
370 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
370
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
375
375 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
375
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
+
–
6
6 votes
2
2 answers
384
384 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
384
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
+
–
8
8 votes
3
3 answers
449
449 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
449
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
+
–
8
8 votes
2
2 answers
381
381 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
381
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
+
–
7
7 votes
3
3 answers
386
386 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
386
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
374
374 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
374
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
340
340 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
340
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
+
–
6
6 votes
2
2 answers
385
385 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
385
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
353
353 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
353
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
+
–
6
6 votes
2
2 answers
353
353 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
353
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
361
361 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
361
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
358
358 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
358
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
+
–
8
8 votes
2
2 answers
300
300 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
300
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
+
–
9
9 votes
2
2 answers
361
361 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
361
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
376
376 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
376
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
488
488 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
488
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
+
–
9
9 votes
3
3 answers
406
406 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
406
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
+
–
9
9 votes
3
3 answers
442
442 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
442
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
6
...
86
next »